MiczFlor / RPi-Jukebox-RFID

A Raspberry Pi jukebox, playing local music, podcasts, web radio and streams triggered by RFID cards, web app or home automation. All plug and play via USB. GPIO scripts available.
http://phoniebox.de
MIT License
1.34k stars 396 forks source link

RFID Reader funktioniert nicht #231

Closed flo2305 closed 5 years ago

flo2305 commented 5 years ago

Hi,

super Projekt von dir, bin begeistert.

Habe jedoch das Problem, dass der USB RFID Reader bei mir keine ID's an die Webapp weitergibt. Im Terminal zeigt er beim Scannen die zugehörige Nummer an, die WebApp reagiert allerdings nicht.

Beim Registrieren mit RegisterDevice.py zeigt er mir den Reader auch immer doppelt an.

Choose the reader from list 0 kpd 1 kpd 2 Logitech Keyboard 3 Logitech USB-PS/2 Optical Mouse

Viele Grüße Florian

Beder85 commented 5 years ago

Hello, I recently bought the NEUFTECH RFID USB Reader over Amazon https://www.amazon.de/gp/product/B018OYOR3E/

Using RegisterDevice.py and checking the deviceNames.txt I can see the device called "HXGCoLtd" and not "HXGCoLtd HIDKeys". This difference was also mentioned by @aschindler82 bevore. Don't know if this difference is important.

I installed the phoniebox on a RPi 2 using the one line install script without spotify and Raspbian 2018-03-13-raspbian-stretch. The reader does work when I want to teach a new card using the web interface - but if I swipe the card over the reader, then the reader makes a sound but the phoniebox does not start to play. I can see the correct id of the card in the terminal window when I swipe the card.

I already checked the phoniebox-rfid-reader.service. It is installed, loaded and active.

Does anybody have an idea how to get the rfid reader working?

I also checked the state of the rfid read in the web app - it is enabled. And (like i said bevore) I was able to teach new rfid cards


I reinstalled the phoniebox from scratch yesterday. Now the reader works perfectls. I did not find out the root cause....

c-m0s commented 5 years ago

I tried updating the jukebox and now also reinstalling (via "one line install" script) the whole system, but I can't get the readers input into the Jukebox-WebUI any more. It beeps and I do get the input on the local terminal though.

Does anyone have any input/idea? Or do I really have to switch to the Neuftech-Reader?

I switched to the Neuftech-Reader.

TomBourine commented 5 years ago

Thank you c-m0s! I have the KKMoon, too. And it started working through the WebApp after I commented out "break" in /home/pi/RPi-Jukebox-RFID/scripts/Reader.py, re-registered with "python2 RegisterDevice.py" and rebooted. The device name in deviceName.txt remained the same: "HID 413d:2107" Anyway - I will give a fresh install a try soon with "one line install".

Thanks MiczFlor, this is a great project!

batidsoce commented 5 years ago

@TomBourine , can i ask for your help. i'm struggling with a kkmoon Reader.

when i use Reader.kkmoon.py ( rename as Reader.py) and reboot, the RFID reader service do not start...

Mar 14 15:08:33 raspberrypi systemd[1]: phoniebox-rfid-reader.service: Failed with result 'exit-code'. Mar 14 15:08:33 raspberrypi systemd[1]: phoniebox-rfid-reader.service: Service hold-off time over, scheduling restart. Mar 14 15:08:33 raspberrypi systemd[1]: Stopped Phoniebox RFID-Reader Service. Mar 14 15:08:33 raspberrypi systemd[1]: phoniebox-rfid-reader.service: Start request repeated too quickly. Mar 14 15:08:33 raspberrypi systemd[1]: Failed to start Phoniebox RFID-Reader Service. Mar 14 15:08:33 raspberrypi systemd[1]: phoniebox-rfid-reader.service: Unit entered failed state. Mar 14 15:08:33 raspberrypi systemd[1]: phoniebox-rfid-reader.service: Failed with result 'exit-code'.

python daemon_rfid_reader.py /home/pi/RPi-Jukebox-RFID/scripts Traceback (most recent call last): File "daemon_rfid_reader.py", line 16, in cardid = reader.reader.readCard() AttributeError: Reader instance has no attribute 'reader'

batidsoce commented 5 years ago

Super, Danke!!! jetzt hat er unter shortcuts eine Datei mit der KartenID angelegt. Audiofolders ist zwar noch ohne Ordner, aber da versuch ich jetzt erstmal weiter :)

did you get it working with kkmoon reader ?

batidsoce commented 5 years ago

i got it working modifying the original Reader.py

i have a kkmoon REader. the one that show 2 devices with the same VID/PID when you launch RegisterDevice.py

using the Reader.kkmoon.py gave me an error and the Rfid service does not launch. i modified the original Reader.py
devices = get_devices() for device in devices:

if device.name == deviceName:

            #i only have one usb device connecter ( the reader )
            device=InputDevice("/dev/input/event0")
            self.dev = device
             #   break
        try:
            self.dev
desevent7 commented 5 years ago

Hallo Ich benutze ebenfalls den Kartenleser der 2 Devices ausgibt. https://www.amazon.de/dp/B011XI2DE8 Gibt es hierzu bereits eine Lösung? Ich habe schon diverses getestet aber leider war alles erfolglos. Umsteigen würde ich nur ungern, da ich die Karten noch an einem Arduino weiterhin nutzen möchte.

batidsoce commented 5 years ago

hola desevent 7.

yep, i found a solution ( sorry to switch in english but easier for me ) As i wrote before, you have to modify the file : Reader.py

instead of letting the program look for the device, we are going to force the device with this : device=InputDevice("/dev/input/event0")

i use event0 because it's what i got from the ommand line : ls -la /dev/input/by-id/ if ou have several usb devices plugged in, your eventX might be event1 or 2.

look for this piece of code in Reader.py

devices = get_devices() for device in devices: if device.name == deviceName:

and try to modify it this way :

i only have one usb device connecter ( the reader )

device=InputDevice("/dev/input/event0") self.dev = device

break

try: self.dev

be careful of putting 0,1 or 2 depending on the result of " ls -la /dev/input/by-id/"

SAVE REBOOT ENJOY

Le ven. 19 avr. 2019 à 17:35, desevent7 notifications@github.com a écrit :

Hallo Ich benutze ebenfalls den Kartenleser der 2 Devices ausgibt. https://www.amazon.de/dp/B011XI2DE8 Gibt es hierzu bereits eine Lösung? Ich habe schon diverses getestet aber leider war alles erfolglos. Umsteigen würde ich nur ungern, da ich die Karten noch an einem Arduino weiterhin nutzen möchte.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/MiczFlor/RPi-Jukebox-RFID/issues/231#issuecomment-484933728, or mute the thread https://github.com/notifications/unsubscribe-auth/ALSPV7QGLJ6ENIPV3FBSXATPRHRFRANCNFSM4FYHSG5Q .

-- Pura Vida

desevent7 commented 5 years ago

Hi Thanks for your help, but i dont know which part i excactly must write Can you sent/attach the hole Reader.py. my device ist device0

batidsoce commented 5 years ago

here the file Reader.py

use WinScP to transfer the file to Script folder

Le sam. 20 avr. 2019 à 18:09, desevent7 notifications@github.com a écrit :

Hi Thanks for your help, but i dont know which part i excactly must write Can you sent/attach the hole Reader.py. my device ist device0

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/MiczFlor/RPi-Jukebox-RFID/issues/231#issuecomment-485139101, or mute the thread https://github.com/notifications/unsubscribe-auth/ALSPV7RDLWVEWW4C5UFOCGDPRM54ZANCNFSM4FYHSG5Q .

-- Pura Vida

!/usr/bin/env python2

There are a variety of RFID readers out there, USB and non-USB variants.

This might create problems in recognizing the reader you are using.

We haven't found the silver bullet yet. If you can contribute to this

quest, please comment in the issue thread or create pull requests.

ALTERNATIVE SCRIPTS:

If you encounter problems with this script Reader.py

consider and test one of the alternatives in the same scripts folder.

Replace the Reader.py file with one of the following files:

* Reader.py.experimental

This alternative Reader.py script was meant to cover not only USB readers but more.

It can be used to replace Reader.py if you have readers such as

MFRC522 or RDM6300

* Reader.py.kkmoonRFIDreader

KKMOON RFID Reader which appears twice in the devices list as HID 413d:2107

and this required to check "if" the device is a keyboard.

import string

import csv

import os.path import sys

from evdev import InputDevice, categorize, ecodes, list_devices from select import select

def get_devices(): return [InputDevice(fn) for fn in list_devices()]

class Reader: reader = None

def __init__(self):
    self.reader = self
    path = os.path.dirname(os.path.realpath(__file__))
    self.keys = "X^1234567890XXXXqwertzuiopXXXXasdfghjklXXXXXyxcvbnmXXXXXXXXXXXXXXXXXXXXXXX"
    if not os.path.isfile(path + '/deviceName.txt'):
        sys.exit('Please run RegisterDevice.py first')
    else: 
        with open(path + '/deviceName.txt','r') as f:
            deviceName = f.read()
        devices = get_devices()
        for device in devices:
            #if device.name == deviceName:
            device=InputDevice("/dev/input/event0")    
            self.dev = device
             #   break         
        try:
            self.dev
        except:
            sys.exit('Could not find the device %s\n. Make sure is connected' % deviceName)

def readCard(self):
    stri=''
    key = ''
    while key != 'KEY_ENTER':
       r,w,x = select([self.dev], [], [])
       for event in self.dev.read():
        if event.type==1 and event.value==1:
            stri+=self.keys[ event.code ]
            #print( keys[ event.code ] )
            key = ecodes.KEY[ event.code ]
    return stri[:-1]
desevent7 commented 5 years ago

Thank you. It seems to work. Now the Card ID is visible in the web browser.

batidsoce commented 5 years ago

Perfect ! It Will work.

Le dim. 28 avr. 2019 à 10:00, desevent7 notifications@github.com a écrit :

Thank you. It seems to work. Now the Card ID is visible in the web browser.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/MiczFlor/RPi-Jukebox-RFID/issues/231#issuecomment-487355461, or mute the thread https://github.com/notifications/unsubscribe-auth/ALSPV7VPVATYAOMDUZNJS3TPSVKTJANCNFSM4FYHSG5Q .

RomainHermenier commented 3 years ago

Hello everyone,

I've started created my Jukebox and I faced the same issue as described in the thread: no card RFID ID displayed in the web app (even though the HW card reader is correctly configured and Card ID is correctly displayed in the terminal).

I managed to fix this bug on my own. Here is the steps I've done.

Hope that helps anyone having similar issue.

Leo-cybr commented 3 years ago

Hallo zusammen,

ich bin auf dieses tolle Projekt gestoßen und dachte, dass es eine tolle Gelegenheit ist, um sich auch einmal in die Welt des Raspberry Pi einzuarbeiten. Bisher hat auch alles wunderbar geklappt, nur leider taucht auch bei mir das bereits bekannte Problem mit dem Nichterkennen der RFID Karten in der Webanwendung der Phoniebox auf. Allerdings wird die Karte im LXTerminal beim Auflegen angezeigt.

Nachfolgend ein Rahmenangaben:

Scheinbar konnten hier bereits anderen Anwendern mit deren Problem geholfen werden, allerdings bin ich aus dem Schriftverkehr nicht besonders schlau geworden. Wie gesagt bin ich echt noch ein Neuling in der Raspberry-Welt und wäre für eure Hilfe daher sehr dankbar! Lieben Gruß,

Leo

Sascha4546 commented 2 years ago

Moin, mir ist aufgefallen das es für den Neuftech EM 4100, zwei unterschiedliche versionen gibt https://bilderupload.org/bild/69cb34982-old-works-fine <--- funktioniert anstandslos

https://bilderupload.org/bild/a58635030-new-causing-problems <--- zickt rum

hqxt2014 commented 2 years ago

Neuftech USB RFID Reader ID

had update to new software. you can download from: http://neuftech.net/downloads

hqxt2014 commented 2 years ago

Den Reader habe ich von einer Einkaufsliste bei Amazon bestellt (https://www.amazon.de/gp/product/B011XI2DE8)

kpd scheint keine Änderung zu bewirken. Ich finde unter /dev/ auch kein ttyUSB sondern nur ein uhid. grafik

lsusb sagt auch nichts: grafik

und dmesg gibt mir nur das: grafik

Gibt es eine Möglichkeit die Eingabe des Readers direkt ins Terminal zu schreiben? mit ./rfid_trigger_play.sh -i= erhalte ich einen Fehler ( Zeile 277: [: Zu viele Argumente.)

Bisher konnte ich den Reader nur unter Windows testen da geht er.

https://www.amazon.de/Neuftech-Reader-Kartenleseger%C3%A4t-Kartenleser-Kontaktlos/dp/B018OYOR3E