Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for generic serial input #616

Open
timknowlden opened this issue Feb 8, 2024 · 15 comments
Open

Add support for generic serial input #616

timknowlden opened this issue Feb 8, 2024 · 15 comments

Comments

@timknowlden
Copy link

Hi, looking for a way to implement gatw access using 868mhz fobs, will this system work with those if the fob receiver uses weigand?

Thanks, Tim

@timknowlden
Copy link
Author

timknowlden commented Feb 13, 2024

This is something im intersted to know if it would work with?

62822381d8de6982DS-ZPT-3.pdf

@timknowlden
Copy link
Author

I've received the above mentioned rf receiver today, try all the different protocols listed, there is only one serial output, but when that is connected using weigand on gpio13 only I get this UID, it pops up asking to add user so serial data is being sent, but when using MFRC522, PN532 AND RDM6300 I do not get any data.

Sadly this UID is the same number for two different RF fobs.

The other reader types do not support GPIO13.
Screenshot_20240215_151009_Brave
Screenshot_20240215_154335_Amazon Shopping

@plex3r
Copy link
Contributor

plex3r commented Feb 22, 2024

@timknowlden

Wiegand uses 2 lines Data 0 and Data 1

You need to explain a bit further how you've wired things up as well

@timknowlden
Copy link
Author

timknowlden commented Feb 22, 2024

@timknowlden

Wiegand uses 2 lines Data 0 and Data 1

You need to explain a bit further how you've wired things up as well

Hi,

So I've used a zpt receiver from rf solutions, pin 6 is the serial output pin.

I've tried connecting pin 6 to every input pin that is available inside of esp-rfid, I've gone through all the reader types listed in esprfid hardware settings.

When type selected is wiegand and pin 6 is connected to IO13 on the pictured esp relay board. I get the UID picked up as 1677721. (both fobs yield same UID) This isn't the fob serial number sent by the rf remote.

You can see from the datasheet pictured that the first 3 bytes sent on the serial output are the rf rob serial number.

You can also see from a d1 mini I connected to to the receiver ZPT PIN 6 > ESP8266 PIN D2 using the uart component in esphome that the serial number is picked up in the log. I only need to capture the serial number, the rest of the data is irrelevant, battery status, rssi, etc.

Two fobs tested, one serial number = 02:85:82, other = 02:88:63

Going back to the ESPRFID, using all of the other reader types yields no results being captured.

I don't know enough about editing the code, but I'm sure someone with knowledge would be able to help implement serial input?

My other thoughts are, could I take the serial number by uart from esphome on the d1 and send out a serial number on wiegand protocol?

ZPT datahseet: https://www.rfsolutions.co.uk/downloads/62822381d8de6982DS-ZPT-3.pdf

ESPhome sketch:

esphome:
  name: rfreceiver
  platform: ESP8266
  board: d1_mini

wifi:
  ap:
    ssid: rf

logger:
ota:


uart:
  baud_rate: 19200
  rx_pin: D2
  debug:
    direction: RX
    dummy_receiver: true

image-3
image-4

@timknowlden
Copy link
Author

I've got the serial number now in a sensor inside esphome, so hoping I can send that serial number by uart to esprfid and that it will be recognised using the inbuilt reader types

@timknowlden
Copy link
Author

esphome:
  name: rf
  platform: ESP8266
  board: d1_mini

wifi:
  ssid: "cnc"
  password: "&45t0W19"

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "RFMini"

web_server:
  port: 80
  version: 2

captive_portal:

logger:
  level: warn
uart:
  id: uart_bus
  baud_rate: 19200
  rx_pin: D2
  debug:
    direction: RX
    dummy_receiver: true
    after:
      delimiter: ":"
    sequence:
      - lambda: |-
          UARTDebug::log_int(UART_DIRECTION_RX, bytes, ':');

          int val1 = bytes[0];
          int val2 = bytes[1];
          int val3 = bytes[2];

          // publish individual values
          id(byte1).publish_state(val1);
          id(byte2).publish_state(val2);
          id(byte3).publish_state(val3);
          id(combined_bytes).publish_state(val1);

sensor:
  - platform: template
    name: "Combined Bytes"
    id: "combined_bytes"
    unit_of_measurement: ""
    # update_interval: 1s
    lambda: |-
      return int((id(byte1).state * 1000000) + (id(byte2).state * 1000) + id(byte3).state);
    internal: true
  - platform: template
    name: "Byte1"
    id: "byte1"
    internal: true
  - platform: template
    name: "Byte2"
    id: "byte2"
    internal: true
  - platform: template
    name: "Byte3"
    id: "byte3"
    unit_of_measurement: ""
    internal: true

text_sensor:
  - platform: template
    name: "Keyfob Serial Number"
    id: serial
    icon: "mdi:eye"
    update_interval: 1s
    lambda: |-
      char result[10];
      sprintf(result, "%.0f%.0f%.0f", id(byte1).state, id(byte2).state, id(byte3).state);

      // Check if the result is "nannannan"
      if (strcmp(result, "nannannan") == 0) {
        return esphome::optional<std::string>("Press remote fob button");
      } else {
        return esphome::optional<std::string>(result);
      }


@timknowlden
Copy link
Author

timknowlden commented Feb 26, 2024

image
byte

@timknowlden
Copy link
Author

I can't see how I'd know if data is being received by esprfid, I've tried changing reader type to rdm6300 and sending a uart packet from my esphome device, but the logs don't show anything received?

@timknowlden
Copy link
Author

So running debug bin and monitoring using serial I get no data received when reader type is set to rdm6300 (which I believe uses uart serial?) I've set baud rate to 9600 and with a serial USB convertor in Windows machine I pick up data at 9600baud. See putty screenshot. Yet inside esprfid there is nothing in the monitor?
image-6
image-7

@timknowlden
Copy link
Author

timknowlden commented Feb 29, 2024

image-8
image

@timknowlden
Copy link
Author

image

@plex3r
Copy link
Contributor

plex3r commented Feb 29, 2024

How many fobs are you wanting to add to the add to the system?

ESPRFID works well in a scenario where you're controlling access for multiple users but if you just want the system to recognise 1 or 2 rf fobs it would seem overkill, just use your HA code or other code running on your relay board with your example sketches to activate the relay when a valid fob serial number is transmitted?

@timknowlden
Copy link
Author

How many fobs are you wanting to add to the add to the system?

ESPRFID works well in a scenario where you're controlling access for multiple users but if you just want the system to recognise 1 or 2 rf fobs it would seem overkill, just use your HA code or other code running on your relay board with your example sketches to activate the relay when a valid fob serial number is transmitted?

Around 100 fobs, each that can be removed or disabled. scenario being that somebody leaves the company but doesnt return their fob, they have access to remote depots.

I need to be able to Log who and when they enter site, so a unique serial number registered to their name seems logical and ESPRFID software is great for that. easy to add and remove users, especially for those who are managing the system and computer illiterate.

@matjack1
Copy link
Collaborator

Hey @timknowlden actually it wouldn't be too complex to support a generic serial reading.

Currently though the serial read is then parsed specifically from a library for RDM6300 or RF125-PS or Gwiot 7941E.

I don't have time to add support for this before releasing v2, but if you (or anyone else) wants to work on this let me know and I can guide you towards implementing it, OK?

@matjack1 matjack1 changed the title Question: Is there an ethernet option and RF fob support? Add support for generic serial input Mar 23, 2024
@timknowlden
Copy link
Author

Hey @timknowlden actually it wouldn't be too complex to support a generic serial reading.

Currently though the serial read is then parsed specifically from a library for RDM6300 or RF125-PS or Gwiot 7941E.

I don't have time to add support for this before releasing v2, but if you (or anyone else) wants to work on this let me know and I can guide you towards implementing it, OK?

Hi, I have actually put a stop on this project for now... maybe i will come back to it in the future. I dont really have enough knowledge to implement myself

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants