Hauptmenü

RFID Module

Begonnen von andrejs, 25 April 2014, 17:15:25

Vorheriges Thema - Nächstes Thema

eppi

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

andrejs

#16
Hi Dani,

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

Andrej

eppi

Hi Andrej
yes, 10 Digits!
The Card RFID Number is 0006994818

Greets Dani

andrejs

#18
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





eppi

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

andrejs

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

eppi

Dear Andrej
Cool, I'm verry impressed!

Greets Dani

andrejs

#22
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
   

eppi

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

andrejs

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

eppi

Hi Andrej
unfortunately no ...
Attached find yo my Log...

Good Luck und many thanks!
Greets Dani

andrejs

It seems I am not so good at that. The problem was printf (it should be sprintf) and it is corrected. Test again please...

eppi

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

andrejs

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

andrejs

Dani,

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

attr global userattr active, restricted

Andrej