FHEM Forum

FHEM => English Corner => Thema gestartet von: andrejs am 25 April 2014, 17:15:25

Titel: RFID Module
Beitrag von: andrejs am 25 April 2014, 17:15:25
I created my first module 99_RFID.pm for reading the data from USB RFID Reader 125 kHz (bought on Ebay http://www.ebay.com/itm/USB-RFID-Contactless-Proximity-Security-Sensor-Smart-Card-Reader-125Khz-EM4100-/360838251721?pt=BI_Security_Fire_Protection&hash=item5403a2c4c9 (http://www.ebay.com/itm/USB-RFID-Contactless-Proximity-Security-Sensor-Smart-Card-Reader-125Khz-EM4100-/360838251721?pt=BI_Security_Fire_Protection&hash=item5403a2c4c9)). The module was not created from scratch because I used the existing one created by R.Koenig (thank you for that) and make some changes.
In order to connect RFID READER to FHEM you should do the following:
•   Do not use USB port on the USB Reader for the connection but open the plastic box of the reader and connect wires on the pins on PCB. The instructions can be find in German language http://www.pcmx.de/?p=216
•   For the connection from pins on PCB to the USB of the computer I used the USB 2.0 to UART TTL 6PIN Connector Module (bought on Ebay)

Description of the perl module

Define
Define <name> RFID  <subtype> <devicename> <card number> <keylock>
<subtype> can be "user" or "system"
<devicename> specifies the serial port to communicate with the RFID Reader. The name of the serial-device depends on your distribution, under linux the cdc_acm kernel module is responsible, and usually a /dev/ttyACM0 device will be created.
<card number> should defined if subtype is "user". Card number is a 10 digit number which is normally printed on RFID key or card.
<keylock> should be defined if subtype is "system" but it is optional parameter. Keylock is the name of FHEM device which represents the switch and tells the system if the doors are locked or unlocked. For example you can use for the switch the ELV FS20 TFK (use Eventmap to define in FHEM off as unlock and on as lock).
Example
define door_acess RFID system /dev/ttyUSB2 doorkey
define user1 RFID user 0005354301

Set
Nothting defined

Get
Nothing defined

Readings
lock/unlock for each user with time of last action

Attributes
active  (value 0 or 1)
if the value of attribute "active" is 0 then the user is not active and can not lock/unlock the door
restricted  (format:  <nameofday>-<beginning of restriction hh:mm:ss><end of restriction hh:mm:ss>-
Example of attribute "restricted"
Friday-00:00-07:00/Saturday-00:00-07:00
The user can not unlock/lock the door on Friday and Saturday from midnight to 7 o'clock in the morning

The reason to create FHEM module was because I constantly had a problem that someone in my family (specially kids) lost the keys. Because I already had some gadgets in place and also FHEM with CUL device I set up the following solution:
•   electric motor key lock (Conrad KM300) with remote interface (ELV KM300 RI). With remote interface you power and control the motor key lock (lock, unlock, open the door). Remote interface has simple UPS ELV USV12
•   FS20 1-Kanal-Universal-Empfänger UE1-2. The switch is connected to remote interface and enables to control motor key lock with FHEM
•   ELV FS20 TFK is a switch to indicate if doors are locked or unlocked. Use Eventmap to define off as unlock and on as lock.
•   RFID reader 125Khz EM4100 with USB 2.0 to UART TTL 6PIN Connector Module
•   FHEM server with CUL device
•   define in FHEM notify procedure in order to trigger the FS20 UE1-2 switch to unlock or lock the motor key lock

I hope this module will be useful for someone.
Titel: Antw:RFID Module
Beitrag von: Lectere am 30 April 2014, 14:48:50
Cool stuff!, looks really nice.

Been looking for a simelair may to unlock my door!

Really appricate your effort, and if you have some more time, I'd really like to see a how-to with screenshot and shared code. (in english)

Two questions;
-could a simelar system be used with NFC of your phone?
-It is not a bit unsafe to have your lock operated over FS20?, I mean, its not very hard to send a 'open' command on every possible house code...

Great post, very inspiring!
Titel: Antw:RFID Module
Beitrag von: andrejs am 30 April 2014, 18:10:43
Thank you for showing the interest for the solution. Unfortunately the script does not cover the RFID Readers for  NFC because such readers works on the frequency 13,56 mHZ and I think also the protocol is different. The RFID reader which is supported with this script works on frequency 125 KHz.
Yes you are right it is not safe but this is just temporary solution. I have in the near future the intention to replace FS20 1-Kanal-Universal-Empfänger UE1-2 with the similar one from Homematic Funk-Schaltaktor, 4-fach (is more safe) but for that reason I need to buy another CUL device.
After I finish my vacation I will post some photos.

Andrej
 
Titel: Antw:RFID Module
Beitrag von: andrejs am 09 Mai 2014, 00:00:00
Finally I found time to create the scheme of door access control (see rfid_scheme.jpg) in my house in order explain more in details:

1.   RFID reader 125 kHz is connected through USB 2.0 to UART TTL 6pin to PC where the FHEM server is installed. Originally the RFID reader is in a black plastic box (see rfid_reader.jpg). I remove the black plastic box and on PCB of RFID reader solder 3 wires: VCC, GND, Data. These 3 wires are connected to USB 2.0. to UART TLL 6pin module: VCC to 5v, GND to GND and Data to TXD. In order to have nice box I bought RFID Door Access Control Reader Controller CK-138 (bought on Ebay) and use just the plastic box of this controller. First I drill the hole for led diode and then glue the PCB of RFID Reader in the box. I paid for all three components 17 EUR.
To read the number of the RDIF card/key the 99_RFID.pm file should be copied to FHEM directory and then you need define in fhem.cfg:
Subtype system you define just once   
define <some name> RFID system /dev/ttyUSBx <keylock – it is optional>
for each user you need to define separately
define <name of the user> RFID user <rfid card number 10 digits>

Everytime the card is put on RFID reader the FHEM system reads the card:
•   If the card (user) is defined then "lock" or "unlock" value is written
•   If the card (user) is not defined then  "unknown" value is written
•   If the card (user) is defined but attribute active is 1 then  "not_active " value is written
•   If the card (user) is defined but attribute restricted is defined and current time is in inside restricted day and time then "restricted" value is written

If you want to control any other device in FHEM then you shall define in FHEM NOTIFY procedure. In my case with notify procedure I trigger the FS20 UE1-2 switch to unlock or lock the motor key lock. I created in fhem.cfg the following notify procedures:
define door_lock NOTIFY keylock {if ( Value ("keylock") eq "lock") {fhem("set UE1_unlock on")}}
define door_unlock NOTIFY keylock {if ( Value ("keylock") eq "unlock") {fhem("set UE1_lock on")}}

2.   ELV Keymatic RI is controlled by two FS20 EU1-2 one is for lock (UE1_lock ) and the second (UE1_unlock ) is for unlock.
3.   The electric motor lock KM300 (it can be also ABUS CFA 1000) is connected with special cable (I got the cable in the package with ELV Keymatic RI) to ELV Keymatic RI.
4.   FS20 TFK is defined in FHEM as "keylock" and it is connected to micro switch to indicate if doors are locked or unlocked. The micro switch should be placed near the hole of strike plate where bolt of mortise lock entered.
5.   From  UPS ELV USV12  the ELV Keymatic RI is powered. In the UPS ELV USV12 are recharcheable batteries powered by AC DC Adaptor.

I checked on internet but unfortunately I found out that ELV Keymatic RI is not available anymore so my solution is outdated. Maybe the solution can be to use RFID reader 125Khz EM4100 with USB 2.0 to UART TTL 6PIN Connector Module and for unlock/lock the door with Keymatic KM300 Motorlock and HomeMatic LAN Konfigurations-Adapter -  for details see  http://forum.fhem.de/index.php/topic,11715.0.html (http://forum.fhem.de/index.php/topic,11715.0.html)
Titel: Antw:RFID Module
Beitrag von: Lectere am 12 Mai 2014, 13:00:19
Cool, good stuff! thanks for sharing!

I'm gonna for the wired NFC version, if I can build it!
Titel: Antw:RFID Module
Beitrag von: andrejs am 12 Mai 2014, 19:17:36
Thanks. I am also interested for NFC solution. Please share it to me when it will be ready. 

andrej
Titel: Antw:RFID Module
Beitrag von: Lectere am 13 Mai 2014, 08:53:56
Well... :) I've got to get the NFC reader first.

Since I'm running on a Raspi, first step is to find a compatible USB device for libnfc;

https://code.google.com/p/libnfc/

Think this is the list;

http://nfc-tools.org/index.php?title=Devices_compatibility_matrix


First goal is to turn on a light with my phone. If that works, I can try a lock... :)
Titel: Antw:RFID Module
Beitrag von: Lectere am 13 Mai 2014, 09:15:13
I think this is the best option;

acr122 usb

You can get it around 40 euro in europe. Accourding to this; http://nfc-tools.org/index.php?title=Devices_compatibility_matrix it's compatible as 'initiator'. But since we only need to verify a phone NFC, for access, that should be enough.
Titel: Antw:RFID Module
Beitrag von: breezybadger am 06 Juni 2014, 16:35:51
Hey, did you see any chance to use the HID ( my RFID is reconiced as Keyboard ) to use as input device ? What device should i used to add this to my FHEM config (/dev/input...? ) ?
Titel: Antw:RFID Module
Beitrag von: eppi am 21 Juli 2014, 10:56:21
Hi andrejs
Thank you very much for the module! I have a question: I am planning to use two TTL-USB for RFID, one for the front door and one for the garage door.
Therefore it is necessary that the RFID reader knows the Location and opens the corresponding device.

Is that possible?

Many thanks!
Greets Dani
Titel: Antw:RFID Module
Beitrag von: no_Legend am 21 Juli 2014, 11:11:25
Hi Eppi,

it looks that there should not be a problem.
You can give each reader a unique name.

But i Think can be a problem.
If you use the same reader at one system, it can happen that the reader is change the unix device name.
So it will be better to use udev if the reader got a unique serial.
Titel: Antw:RFID Module
Beitrag von: eppi am 21 Juli 2014, 19:08:48
Hi together
I have problems and need your support.
I installed the USB-TTL Adapter without problem

My Define:
list door_access
Internals:
    DEF system / dev/ttyUSB0
    DEVICE NAME / dev/ttyUSB0
    FD 10
    KEYLOCK
    NAME door_acess
    NR 105
    PARTIAL
    STATE opened
    SUBTYPE system
    TYPE RFID
Attributes:
    room RFID

   
The system shows me "opened", so far so good!

I created the User:

list user1:
Internals:
    CARDNR 0006994919
    DEF user 0006994919
    NAME user1
    NR 106
    STATE?
    SUBTYPE user
    TYPE RFID
Attributes:
    room RFID


If I go with the card over the RFID-Reader, it reacts by a beep, but the event monitor in FHEM ist empty.
Can you help me?

Btw: Sorry for my bad english...
Titel: Antw:RFID Module
Beitrag von: andrejs am 24 August 2014, 01:19:43
Hi eppi. First I would like to ask you which RFID reader do you use? If "RFID reader 125Khz EM4100" is not used then the module 99_RFID.pm does not work correctly.

Titel: Antw:RFID Module
Beitrag von: eppi am 24 August 2014, 17:45:59
Hi Andrejs
i use the RDM630 http://coldtears.lin3.siteonlinetest.com/files/RDM630-Spec..pdf (http://coldtears.lin3.siteonlinetest.com/files/RDM630-Spec..pdf)

I have a python script found, which I have adapted so does the RDM 630 with the USB TTL UART (see attachment).

Your modules I can not load as before. Do you have any idea what I'm doing wrong?
Thank you very much!

Greets Dani
Titel: Antw:RFID Module
Beitrag von: andrejs am 25 August 2014, 13:31:07
Dear Dani,

as I said fhem module 99_RFID.pm is written just for RFID reader 125Khz EM4100 and  other readers will not work correctly because the output format of data is different. So the 99_RFID.pm module should be changed in order to get card number from RDM630 and also in define sentance we should add the model (for example EM4100, RDM630) in order to support different output format of data. Unfortunately I am not able to test  because I do not have RDM630 in place. I propose for the start that you make change in 99_RFID.pm line -  please just delete hash sign (#) before the following line:
#Log 3, "$mybufdec + $RFID_count";
With this change the output data from your RFID reader will be written in log file of FHEM. I would like to ask you to go with the card over your RFID reader and send to me the FHEM log file in order to see what kind of output data came from RFID reader RDM630.

Regards

Andrej
Titel: Antw:RFID Module
Beitrag von: eppi am 26 August 2014, 07:35:42
Hi Andrej
Thank you for your help!

Attached find you my LogFile.

After FHEM "shutdown restart" is my Device STATE "opened", after first RFID read is the STATE "not_active".

Greets Dani
Titel: Antw:RFID Module
Beitrag von: andrejs am 26 August 2014, 10:17:32
Hi Dani,

please tell me what is the card number (10 digit number)?

Andrej
Titel: Antw:RFID Module
Beitrag von: eppi am 26 August 2014, 10:30:46
Hi Andrej
yes, 10 Digits!
The Card RFID Number is 0006994818

Greets Dani
Titel: Antw:RFID Module
Beitrag von: andrejs am 26 August 2014, 17:07:34
I checked the Fhem log file and the format data output was the same as it is written in specification of RDM630 for RS232 (http://coldtears.lin3.siteonlinetest.com/files/RDM630-Spec..pdf). The output was the following:

Output data (HEX): 02 | 30 30 30 30 36 41 42 42 38 32 | 35 33 | 03
Output data (DEC)    2 |48 48 48 48 54 65 66 66 56 50  | 53 51 | 3 (this you can find in fhem log file)

So according to the specification 10 HEX numbers represent the card number (red coloured) converted in decimal:
CardNumber Decimal: 48 48 48 48 54 65 66 66 56 50

If I convert cardnumber from decimal to ascii I get 00006ABB82.

Now I have an issue how can I get the card number 0006994818. Is this card number which you gave me correct?

Andrej




Titel: Antw:RFID Module
Beitrag von: eppi am 26 August 2014, 17:27:06
Yes Andrej
The Number is correct: 0006994818 (see attached image)

I record a new log but with the same data:
2014.08.26 17:13:26 0: Server started with 40 defined entities (version $Id: fhem.pl 6249 2014-07-13 10:41:00Z rudolfkoenig $, os linux, user fhem, pid 24909)
2014.08.26 17:13:50 3: 2 +
2014.08.26 17:13:50 3: 48 + 1
2014.08.26 17:13:50 3: 48 + 0
2014.08.26 17:13:50 3: 48 + 1
2014.08.26 17:13:50 3: 48 + 0
2014.08.26 17:13:50 3: 54 + 1
2014.08.26 17:13:50 3: 65 + 0
2014.08.26 17:13:50 3: 66 + 1
2014.08.26 17:13:50 3: 66 + 0
2014.08.26 17:13:50 3: 56 + 1
2014.08.26 17:13:50 3: 50 + 0
2014.08.26 17:13:50 3: 53 + 1
2014.08.26 17:13:50 3: 51 + 0
2014.08.26 17:13:50 3: 3 + 1


Thanks you!
Greets Dani
Titel: Antw:RFID Module
Beitrag von: andrejs am 26 August 2014, 17:33:17
Dear Dani,

sorry you are right the card number is OK. I found the solution. In order to get card number 0006994818 I just need to convert the whole ascii card number 00006ABB82  to decimal. I will amend fhem RFID module and attach it in order to test it.

Andrej
Titel: Antw:RFID Module
Beitrag von: eppi am 26 August 2014, 17:55:15
Dear Andrej
Cool, I'm verry impressed!

Greets Dani
Titel: Antw:RFID Module
Beitrag von: andrejs am 27 August 2014, 01:59:23
Hi Dani,

I managed to amend 99_RFID.pm in order to be useful also for RDM630 and I would like to ask you to test it. In the FHEM module you will find a few "Log 5" (in the case of some error I will be able to check the log file) so please in FHEM cfg file add line or amended to attr global verbose 5.
I also need to change the description of the perl module (see below). I hope it will work.

Andrej


*****************************************************************************
Define
Define <name> RFID  <subtype> <devicename> <model> <card number> <authorisation> <keylock> <doorstate>

<subtype> can be "user" or "system"
<devicename> specifies the serial port@baudrate or IP address with port number to communicate with the RFID Reader. The name of the serial-device depends on your distribution, under linux the cdc_acm kernel module is responsible, and usually a /dev/ttyUSBX device will be created.
<card number> should be defined if subtype is "user". Card number is at least 10 digit number which is normally printed on RFID key or card.
<model> two models are possible to define EM4100 and RDM630
<authorisation> should be defined if subtype is "user". Parameter specifies for which RFID reader or readers is user authorised. Possible values:
ALL - user has access/authorisation to all RFID readers
NONE - user has no access/authorisation to RFID readers
PART(reader1,reader2,...)  - user has access/authorisation to RFID readers defined in brackets seperated by comma
<keylock> should be defined if subtype is "system" but it is optional parameter. Keylock is the name of FHEM device which represents the switch and tells the system if the doors are locked or unlocked. For example you can use for the switch the ELV FS20 TFK or HomeMatic 3-Kanal-Funk-Schließerkontakt-Interface (for ELV FS20 use Eventmap to define in FHEM off as unlock and on as lock).
<doorstate> should be defined if subtype is "system" but it is optional parameter. Doorstate is the name of FHEM device which represents the switch and tells the system if the doors are opened or closed. For example you can use for the switch the ELV FS20 TFK or HomeMatic 3-Kanal-Funk-Schließerkontakt-Interface (for ELV FS20 use Eventmap to define in FHEM off as open and on as closed).
Example
define door_acess RFID system /dev/ttyUSB2@9600 EM4100 doorkey doorswitch
define door_acess RFID system 192.168.1.101:3000 RDM630 doorkey doorswitch
define user1 RFID user 0005354301 PART(door_acess)

Set
Nothting defined

Get
Nothing defined

Readings - for each user with time of last action
lock
unlock
lock/unlock
no_auth
no_value
not_active
restricted
door_notclosed
not_correct
unknown


Attributes
rfid_active  (value 0 or 1)
if the value of attribute "rfid_active" is 0 then the user is not active and can not lock/unlock the door. If the attribute is not defined then the default value is 0.
rfid_restricted  (format:  <nameofday>-<beginning of restriction hh:mm:ss><end of restriction hh:mm:ss>-
If there is no restrictions for the user then the value of attribute should be 0.
Example of attribute "rfid_restricted"
Friday-00:00-07:00/Saturday-00:00-07:00
The user can not unlock/lock the door on Friday and Saturday from midnight to 7 o'clock in the morning
   
Titel: Antw:RFID Module
Beitrag von: eppi am 27 August 2014, 08:15:22
Hi Andrej
Thank you for your works! I have Problems: The Reader goes after the first read to "unknow". i can not set any attribut...
My Defines:

RDM630:
Internals:
   CFGFN
   COUNTER    2
   DEF        system /dev/serial/by-id/usb-Silicon_Labs_CP2102_USB_to_UART_Bridge_Controller_0001-if00-port0 RDM630
   DEVICENAME /dev/serial/by-id/usb-Silicon_Labs_CP2102_USB_to_UART_Bridge_Controller_0001-if00-port0
   DOORSTATE  NA
   FD         11
   KEYLOCK    NA
   MODEL      RDM630
   NAME       RFID_Reader
   NR         118
   PARTIAL
   STATE      not_active
   SUBTYPE    system
   TYPE       RFID
   Readings:
     2014-08-27 07:42:19   RFID_Reader     not_active
Attributes:
   active     0
   fname      RFID_Reader
   restricted
   room       RFID


User 1:
Internals:
   CARDNR     0006994818
   DEF        user 0006994818
   NAME       user1
   NR         20
   STATE      ???
   SUBTYPE    user
   TYPE       RFID
Attributes:
   room       RFID


Attached fid you my Log, recorded with Loglevel 5.
Thank you verry much.
Greets Dani
Titel: Antw:RFID Module
Beitrag von: andrejs am 27 August 2014, 18:32:54
Dani,
here is the corrected FHEM module. Please test again and send me the log file. I hope I will be lucky this time....

Andrej
Titel: Antw:RFID Module
Beitrag von: eppi am 27 August 2014, 19:49:41
Hi Andrej
unfortunately no ...
Attached find yo my Log...

Good Luck und many thanks!
Greets Dani
Titel: Antw:RFID Module
Beitrag von: andrejs am 27 August 2014, 20:40:25
It seems I am not so good at that. The problem was printf (it should be sprintf) and it is corrected. Test again please...
Titel: Antw:RFID Module
Beitrag von: eppi am 27 August 2014, 21:03:28
better, but not good  ;)

After the first read:
Internals:
   COUNTER    0
   DEF        system /dev/serial/by-id/usb-Silicon_Labs_CP2102_USB_to_UART_Bridge_Controller_0001-if00-port0 RDM630
   DEVICENAME /dev/serial/by-id/usb-Silicon_Labs_CP2102_USB_to_UART_Bridge_Controller_0001-if00-port0
   DOORSTATE  NA
   FD         10
   KEYLOCK    NA
   MODEL      RDM630
   NAME       RFID_Reader
   NR         21
   PARTIAL
   STATE      not_active
   SUBTYPE    system
   TYPE       RFID
   Readings:
     2014-08-27 19:46:40   RFID_Reader     unknown
     2014-08-27 20:56:58   user1           not_active
Attributes:
   room       RFID


and the User:
Internals:
   CARDNR     0006994818
   DEF        user 0006994818
   NAME       user1
   NR         20
   STATE      not_active
   SUBTYPE    user
   TYPE       RFID
   Readings:
     2014-08-27 20:56:58   user1           not_active
Attributes:
   active     0
   fname      user1
   restricted
   room       RFID


Is not possible to change the attribut "active" to 1.
Attached find you my LogFile.

Thank you, great Job!
Greets Dani
Titel: Antw:RFID Module
Beitrag von: andrejs am 27 August 2014, 21:17:24
Finally it works. Thanks Dani for your patience and help. Regarding the attribute "active" you just need to define value 1 because if the attribute "active" is  not defined the default value is 0  - this means that the user has no access.  If you want to give the user access just define the attribute "active" value 1 - "attr user1 active 1".

Andrej
Titel: Antw:RFID Module
Beitrag von: andrejs am 27 August 2014, 21:30:35
Dani,

another thing - the attributes for rfid module should be defined as global in fhem cfg file

attr global userattr active, restricted

Andrej
Titel: Antw:RFID Module
Beitrag von: eppi am 28 August 2014, 08:29:26
Hi Andrej
Wooow, verry nice - works!

Good to know that are active and restricted User-Attributs! Its possible to rename it to rfid_active and rfid_restricted?

another question:
for which the attribute fname is required? Is that a user attribute?

Thank you Andrej again!
Greets Dani
Titel: Antw:RFID Module
Beitrag von: andrejs am 28 August 2014, 19:41:02
Hi Dani,
I changed the attributes to rfid_active and rfid_restricted. I also removed the attribute fname - this is the full name of the user but I do not use it any more.
Titel: Antw:RFID Module
Beitrag von: eppi am 28 August 2014, 19:51:42
thank you verry much Andrej!!!
if my RFID solution is completed with front- and garage door, I will post my solution here.
nice evening -Dani
Titel: Antw:RFID Module
Beitrag von: eppi am 31 August 2014, 17:44:48
Hi Andrej
your RFID works fine! ;D but i have a question.
I would like to use the RFID modules with ser2net so that I can run on a remote Debian system the USB-TTL with the reader. Is it possible that I like the Jeelink Modules USB-TTL by:
define Garagentor RFID system 192.168.2.102:9501 RDM630
can integrate?

On RemoteSystem i have following define in ser2net.conf:
9501:telnet:600:/dev/serial/by-id/usb-Silicon_Labs_CP2102_USB_to_UART_Bridge_Controller_0001-if00-port0:9600

Thank you!
Greets Dani
Titel: Antw:RFID Module
Beitrag von: andrejs am 01 September 2014, 12:13:49
Dani,
this is new for me but I can install on my ubuntu server package ser2net and see how it works. I still do not understand your request to use Jeelink Module. Could you please draw a scheme with connections between RDM360, Jeelink USB, FHEM Server, remote Debian system.... in order to understand correctly?

Andrej
Titel: Antw:RFID Module
Beitrag von: eppi am 01 September 2014, 18:28:40
Hi Andrej
I made a drawing from my installation.

On the FHEM server 192.168.2.12 I have the RFID module installed configured as follows:
define Garagentor RFID system 192.168.2.102:9501 RDM630

The remote Debian system (192.168.2.102) I have the USB-TTL connected with the RDM630 and ser2net configured as follows (/etc/ser2net.conf):
9501:telnet:600:/dev/serial/by-id/usb-Silicon_Labs_CP2102_USB_to_UART_Bridge_Controller_0001-if00-port0:9600

The RFID module says after a restart of FHEM always "disconnected".

The example with the JeeLink I have just mentioned, because it worked perfectly with ser2net.
Have you tried your EM4100 to connect with ser2net? If so, how did you configure it?

Thanks and regards Dani
Titel: Antw:RFID Module
Beitrag von: andrejs am 01 September 2014, 19:42:17
Dani, nice picture  :) . Now it is clear to me what is your request. RFID module is not prepared to access to RFID module using telnet and access to serial port through network. If you look at 99_RFID.pm module you will noticed that SerialPort perl module (Linux/POSIX emulation of Win32::SerialPort functions) is used.  The solution is to use perl Net::Telnet module in  99_RFID.pm.
Do you know perhaps if any other FHEM module already use Net::Telnet module ore maybe some other perl module for telnet because I really do not want to start from the scratch but to use created example.

Andrej 
Titel: Antw:RFID Module
Beitrag von: rudolfkoenig am 01 September 2014, 20:39:50
@Andrej: take a look at DevIo, they are used by a lot of modules.
Titel: Antw:RFID Module
Beitrag von: andrejs am 02 September 2014, 07:27:42
@Rudolf: Thanks for the useful proposal.
@Dani: I will use Devio.pm module to modify 99_RFID.pm to cover connection to RFID device directly through serial port or over the network but I will start to work on this at the end of this week.

Andrej
Titel: Antw:RFID Module
Beitrag von: eppi am 02 September 2014, 07:36:46
Cool  :)
thank you -regards Dani
Titel: Antw:RFID Module
Beitrag von: andrejs am 03 September 2014, 00:41:35
Dani,
it was really easy to correct the script (of course I was not able to test it). Please set in cfg file "attr global verbose 5" and in the case of any strange results or errors send fhem log file.
In order to define the RFID unit please use the following:

define Garagentor RFID system 192.168.2.102:9501 RDM630

OR

define Garagentor RFID system /dev/ttyUSB3@9600 RDM630


Andrej
Titel: Antw:RFID Module
Beitrag von: eppi am 03 September 2014, 07:31:43
thank you Andrej!
Aftler reload the Modul i receive the follow error:
Not enough arguments for main::DevIo_SimpleWrite at ./FHEM/99_RFID.pm line 189, near "$init)"
BEGIN not safe after errors--compilation aborted at ./FHEM/99_RFID.pm line 225.


attached find you my LogFile with verbose 5.

regards Dani
Titel: Antw:RFID Module
Beitrag von: andrejs am 03 September 2014, 22:52:19
Oops! The script is corrected and tested but just for serial connection.

Andrej
Titel: Antw:RFID Module
Beitrag von: eppi am 04 September 2014, 17:45:13
Hi Andrej
Modul downloaded, replaced, reloaded - works fine!! :D
Thank you! regards Dani
Titel: Antw:RFID Module
Beitrag von: eppi am 06 September 2014, 16:01:06
Hi Andrej
Sorry, I only now noticed:
With the latest version which I use by ser2net, I get no readings.
Do you have any idea?

list RFID_Reader_Haustuere
Internals:
   CFGFN      /opt/fhem/FHEM/fhem_rfid.cfg
   COUNTER    0
   DEF        system 192.168.2.102:9501 RDM630 unknown unknown
   DOORSTATE  unknown
   DeviceName 192.168.2.102:9501
   FD         125
   KEYLOCK    unknown
   MODEL      RDM630
   NAME       RFID_Reader_Haustuere
   NR         555
   PARTIAL
   STATE
   SUBTYPE    system
   TYPE       RFID
   Readings:
     Rfid_user_dani:
       TIME       2014-09-06 15:51:35
       VAL
Attributes:
   rfid_active 1
   room       RFID
   verbose    0


list RFID_User_Dani
Internals:
   CARDNR     0006994919
   CFGFN      /opt/fhem/FHEM/fhem_rfid.cfg
   DEF        user 0006994919
   NAME       RFID_User_Dani
   NR         559
   STATE
   SUBTYPE    user
   TYPE       RFID
   Readings:
     Rfid_user_dani:
       TIME       2014-09-06 15:51:35
       VAL
Attributes:
   rfid_active 1
   rfid_restricted 0
   room       RFID
   verbose    0
Titel: Antw:RFID Module
Beitrag von: andrejs am 06 September 2014, 21:29:46
Dani,

please attach log file (set in cfg file attr global verbose 5) because I am not able to test ser2net.

Andrej
Titel: Antw:RFID Module
Beitrag von: eppi am 07 September 2014, 07:44:09
Hi Andrej
attached my LogFile with remote RDM630.
I have tested the latest version with local RDM630 but FHEM is shutdown after first RFID read.

regards Dani

Titel: Antw:RFID Module
Beitrag von: andrejs am 07 September 2014, 09:29:47
Hi Dani,
my answers and additional questions can be found below:

ZitatWith the latest version which I use by ser2net, I get no readings.
Have you defined the user for the card nr. 38659797191 and for which RFID reader (for both of them or just for RFID_Reader_Haustuere)? Is card nr. 38659797191 correct?

ZitatI have tested the latest version with local RDM630 but FHEM is shutdown after first RFID read.
I propose to delete in 99_RFID.pm in "sub RFID_DoInit($)" the following line of code DevIo_SimpleWrite($hash, $init,"");. After that try again.

Andrej
Titel: Antw:RFID Module
Beitrag von: eppi am 07 September 2014, 10:33:28
Hi Andrej
Zitat von: andrejs am 07 September 2014, 09:29:47
Have you defined the user for the card nr. 38659797191 and for which RFID reader (for both of them or just for RFID_Reader_Haustuere)? Is card nr. 38659797191 correct?
Yes, see attached my rfid.cfg
Zitat von: andrejs am 07 September 2014, 09:29:47
I propose to delete in 99_RFID.pm in "sub RFID_DoInit($)" the following line of code DevIo_SimpleWrite($hash, $init,"");. After that try again.
No event. See LogFile local_rdm630_fhem092014.log
Titel: Antw:RFID Module
Beitrag von: andrejs am 07 September 2014, 13:32:03
Dani,

I added in 99_RFID.pm new Log lines and new script is attached to this message. Please test again and send the log file.
Maybe just one remark (I think this is not the reason for your problems). When you define the RFID reader if there is no keylock (gives you the state of of keylock - locked or unlocked) or doorstate (gives you the state of the door - closed or open) switch just leave empty without writing unknown- define RFID_Reader_Haustuere RFID system 192.168.2.102:9501 RDM630.
 
For the second issue with locally defined rfid reader I am in "dark" because am not sure if the Fhem script works if 2 RFID readers are installed. Please confirm do you have 2 RFID readers installed: first is installed on machine 192.168.2.102 and Fhem server approach to it through network and sertonet module  (in cfg which you sent tho RFID module is defined); second is installed on FHEM server machine and Fhem Server approach to it locally through Serialport. Have you test it to have both RFID readers connected or separately? I have not seen in the cfg file the define statement for local RFID reader?

Andrej
Titel: Antw:RFID Module
Beitrag von: eppi am 07 September 2014, 16:48:45
Andrej
i have change my define to:
define RFID_Reader_Haustuere RFID system 192.168.2.102:9501 RDM630

Now, i have readings from the user & reader on every rfid-read with "no_keylock".
I change now my notify with regex to readings "no_keylock" and give you feedback after a longtime check (24-48h).

Zitat von: andrejs am 07 September 2014, 13:32:03
For the second issue with locally defined rfid reader I am in "dark" because am not sure if the Fhem script works if 2 RFID readers are installed.
One time i have only one reader for my garage. in future i need  a second one for my Door. this rdm 630 reader should also be connected via ser2net.

Thank you! regards Dani
Titel: Antw:RFID Module
Beitrag von: andrejs am 07 September 2014, 18:51:44
Great to hear that!
Dani, I propose to change "no_keylock" to "lock/unlock" in order to be more logical (I attached the corrected script).
Regarding the notify there is no need to create notify for each user because every event (variable $hash->STATE) is written for each user and also for RFID reader. For example in your case the STATE variable is changed for the RFID_User_Dani and also for the RFID_Reader_Haustuere. I propose to define the notify as following:

define n_rfid_Haustuere NOTIFY RFID_Reader_Haustuere {if ( Value ("RFID_Reader_Haustuere") eq "lock/unlock") {fhem("set GaragenTor auf_zu")}}

In the case you will use two RFID readers tell me how it works.

Andrej
Titel: Antw:RFID Module
Beitrag von: eppi am 08 September 2014, 18:59:42
Wow nice!
I tested with the new module and notify: works! :), but i give you finaly feedback after a longtime check (24h).
On the Putty console I noticed that the following output after the FHEM-Start:
Integer overflow in hexadecimal number at ./FHEM/99_RFID.pm line 237.
Hexadecimal number > 0xffffffff non-portable at ./FHEM/99_RFID.pm line 237.
Use of uninitialized value $endcount in string eq at ./FHEM/99_RFID.pm line 296.
Use of uninitialized value $endcount in numeric ge (>=) at ./FHEM/99_RFID.pm line 396.


The Module Version of yesterday, I found the following errors in my log (every 10 minutes):
2014.09.08 18:20:48 1: 192.168.2.102:9501 reappeared (RFID_Reader_Haustuere)
2014.09.08 18:20:48 1: 192.168.2.102:9501 disconnected, waiting to reappear (RFID_Reader_Haustuere)
2014.09.08 18:10:47 1: 192.168.2.102:9501 reappeared (RFID_Reader_Haustuere)
2014.09.08 18:10:47 1: 192.168.2.102:9501 disconnected, waiting to reappear (RFID_Reader_Haustuere)
2014.09.08 18:00:45 1: 192.168.2.102:9501 reappeared (RFID_Reader_Haustuere)
2014.09.08 18:00:45 1: 192.168.2.102:9501 disconnected, waiting to reappear (RFID_Reader_Haustuere)
2014.09.08 17:50:44 1: 192.168.2.102:9501 reappeared (RFID_Reader_Haustuere)
2014.09.08 17:50:44 1: 192.168.2.102:9501 disconnected, waiting to reappear (RFID_Reader_Haustuere)
2014.09.08 17:40:42 1: 192.168.2.102:9501 reappeared (RFID_Reader_Haustuere)
2014.09.08 17:40:42 1: 192.168.2.102:9501 disconnected, waiting to reappear (RFID_Reader_Haustuere)
2014.09.08 17:30:40 1: 192.168.2.102:9501 reappeared (RFID_Reader_Haustuere)
2014.09.08 17:30:40 1: 192.168.2.102:9501 disconnected, waiting to reappear (RFID_Reader_Haustuere)
2014.09.08 17:20:39 1: 192.168.2.102:9501 reappeared (RFID_Reader_Haustuere)
2014.09.08 17:20:39 1: 192.168.2.102:9501 disconnected, waiting to reappear (RFID_Reader_Haustuere)
2014.09.08 17:10:37 1: 192.168.2.102:9501 reappeared (RFID_Reader_Haustuere)
2014.09.08 17:10:37 1: 192.168.2.102:9501 disconnected, waiting to reappear (RFID_Reader_Haustuere)
2014.09.08 17:00:35 1: 192.168.2.102:9501 reappeared (RFID_Reader_Haustuere)
2014.09.08 17:00:35 1: 192.168.2.102:9501 disconnected, waiting to reappear (RFID_Reader_Haustuere)
2014.09.08 16:50:34 1: 192.168.2.102:9501 reappeared (RFID_Reader_Haustuere)
2014.09.08 16:50:34 1: 192.168.2.102:9501 disconnected, waiting to reappear (RFID_Reader_Haustuere)
2014.09.08 16:40:32 1: 192.168.2.102:9501 reappeared (RFID_Reader_Haustuere)
2014.09.08 16:40:32 1: 192.168.2.102:9501 disconnected, waiting to reappear (RFID_Reader_Haustuere)
2014.09.08 16:30:31 1: 192.168.2.102:9501 reappeared (RFID_Reader_Haustuere)
2014.09.08 16:30:31 1: 192.168.2.102:9501 disconnected, waiting to reappear (RFID_Reader_Haustuere)


Thank you Andrej for your support!
regards Dani
Titel: Antw:RFID Module
Beitrag von: andrejs am 09 September 2014, 08:18:03
Dani,

for the second issue could you please attach the Devio.pm which is installed in FHEM directory? When the message of "disconnected, waiting ..." appeared - immediately after you start Fhem server?

Andrej
Titel: Antw:RFID Module
Beitrag von: eppi am 09 September 2014, 21:20:58
Hi Andrej
attached my DevIo.pm from /FHEM directory.

After FHEM restart I get no messages "disconnected, waiting ..." appeared, the same after first RFID-Card read.
I will check it tomorrow morning again and give you feedback.

regards, Dani
Titel: Antw:RFID Module
Beitrag von: eppi am 10 September 2014, 05:58:42
Andrej
today morning, my Log ist full with:
2014.09.10 05:42:51 1: 192.168.2.102:9501 reappeared (RFID_Reader_Haustuere)
2014.09.10 05:42:51 1: 192.168.2.102:9501 disconnected, waiting to reappear (RFID_Reader_Haustuere)
2014.09.10 05:32:50 1: 192.168.2.102:9501 reappeared (RFID_Reader_Haustuere)
2014.09.10 05:32:50 1: 192.168.2.102:9501 disconnected, waiting to reappear (RFID_Reader_Haustuere)
2014.09.10 05:22:48 1: 192.168.2.102:9501 reappeared (RFID_Reader_Haustuere)
2014.09.10 05:22:48 1: 192.168.2.102:9501 disconnected, waiting to reappear (RFID_Reader_Haustuere)
2014.09.10 05:12:46 1: 192.168.2.102:9501 reappeared (RFID_Reader_Haustuere)
2014.09.10 05:12:46 1: 192.168.2.102:9501 disconnected, waiting to reappear (RFID_Reader_Haustuere)
2014.09.10 05:02:45 1: 192.168.2.102:9501 reappeared (RFID_Reader_Haustuere)
2014.09.10 05:02:45 1: 192.168.2.102:9501 disconnected, waiting to reappear (RFID_Reader_Haustuere)
2014.09.10 04:52:43 1: 192.168.2.102:9501 reappeared (RFID_Reader_Haustuere)
2014.09.10 04:52:43 1: 192.168.2.102:9501 disconnected, waiting to reappear (RFID_Reader_Haustuere)
2014.09.10 04:42:42 1: 192.168.2.102:9501 reappeared (RFID_Reader_Haustuere)
2014.09.10 04:42:42 1: 192.168.2.102:9501 disconnected, waiting to reappear (RFID_Reader_Haustuere)
2014.09.10 04:32:40 1: 192.168.2.102:9501 reappeared (RFID_Reader_Haustuere)
2014.09.10 04:32:40 1: 192.168.2.102:9501 disconnected, waiting to reappear (RFID_Reader_Haustuere)
2014.09.10 04:22:38 1: 192.168.2.102:9501 reappeared (RFID_Reader_Haustuere)
2014.09.10 04:22:38 1: 192.168.2.102:9501 disconnected, waiting to reappear (RFID_Reader_Haustuere)
2014.09.10 04:12:37 1: 192.168.2.102:9501 reappeared (RFID_Reader_Haustuere)
2014.09.10 04:12:37 1: 192.168.2.102:9501 disconnected, waiting to reappear (RFID_Reader_Haustuere)
2014.09.10 04:02:35 1: 192.168.2.102:9501 reappeared (RFID_Reader_Haustuere)
2014.09.10 04:02:35 1: 192.168.2.102:9501 disconnected, waiting to reappear (RFID_Reader_Haustuere)
2014.09.10 03:52:34 1: 192.168.2.102:9501 reappeared (RFID_Reader_Haustuere)
2014.09.10 03:52:34 1: 192.168.2.102:9501 disconnected, waiting to reappear (RFID_Reader_Haustuere)
2014.09.10 03:42:32 1: 192.168.2.102:9501 reappeared (RFID_Reader_Haustuere)


Yesterday,i restart my fhem, without "disconnected, waiting to reappear" Messages, but after the first RFID read start this Log Message.

regards Dani
Titel: Antw:RFID Module
Beitrag von: andrejs am 11 September 2014, 03:25:47
Dani,
bad news the script does not work on reload of module because the data in array for card number for each user (when the number is collected from RFID reader the search is made in the array) is deleted on reload. I will need to find other solution. Of course it works if you restart or shutdown Fhem.
The problem of reappering is because nothing was sent form RFID reader. Was connection to RFID_Reader_Haustuere successful - the STATE has value opened? As I remember you have already succeeded to read the card number which script 99_RFID.pm did you use at that time:  from 7.9.2014 at 13:32 or the last one from 7.9.2014 18:51?   
I  am sorry for that because I not able to setup the same environment  to test the solution with RFID reader connected over network. I really do not have any issues connected locally except with reload but I always restart the FHEM server. I have intention to setup such environment in the near future (in one month) and after that I will be able to solve the issues except for reload (this can be solved in few days).

Andrej   
 
Titel: Antw:RFID Module
Beitrag von: andrejs am 12 September 2014, 22:14:07
Dani,

I rearranged the script and it also now corrected in order to work on reloading.
The problem of reappearing it could be still present (as I said I need to set the environment to test the version with RFID reader on network) but you can try and you will see very quickly the result.

Andrej 
Titel: Antw:RFID Module
Beitrag von: eppi am 13 September 2014, 10:07:28
Hi Andrej
Thank you!
I tested with the same config, but after fhem restart goes the the rfid-reader to "disconnected" Mode.
Attached my fhem.log with verbose 5.

regrads Dani
Titel: Antw:RFID Module
Beitrag von: andrejs am 13 September 2014, 11:24:29
Dani thanks for another try. Unfortunately it was not successful. I have already ordered the hardware  to test the version with RFID reader on the network (it will take 2-3 weeks to get it form China) and I will let you how it works. In the meantime if you will find where is the problem please let me know.


Andrej     


Titel: Antw:RFID Module
Beitrag von: eppi am 13 September 2014, 12:12:29
Ok Andrej
I'll wait, you're the RDM630 have. No problem!
Thanks and regards Dani
Titel: Antw:RFID Module
Beitrag von: andrejs am 04 Oktober 2014, 22:05:53
Dani,
finally I set up Raspberry PI (model B) and connect EM4100 using UART TTL 6PIN Connector Module. I also installed ser2net following the instruction here: http://networklessons.com/network-management/raspberry-pi-as-cisco-console-server/. In ser2net.conf I added two lines:
BANNER:banner:NETWORKLESSONS.COM Terminal Server TCP port p device d rn
4001:telnet:0:/dev/ttyUSB0:9600 8DATABITS NONE 1STOPBIT banner

After i started "ser2net" using ser2net -n I also tested the connection with telnet from other computer where Fhem server is running. The test was successful (check if the port is not blocked by firewall!). 
The next step was to test RFID module if card reader is connected on RPI. I defined first the "system" define door_acess RFID system 192.168.1.123:4001 EM4100 and the users. The test was OK and I got the status "opened". I swiped the card over the reader and everything was OK.
So the RFID should also work if the card reader is attached on other linux computer using ser2net package. I used EM4100 but it should work also with RDM630. Please test the attached FHEM module (use attr global verbose 5) and in the case of any errors send me the log file.

Andrej 
Titel: Antw:RFID Module
Beitrag von: eppi am 05 Oktober 2014, 09:38:08
Hello Andrej
Wow, very cool !!
I have defined it according to your instructions and works perfectly! I'll watch it a few more hours ....

I have a question:
If i have 2 RFID reader has now, one for the front door and one for the garage door, is this supported from the modul? If so, how is the define? Is it possible to authorize different users to different reader?

Many thanks!

regrads Dani
Titel: Antw:RFID Module
Beitrag von: andrejs am 05 Oktober 2014, 12:46:09
Great to hear that  :D. The module works with 2 or more RFID readers but the users and all attributes (active, restricted) are the same for all defined readers. I will take a look in the script and try to find the solution in order to define and set the user/authorization for all reader or just for specific one.

Andrej
Titel: Antw:RFID Module
Beitrag von: andrejs am 09 Oktober 2014, 21:57:58
Dani,
I changed the 99_RFID module in order to define authorization of user for a different rfid readers. The syntax to define the user is changed because additional "authorization" parameter (it is mandatory) should defined:
Define <name> RFID  user  <card number> <authorisation>
Parameter <authorisation> specifies for which RFID reader or readers is user authorised. Possible values:
ALL - user has access/authorisation to all RFID readers
NONE - user has no access/authorisation to RFID readers
PART(reader1,reader2,...)  - user has access/authorisation to RFID readers defined in brackets seperated by comma

Example: define user1 RFID user 0005354301 PART(door_acess,door_acess1)
In this particular case the user1 has authorization for 2 rfid readers (defined with subtype system)
Example1: define user1 RFID user 0005354301 ALL
User1 has authorization for all rfid readers defined by subtype system.
Example3: define user1 RFID user 0005354301 NONE
User1 has no authorization.

if the user does not have authorization for rfid reader the value of Reading will be "no_auth".
The attributes rfid_restricted, rfid_active can defined only for the user and not for particular rfid reader.
I tested the changes with 2 rfid readers and everything was OK.

Andrej






 
Titel: Antw:RFID Module
Beitrag von: eppi am 10 Oktober 2014, 06:01:25
Hello Andrej
Thanks for the adjustments. I have not received my second RFID reader. But I will give it to me over the weekend to the existing testing and feedback.
Thanks a lot, regards Dani
Titel: Antw:RFID Module
Beitrag von: eppi am 11 Oktober 2014, 09:46:23
Hi Andrej
I tested with authorization ALL, that works- thank you! The other authorization i will test as soon as my second RFID Reader has arrived.

What I noticed is that with each RFID following message in the log is:
2014.10.11 09:21:09 1: PERL WARNING: Hexadecimal number > 0xffffffff non-portable at ./FHEM/99_RFID.pm line 240.
2014.10.11 09:21:09 1: PERL WARNING: Hexadecimal number > 0xffffffff non-portable at ./FHEM/99_RFID.pm line 240.
2014.10.11 09:21:08 1: PERL WARNING: Hexadecimal number > 0xffffffff non-portable at ./FHEM/99_RFID.pm line 240.
2014.10.11 09:21:08 1: PERL WARNING: Hexadecimal number > 0xffffffff non-portable at ./FHEM/99_RFID.pm line 240.
2014.10.11 09:21:08 1: PERL WARNING: Hexadecimal number > 0xffffffff non-portable at ./FHEM/99_RFID.pm line 240.


And when i start FHEM (shutdown restart) is following in the log:
2014.10.11 09:15:44 1: PERL WARNING: Argument "" isn't numeric in numeric ge (>=) at ./FHEM/99_RFID.pm line 344.
2014.10.11 09:15:44 1: PERL WARNING: Argument "" isn't numeric in numeric ge (>=) at ./FHEM/99_RFID.pm line 344.
2014.10.11 09:15:44 1: PERL WARNING: Argument "" isn't numeric in numeric ge (>=) at ./FHEM/99_RFID.pm line 344.
2014.10.11 09:15:44 1: PERL WARNING: Argument "" isn't numeric in numeric ge (>=) at ./FHEM/99_RFID.pm line 344.
2014.10.11 09:15:44 1: PERL WARNING: Argument "" isn't numeric in numeric ge (>=) at ./FHEM/99_RFID.pm line 344.
2014.10.11 09:15:44 1: PERL WARNING: Argument "" isn't numeric in numeric ge (>=) at ./FHEM/99_RFID.pm line 344.
2014.10.11 09:15:44 1: PERL WARNING: Argument "" isn't numeric in numeric ge (>=) at ./FHEM/99_RFID.pm line 344.
2014.10.11 09:15:44 1: PERL WARNING: Argument "" isn't numeric in numeric ge (>=) at ./FHEM/99_RFID.pm line 344.


I use the current version of FHEM:
# $Id: fhem.pl 6730 2014-10-09 19:21:23Z rudolfkoenig $ 
# $Id: 99_RFID.pm 1098 2014-10-09 21:40:08Z andrejs $


Thank you for your feedback.
regards Dani
Titel: Antw:RFID Module
Beitrag von: andrejs am 13 Oktober 2014, 23:50:52
Dani,
thanks for the testing and error messages.
I removed the second error after you "shutdown restart" FHEM but I am not sure if PERL WARNING with hexadecimal number is still present. Please test again and in the case of the warnings or errors send me the log file (use verbose 5).

Andrej 
Titel: Antw:RFID Module
Beitrag von: eppi am 14 Oktober 2014, 21:05:02
hi Andrej
the error message after reboot are solved in this version - thank you!
On every RFID-read i receive the following error mesage in my log (see attached file).

regards Dani
Titel: Antw:RFID Module
Beitrag von: andrejs am 14 Oktober 2014, 22:17:41
Dani,

could you tell me the RFID card number?

Thanks

Andrej
Titel: Antw:RFID Module
Beitrag von: eppi am 14 Oktober 2014, 22:50:42
Yes, i send you a pm...
Titel: Antw:RFID Module
Beitrag von: andrejs am 15 Oktober 2014, 22:03:19
Dani,

I think I solved the problem with PERL WARNING and I attached the amended script to this message.

Andrej
Titel: Antw:RFID Module
Beitrag von: eppi am 16 Oktober 2014, 06:54:40
Hello Andejs
This Module Version crash immediately after the first RFID read. Logfile with verbose 5 is emty....
regards Dani
Titel: Antw:RFID Module
Beitrag von: andrejs am 16 Oktober 2014, 22:46:32
Dani,

I solved the problem with "PERL WARNING: Argument "" isn't numeric in numeric ge (>=) at ./FHEM/99_RFID.pm" using function Math::Bigint. I hope now everything will work without any strange warnings in log file.

Andrej
Titel: Antw:RFID Module
Beitrag von: eppi am 22 Oktober 2014, 19:08:35
Hi Andrejs
Sorry for the delay. Everything is stable and both RFID reader working without problems.
Many thanks for the nice module and the hard work!

regards Dani
Titel: Antw:RFID Module
Beitrag von: andrejs am 25 Oktober 2014, 14:40:08
It was my pleasure working with you Dani and thank you agin for the testing and patience.
My next project will be to add some of NFC readers and I hope I will be successful.

Andrej
Titel: Antw:RFID Module
Beitrag von: breezybadger am 07 Februar 2015, 12:26:31
Hey,

this model looks awesome. I ordered a Reader from Ebay, it looks the same from the outside, but its a different one. I was trying to wire it, but as it seems Iam to stupid to find the right Ports. I have a picture of it, could someone please provide me the right ports ( D0, D1, VCC and GND) to wire it.

Thanks a lot

Regards Breezy
Titel: Antw:RFID Module
Beitrag von: andrejs am 12 Februar 2015, 20:15:21
hi,
at the photo below you can see the PCB of USB RFID Reader 125 kHz (back side) and the connections:
green white wire - GND
green wire - +5V
orange white wire - RX

I hope I helped you.

Andrej
Titel: Antw:RFID Module
Beitrag von: breezybadger am 27 April 2015, 21:16:16
Hello,

now some new HW (http://www.ebay.de/itm/331221365816?_trksid=p2060353.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT (http://www.ebay.de/itm/331221365816?_trksid=p2060353.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT)) arrived directly from my glory china. I try to connect it directly to the GIOP on my Raspi, i Connect it to PIN 10 and I am able to read the TAG No with a python script - but in  FHEM the sate is still disconnect, any Idea what Iam doing wrong ?

The Fhem.cfg entry is : define RFIDIO RFID system /dev/ttyAMA0 RDM630 keylock


#!/usr/bin/python
# coding=utf-8

import serial

def read_rfid():
    ser = serial.Serial("/dev/ttyAMA0")
    ser.baudrate = 9600
    daten = ser.read(14)
    ser.close()
    daten = daten.replace("\x02", "" )
    daten = daten.replace("\x03", "" )
    return daten

id = read_rfid()
print id


And still: awesome work! Thanks for it
Titel: Antw:RFID Module
Beitrag von: andrejs am 28 April 2015, 11:25:46
Hi Breezy,
the RFID module works if you use RFID reader with USB 2.0 to UART TTL 6PIN Connector Module. I have never tested or tried to connect  RFID reader to GIOP of Rpi. Please tell what does it mean 14 in your pyton code daten = ser.read(14)?
Can you tell have you manged to solve the problem of RFID module connection posted in this forum at 07 Februar 2015?

Andrej
Titel: Antw:RFID Module
Beitrag von: breezybadger am 28 April 2015, 16:12:19
Hello,

thank you for you help. I was assuming it works the same way as over USB because the Raspi has a UART Converter integrated in the Ports. To be honest I just copied the script from http://www.elektronx.de/tutorials/rfid-tags-auslesen/ (http://www.elektronx.de/tutorials/rfid-tags-auslesen/) to test if I wired everything correctly. I would assume it works the same way only by changing the input port.

My Old Hardware doesn't work, thats why I ordered the new one. My Problem is I don't have a Port available for USB thats why I wanted to connect it via RX over GIOP

Thanks again for your awesome work and help!
Titel: Antw:RFID Module
Beitrag von: andrejs am 28 April 2015, 20:21:51
Breezy,
please download the attached 99_RFID.pm file in my post at 16.10.2014 and define RFID module as following:
define RFIDIO RFID system /dev/ttyAMA0@9600 RDM630

If this is not the solution I am not sure where is the issue. Maybe the problem is in diference between pyton script and RFID module where the numer of bytes which are read is not the same. In pyton script 14 bytes of data is read, the RFID module reads 1 byte of data at once. This can be changed in RFID module but the rest of the script will not work as it should be. Anyway you can change the following code in sub RFID_DoSimpleRead:
from
$buf = $hash->{USBDev}->read(1); 
to
$buf = $hash->{USBDev}->read(14);

Please let me now how it goes.

Andrej
Titel: Antw:RFID Module
Beitrag von: breezybadger am 29 April 2015, 21:50:32
Hello Andrej,

thanks again for you help. I tried to change what you wrote before. The status is still "disconnected" in the Everthing overview. Is there a line that maybe limit the input to USB Devices only? When I set a soft link in the /mnt area to a USB Device from ttyAMA0 could this may help?

BTW my Logfile is full of "2: ready" entries

The Problem I have seems not the readability from the tags, its more to get your Modul running.

Thanks for you help!

Greetings Daniel
Titel: Antw:RFID Module
Beitrag von: andrejs am 29 April 2015, 23:41:33
Daniel,
I am sorry my directions are not sucesful but in order to help you I will need to connect my RFID reader (it is not your model but it will sufficent) directly to GIOP of Rpi and make some testing. Right now I am not at home but I will be at end of this week.

Andrej
Titel: Antw:RFID Module
Beitrag von: andrejs am 02 Mai 2015, 14:41:53
Daniel,
I connected my RFID reader (+5,GND,txd) to Rpi using GPIO and I succeeded to get opened status. In order to get TXD (GPIO14) pin of Rpi available for general UART use I followed this instructions https://sites.google.com/site/semilleroadt/raspberry-pi-tutorials/gpio (see section UART).  To define rfid reader in FHEM use "define RFIDIO RFID system /dev/ttyAMA0@9600 RDM630". I replaced 99_RFID.pm file with new one in my post at 16.10.2014 because I made some corrections which are not linked to GPIO issue.   

Andrej
Titel: Antw:RFID Module
Beitrag von: breezybadger am 10 Mai 2015, 16:03:07
Hi,
thanks so much for you work, I shows the state open! AWESOME work, but now the tags don't show any reaction. I added a user with the right ID.
Any Ideas how to fix this ?

BTW this is my user configuration :
ZitatAUTH
ALL
CARDNR
0009953857
DEF   
user 0009953857 ALL
NAME
daniel
NR
44
STATE
unknown 498226160193
SUBTYPE
user
TYPE
RFID
Thank you!
Titel: Antw:RFID Module
Beitrag von: andrejs am 11 Mai 2015, 12:50:37
Daniel,
strange but it seems  the output format of data is different so I will need to amend the script and add another type of reader. I propose to make a test. Please use the attached 99_RFID.pm file in my post at 16.10.2014 and change in fhem.cfg verbose to 5 (this will enable to write the read raw data from rfid reader to log file). After that swip the card over the reader and send me fhem log file.

Andrej
Titel: Antw:RFID Module
Beitrag von: breezybadger am 11 Mai 2015, 18:44:19
Hey Andrejs,

thanks again, I really appreciate your help. I assume I did something wrong, I added verbos 5 as attr. to the RFID but nothing appeared in the LOG , only in the Eventmonitor "RFID RFIDIO 498226160193: unknown 498226160193"
My def. was :
define RFIDIO RFID system /dev/ttyAMA0@9600 RDM630
attr RFIDIO verbose 5

Any Idea what I did wrong?
Titel: Antw:RFID Module
Beitrag von: andrejs am 11 Mai 2015, 22:15:39
Daniel,

you need to find in fhem.cfg file this "attr global verbose 3" and change the number from 3 to 5.

Andrej   
Titel: Antw:RFID Module
Beitrag von: breezybadger am 12 Mai 2015, 17:16:01
Thanks man, I guess I found what you need to solve my issue:
2015.05.12 17:13:45 5: Triggering RFIDIO (1 changes)
2015.05.12 17:13:45 5: Notify loop for RFIDIO 498226160193: unknown 498226160193
2015.05.12 17:13:45 5: Triggering RFIDIO (1 changes)
2015.05.12 17:13:45 5: Notify loop for RFIDIO 498226160193: unknown 498226160193
2015.05.12 17:13:45 5: 2 + 0 +
2015.05.12 17:13:45 5: 55 + 1 + 7
2015.05.12 17:13:45 5: 52 + 2 + 74
2015.05.12 17:13:45 5: 48 + 3 + 740
2015.05.12 17:13:45 5: 48 + 4 + 7400
2015.05.12 17:13:45 5: 57 + 5 + 74009
2015.05.12 17:13:45 5: 55 + 6 + 740097
2015.05.12 17:13:45 5: 69 + 7 + 740097E
2015.05.12 17:13:45 5: 50 + 8 + 740097E2
2015.05.12 17:13:45 5: 52 + 9 + 740097E24
2015.05.12 17:13:45 5: 49 + 10 + 740097E241
2015.05.12 17:13:45 5: 52 + 11 + 740097E241
2015.05.12 17:13:45 5: 48 + 12 + 740097E241
2015.05.12 17:13:45 5: 3 + 13 + 740097E241
2015.05.12 17:13:45 5: fname: RFIDIO cnr_attr: 0009953857 cnr_reader: 498226160193 status: closed action: unknown 498226160193
2015.05.12 17:13:45 5: Triggering RFIDIO (1 changes)
2015.05.12 17:13:45 5: Notify loop for RFIDIO 498226160193: unknown 498226160193
2015.05.12 17:13:45 5: Triggering RFIDIO (1 changes)
2015.05.12 17:13:45 5: Notify loop for RFIDIO 498226160193: unknown 498226160193
2015.05.12 17:13:45 5: 2 + 0 +
2015.05.12 17:13:45 5: 55 + 1 + 7
2015.05.12 17:13:45 5: 52 + 2 + 74
2015.05.12 17:13:45 5: 48 + 3 + 740
2015.05.12 17:13:45 5: 48 + 4 + 7400
2015.05.12 17:13:45 5: 57 + 5 + 74009
2015.05.12 17:13:46 5: 55 + 6 + 740097
2015.05.12 17:13:46 5: 69 + 7 + 740097E
2015.05.12 17:13:46 5: 50 + 8 + 740097E2
2015.05.12 17:13:46 5: 52 + 9 + 740097E24
2015.05.12 17:13:46 5: 49 + 10 + 740097E241
2015.05.12 17:13:46 5: 52 + 11 + 740097E241
2015.05.12 17:13:46 5: 48 + 12 + 740097E241
2015.05.12 17:13:46 5: 3 + 13 + 740097E241
2015.05.12 17:13:46 5: fname: RFIDIO cnr_attr: 0009953857 cnr_reader: 498226160193 status: closed action: unknown 498226160193
2015.05.12 17:13:46 5: Triggering RFIDIO (1 changes)
2015.05.12 17:13:46 5: Notify loop for RFIDIO 498226160193: unknown 498226160193
2015.05.12 17:13:46 5: Triggering RFIDIO (1 changes)
2015.05.12 17:13:46 5: Notify loop for RFIDIO 498226160193: unknown 498226160193


Thanks a lot!
Titel: Antw:RFID Module
Beitrag von: andrejs am 13 Mai 2015, 00:43:01
Daniel,
the protocol to convert in decimal ID Tag is very strange. I found the solution here https://maniacbug.wordpress.com/2011/10/09/125khz-rfid-module-rdm630/. In attached file you will find the amended fhem module 99_RFID.pm where I added new model of reader RDM630A (use this!). I summarize all instructions of RFID module below.
You should define devices:
define RFIDIO RFID system /dev/ttyAMA0@9600 RDM630A
define daniel RFID user 0009953857 ALL
attr daniel rfid_active 1

I hope it will work!

Andrej

***************************************************************************************************************
Define
Define <name> RFID  <subtype> <devicename> <model> <card number> <authorisation> <keylock> <doorstate>

<subtype> can be "user" or "system"
<devicename> specifies the serial port@baudrate or IP address with port number to communicate with the RFID Reader. The name of the serial-device depends on your distribution, under linux the cdc_acm kernel module is responsible, and usually a /dev/ttyUSBX device will be created.
<card number> should be defined if subtype is "user". Card number is at least 10 digit number which is normally printed on RFID key or card.
<model> 3 models are possible to define:
EM4100 - http://www.ebay.com/itm/USB-RFID-Contactless-Proximity-Smart-Card-Reader-125Khz-EM4100-Windows-arduino-/111114333563 (for connection do not use USB port on the USB Reader but open the plastic box of the reader and connect wires on the pins on PCB. For the connection from pins on PCB to the USB of the computer use the USB 2.0 to UART TTL 6PIN Connector Module)
RDM630 - http://www.seeedstudio.com/depot/datasheet/RDM630-Spec..pdf
RDM630A - http://www.ebay.de/itm/331221365816?_trksid=p2060353.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT

<authorisation> should be defined if subtype is "user". Parameter specifies for which RFID reader or readers is user authorised. Possible values:
ALL - user has access/authorisation to all RFID readers
NONE - user has no access/authorisation to RFID readers
PART(reader1,reader2,...)  - user has access/authorisation to RFID readers defined in brackets seperated by comma
<keylock> should be defined if subtype is "system" but it is optional parameter. Keylock is the name of FHEM device which represents the switch and tells the system if the doors are locked or unlocked. For example you can use for the switch the ELV FS20 TFK or HomeMatic 3-Kanal-Funk-Schließerkontakt-Interface (for ELV FS20 use Eventmap to define in FHEM off as unlock and on as lock).
<doorstate> should be defined if subtype is "system" but it is optional parameter. Doorstate is the name of FHEM device which represents the switch and tells the system if the doors are opened or closed. For example you can use for the switch the ELV FS20 TFK or HomeMatic 3-Kanal-Funk-Schließerkontakt-Interface (for ELV FS20 use Eventmap to define in FHEM off as open and on as closed).
Example
define door_acess RFID system /dev/ttyUSB2@9600 EM4100 doorkey doorswitch
define door_acess RFID system 192.168.1.101:3000 RDM630 doorkey doorswitch
define user1 RFID user 0005354301 PART(door_acess)

Set
Nothting defined

Get
Nothing defined

Readings - for each user with time of last action
lock/unlock
no_auth
no_value
not_active
restricted
door_notclosed
not_correct
unknown cardnr

Attributes (define all attributes in fhem cfg file using "attr global userattr rfid_active")
rfid_active  (value 0 or 1)
if the value of attribute "rfid_active" is 0 then the user is not active and can not lock/unlock the door. If the attribute is not defined then the default value is 0.
rfid_restricted  (format:  <nameofday>-<beginning of restriction hh:mm:ss><end of restriction hh:mm:ss>-
If there is no restrictions for the user then the value of attribute should be 0.
Example of attribute "rfid_restricted"
Friday-00:00-07:00/Saturday-00:00-07:00
The user can not unlock/lock the door on Friday and Saturday from midnight to 7 o'clock in the morning
Titel: Antw:RFID Module
Beitrag von: breezybadger am 13 Mai 2015, 13:20:18
Hi, its a little bit to early for a I Love You. Thanks again for your support, but it still doesn't work.  Here Again the Logfile
2015.05.13 13:18:12 5: 2 + 0 +
2015.05.13 13:18:12 5: 55 + 1 +
2015.05.13 13:18:12 5: 52 + 2 +
2015.05.13 13:18:12 5: 48 + 3 + 48
2015.05.13 13:18:12 5: 48 + 4 + 4848
2015.05.13 13:18:12 5: 57 + 5 + 484857
2015.05.13 13:18:12 5: 55 + 6 + 48485755
2015.05.13 13:18:12 5: 69 + 7 + 4848575569
2015.05.13 13:18:12 5: 50 + 8 + 484857556950
2015.05.13 13:18:12 5: 52 + 9 + 48485755695052
2015.05.13 13:18:12 5: 49 + 10 + 4848575569505249
2015.05.13 13:18:12 5: 52 + 11 + 4848575569505249
2015.05.13 13:18:12 5: 48 + 12 + 4848575569505249
2015.05.13 13:18:12 5: 3 + 13 + 4848575569505249
2015.05.13 13:18:12 5: fname: RFIDIO cnr_attr:  cnr_reader: 5208508993404686921 status: closed action: unknown 5208508993404686921
Titel: Antw:RFID Module
Beitrag von: andrejs am 13 Mai 2015, 14:51:38
Sorry Daniel I missed something - it was late night. I corrected my mistake and now it should be OK.

Andrej
Titel: Antw:RFID Module
Beitrag von: breezybadger am 13 Mai 2015, 14:54:40
I have no Idea how you did this, but it works! Thanks so much for your support!
Titel: Antw:RFID Module
Beitrag von: andrejs am 13 Mai 2015, 15:19:55
Daniel it was pleasure to help you. It is funny that the reader wihich is declared as RDM630 has totally different protocol to convert raw data from RFID reader to ID Tag but at the end I need to amend the script. In your case I was lucky beacuse the example is available on the web. Have fun!

Andrej
Titel: Antw:RFID Module
Beitrag von: breezybadger am 13 Mai 2015, 15:57:56
Sorry to bother you again, It seems I don't get the concept of your work. The reading now works, every time I slide the Tag over the Reader it says in the Eventmonitor RFID RFIDIO 0009953857: lock/unlock

Fine so far, but I want to use my Tags to disarm my Alarmsystem. So I created a dummy "alarm_status". This dummy switched to "on" by hitting a remote button, how do I manage to set this dummy to "off" when slipping a Tag over the reader?

I was assuming your script changes the value of a variable from "lock" to "unlock" or "close" to "open" ...

excuse my stupid questions
Daniel
Titel: Antw:RFID Module
Beitrag von: andrejs am 13 Mai 2015, 17:59:23
Daniel, there is no stupid questions. Let me explain in short how the script works. In the case the parameter <keylock> is not defined for the device RFIDIO the reading state "lock/unlock" is defined because the system does not know what to do. if the keylock device (in may case it is the name of HM switch defined in FHEM which has "closed" and "open" state) is defined then the script will check the state of device keylock:
- if state of device keylock is "open" the result of the slide of the tag over the reader will be the change of the reading state of device in your case daniel and also RFDIO to "lock"
- if state of device keylock is "closed" the result of the slide of the tag over the reader will be the change of the reading state of device in your case daniel and also RFDIO to "unlock"
These states are hardcode in the script and this can be changed but I will need to amend the script and add some new attributes.

If you will need the rfid reader just to arm and disarm the alarm system and dummy alarm_status will be always correct (also when you will arm and disarm alarm system manually on the keyboard)  then you should just create DOIF:
define alarmoff DOIF ([RFIDIO] eq "lock/unlock" and  [alarm_status] eq "on") (set alarm_status off)
define alarmon DOIF ([RFIDIO] eq "lock/unlock" and  [alarm_status] eq "off") (set alarm_status on)
 
Andrej
Titel: Antw:RFID Module
Beitrag von: breezybadger am 13 Mai 2015, 18:45:02
And thanks again, for your explanation.

Its seems I understood the concept but still miss a point. I tried some different defintions:

define alarm_status dummy
#attr alarm_status eventMap on:lock off:unlock
define alarmoff DOIF ([RFIDIO] eq "lock/unlock" and  [alarm_status] eq "on") (set alarm_status off)
define alarmon DOIF ([RFIDIO] eq "lock/unlock" and  [alarm_status] eq "off") (set alarm_status on)
define RFIDIO RFID system /dev/ttyAMA0@9600 RDM630A
define daniel RFID user 0009953857 ALL
attr daniel rfid_active 1


Leads to a one time change, but after the first slide no changes are applied anymore.

My second attempt was:
define alarm_status dummy
attr alarm_status eventMap on:lock off:unlock
#define alarmoff DOIF ([RFIDIO] eq "lock/unlock" and  [alarm_status] eq "on") (set alarm_status off)
#define alarmon DOIF ([RFIDIO] eq "lock/unlock" and  [alarm_status] eq "off") (set alarm_status on)

define RFIDIO RFID system /dev/ttyAMA0@9600 RDM630A alarm_status
define daniel RFID user 0009953857 ALL
attr daniel rfid_active 1


This leads to the a "not_correct" messages in the Event Monitor.

My alarm System changes alarm_status to "on" , by slipping a valid tag it should get the status "off"

Thanks again.

Titel: Antw:RFID Module
Beitrag von: andrejs am 13 Mai 2015, 20:34:53
Daniel,

in the first definition you should add to DOIF the attribute if you want to have more then on time change
attr alarmoff do always
attr alarmon do always

The second definition the reading state "not_correct" derived from the fact that the reading state of "keylock" should be "open" or "closed". According to this just set value (open or closed) of dummy and there is no need to set attribute:   
define alarm_status dummy
set alarm_status open or set alarm_status closed
define RFIDIO RFID system /dev/ttyAMA0@9600 RDM630A alarm_status
define daniel RFID user 0009953857 ALL
attr daniel rfid_active 1

Andrej
Titel: Antw:RFID Module
Beitrag von: breezybadger am 14 Mai 2015, 13:44:25
I could not thank you more!!! Now I got a awesome alarm system which can only be disarmed by using your Script! Awesome work, you may work a little bit on it to make it more flexible ( make your open closed status definable ) and than you should check it in the trunk!

Thanks!
Titel: Antw:RFID Module
Beitrag von: andrejs am 15 Mai 2015, 13:40:43
Good news. I agree the script it is "hardcoded". I will amend the module and add attributes to make this more flexible. Thanks again for your time.

Andrej
Titel: Antw:RFID Module
Beitrag von: andrejs am 17 Mai 2015, 16:08:46
I managed to change the script in order to be more flexible:
- all 11 reading states can be changed using attribute eventMap in RFID system
- the default state of <keylock>/<doorstate> device can be changed using attribute rfid_skeylock/rfid_sdoorstate. Examples are in the instructions bellow.

How can I do (or find the instructions) this:
Zitatand than you should check it in the trunk!

Andrej
****************************************************************************************************************** 
Define
Define <name> RFID  <subtype> <devicename> <model> <card number> <authorisation> <keylock> <doorstate>

<subtype> can be "user" or "system"
<devicename> specifies the serial port@baudrate or IP address with port number to communicate with the RFID Reader. The name of the serial-device depends on your distribution, under linux the cdc_acm kernel module is responsible, and usually a /dev/ttyUSBX device will be created.
<card number> should be defined if subtype is "user". Card number is at least 10 digit number which is normally printed on RFID key or card.
<model> 3 models are possible to define:
EM4100 - http://www.ebay.com/itm/USB-RFID-Contactless-Proximity-Smart-Card-Reader-125Khz-EM4100-Windows-arduino-/111114333563 (for connection do not use USB port of the USB Reader but open the plastic box and find the connections for serial data stream. For details see: http://www.pcmx.de/?p=216. In order to connect reader to the computer of FHEM server I use the USB 2.0 to UART TTL 6PIN Connector Module.
RDM630 - http://www.seeedstudio.com/depot/datasheet/RDM630-Spec..pdf
RDM630A - http://www.ebay.de/itm/331221365816?_trksid=p2060353.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT

<authorisation> should be defined if subtype is "user". Parameter specifies for which RFID reader or readers is user authorised. Possible values:
ALL - user has access/authorisation to all RFID readers
NONE - user has no access/authorisation to RFID readers
PART(reader1,reader2,...)  - user has access/authorisation to RFID readers defined in brackets seperated by comma
<keylock> should be defined if subtype is "system" but it is optional parameter. Keylock is the name of FHEM device which represents the switch and tells the system if the doors are locked or unlocked. For example you can use for the switch the ELV FS20 TFK or HomeMatic 3-Kanal-Funk-Schließerkontakt-Interface (for ELV FS20 use Eventmap to define in FHEM off as unlock and on as lock).
<doorstate> should be defined if subtype is "system" but it is optional parameter. Doorstate is the name of FHEM device which represents the switch and tells the system if the doors are opened or closed. For example you can use for the switch the ELV FS20 TFK or HomeMatic 3-Kanal-Funk-Schließerkontakt-Interface (for ELV FS20 use Eventmap to define in FHEM off as open and on as closed).
Example
define door_acess RFID system /dev/ttyUSB2@9600 EM4100 doorkey doorswitch
define door_acess RFID system 192.168.1.101:3000 RDM630 doorkey doorswitch
define user1 RFID user 0005354301 PART(door_acess)

Set
Nothting defined

Get
Nothing defined

Readings - for each user with time of last action
lock/unlock
lock
unlock
no_auth
no_value
NAV_keylock
NAV_door
restricted
door_notclosed
not_correct
unknown cardnr

Names of all readings can be changed using attribute eventMap for RFID system:
attr  RFIDIO eventMap lock/unlock:open/close lock:close unlock:open

Attributes
rfid_active  (value 0 or 1)
if the value of attribute "rfid_active" is 0 then the user is not active and can not lock/unlock the door. If the attribute is not defined then the default value is 0.
rfid_restricted  (format:  <nameofday>-<beginning of restriction hh:mm:ss>-<end of restriction hh:mm:ss>
If there is no restrictions for the user then the value of attribute should be 0.
Example of attribute "rfid_restricted"
Friday-00:00-07:00/Saturday-00:00-07:00
The user can not unlock/lock the door on Friday and Saturday from midnight to 7 o'clock in the morning
rfid_skeylock
if the parameter <keylock> is defined (see instruction above) the default state of the "keylock" device should be "open" or "closed". If the "keylock" states are different this can be changed using attribute rfid_skeylock: attr RFIDIO rfid_skeylock  open:on closed:off 
rfid_sdoorstate
if the parameter <doorstate> is defined (see instruction above) the default state of the "doorstate" device should be "open" or "closed". If the "doorstate" states are different this can be changed using attribute rfid_sdoorstate: attr RFIDIO rfid_sdoorstate  open:on closed:off 
Titel: Antw:RFID Module
Beitrag von: breezybadger am 16 Mai 2016, 19:22:59
Dear Andrejs,


I kind of break my config , I hope you may help.

RFID daniel 0009953857: not_correct <- What does it mean? The Tag No is definitely the right no, the user is active and has restriction 0

Kind Regards
Daniel
Titel: Antw:RFID Module
Beitrag von: andrejs am 05 Juni 2016, 10:43:12
Daniel which version of RFID module are you using? Is this one "# $Id: 99_RFID.pm 1098 2015-06-11 23:30:08Z andrejs $" (see at the beggining of 99_RFID.pm script) ?
Titel: Antw:RFID Module
Beitrag von: heikoxxxx am 03 Juli 2019, 18:05:51
Hello Andre,

first of all, thanks for that great FHEM module. It works fine for me for some time. Using that module to get access for my home, Module is connected with ESPEASY Serial Server.

But some time ago i changed one key from 0000347048 to 0083515152 and after that i get often problems with FHEM, but dont know where they come from.

After a long time and long term tests i have seen, that the Raspi RAM got nearly to 60-70% and CPU 40-60% (also some time after saving) so i get often that error:

2019.07.01 00:00:12 1: Cannot fork: Cannot allocate memory
2019.07.01 00:00:12 1: Cannot fork: Cannot allocate memory
2019.07.01 00:00:12 1: in CANNOT_FORK
2019.07.01 00:00:14 1: Cannot fork: Cannot allocate memory
2019.07.01 00:00:14 1: Cannot fork: Cannot allocate memory
2019.07.01 00:00:14 1: in CANNOT_FORK


Fhem also often hangs up or was very slow.

So i looked in the log file what was changed before this error occured the first time and see, that the only thing what i did is changing the RFID Chip Number.
I updated to laterst Version  from 2015-06-11 and tried with RDM630A and RDM630 but allways the same issue.

Than i changed my RFID Number to the old one again and selected RDM630 and everything was working fine for me. RAM is constand on 5 to 15% and CPU 10 to 20%

Do you think problem is the bigger number of that new chip? Do you have any Idea to fix that issue?


Thanks a lot