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

MiczFlor commented 5 years ago

HI @flo2305 so gerne ich könnte, leider kann ich dir nicht wirklich helfen, was die Hardware angeht. Eine Sache solltest du aber nachschauen: in der web app unter "Settings" kann man unten auf der Seite den RFID Reader an bzw. ausschalten (genauer gesagt den systemd dazu). Ist da der Reader "ON"?

mensch-meier commented 5 years ago

Hi, ich hab das gleiche Problem. Der RFID Reader ist in der Webapp eingeschaltet und wenn ich eine Karte registrieren will, wird die Nummer nur im Terminal angezeigt aber nicht in der Webapp.

flo2305 commented 5 years ago

Eingeschaltet ist er in der WebApp.

Wenn ich den Befehl ./rfid_trigger_play.sh -i= eingebe und dann die Karte scanne funktioniert alles.

Aber das ganze sollte ja von allein funktionieren sobald ich einfach nur die Karte scanne.

MiczFlor commented 5 years ago

Hi @flo2305 @mensch-meier kann sein, dass sich mit dem letzten merge ein Fehler eingeschlichen hat. Deshalb habe ich meinen develop branch mit master gemerged. Versucht bitte mal, ob ein git pull das Problem behebt. https://github.com/MiczFlor/RPi-Jukebox-RFID/pull/233

flo2305 commented 5 years ago

Hi @MiczFlor,

ok, dass versuche ich. Bin leider noch nicht so tief im Thema, wie würde der git pull Befehl komplett aussehen?

MiczFlor commented 5 years ago

Geh ins Terminal und gib das auf der Kommandozeile ein.

cd /home/pi/RPi-Jukebox-RFID
git checkout master
git fetch origin
git reset --hard origin/master
git pull
sudo chown -R pi:www-data /home/pi/RPi-Jukebox-RFID/shared
sudo chmod -R 775 /home/pi/RPi-Jukebox-RFID/shared
sudo chown -R pi:www-data /home/pi/RPi-Jukebox-RFID/htdocs
sudo chmod -R 775 /home/pi/RPi-Jukebox-RFID/htdocs
sudo chown -R pi:www-data /home/pi/RPi-Jukebox-RFID/settings
sudo chmod -R 775 /home/pi/RPi-Jukebox-RFID/settings
kris711 commented 5 years ago

Hallo bei mir dasselbe Problem, der pull hat nichts gebracht (Bereits aktuell). ls -la /dev/input/by-id/ grafik es ist nur der Reader angeschlossen (welcher auch fleissig piept wenn ein chip in die nähe kommt)

python2 RegisterDevice.py grafik

Egal ob 0 oder 1 steht in deviceName.txt HID 413d:2107

passt das hier?

MiczFlor commented 5 years ago

Was passiert, wenn man manuell kpd in das File deviceName.txt schreibt? (Was ist das denn für ein Reader, habt ihr dafür einen Link?)

kris711 commented 5 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.

flo2305 commented 5 years ago

Also ich habe den verlinkten RFID Reader von Amazon erworben, damit kein Erfolg. Pull war bei mir auch erfolglos.

Allerdings funktioniert es bei mir jetzt mit einem anderen Reader, einer mit 13,56 MHz. Somit aber leider auch die bereits erworbenen 125 kHz Karten nutzlos...

mensch-meier commented 5 years ago

Ich hatte für die Phoniebox jeweils bereits die Schritt für Schritt-Installation gemacht und später das automatische Skript gestartet. Bei der manuellen Installation hat der Reader noch IDs der Karten im Terminal angezegit, bei der automatischen Installation werden nun nicht mehr die IDs angezegit, wenn ich die Karte an den Reader halte.

JoeNess667 commented 5 years ago

Hi. Super Projekt! Habe hier leider ein ähnliches Problem. Installation und Setup alles i.o. Weboberfläche läuft ebenfalls und Musik ist zu hören :) Es hapert an der Übernahme der RFID-Eingabe. Im Terminal sehe ich die Nummer des RFID-Tags. Wie bei kris711 macht auch die Wahl des Eingabegeräts keinen Unterschied. Vielleicht hilft es noch zu erwähnen das die Datei "latestID.txt", bzw. "settings/Latest_RFID" nicht geschrieben wird.

MiczFlor commented 5 years ago

Ich habe gerade von @keinkurt einen pull request in den develop branch gemerged: https://github.com/MiczFlor/RPi-Jukebox-RFID/pull/235 wer sich mit git genug auskennt, das mal durchzutesten, den/die würde ich gerne dazu einladen das zu tun.

Und wegen der Hardware, habt ihr alle den Reader gekauft, der von der README.md Seite verlinkt ist? KKmoon IC Kartenlesegerät Berührungslose 14443A Kartenleser Card Reader mit USB Schnittstelle 5pcs Karten + 5pcs Schlüsselanhänger 13.56MHZ RFID Energieklasse A. Vielleicht hat sich da die Hardware geändert, seit ich das verlinkt habe. Hat jemand einen anderen Link zu einem Reader der geht?

Alarius commented 5 years ago

Ich benutze diesen Reader ohne Probleme https://www.amazon.de/gp/product/B018OYOR3E/ref=oh_aui_detailpage_o01_s00?ie=UTF8&psc=1

MfG Alarius

flo2305 commented 5 years ago

Ich hatte zuerst auch den aus der README.md, hat bekanntlich nicht funktionieren. Dieser hier läuft problemlos: Neuftech USB RFID Reader ID Kartenlesegerät Kartenleser Kontaktlos Card Reader für EM4100 https://www.amazon.de/dp/B018OYOR3E/ref=cm_sw_r_cp_api_G3qTBb7JRYHMV

JoeNess667 commented 5 years ago

OK dann versuchen wir es nochmal mit einem anderen Reader! Falls das Problem damit behoben wird könnte man ja den link vielleicht in den Manuals ändern :)

MiczFlor commented 5 years ago

Ich habe den Link im README file geändert. Denkt ihr das ist ok so?

RFID Card Reader (USB): Neuftech USB RFID Reader ID Kartenlesegerät Important notice: the hardware of the reader that I had linked here for a long times seems to have changed and suddenly created problems with the Phoniebox installation. The reader listed now has worked and was recommended by two Phoniebox makers (2018 Oct 4). I can not guarantee that this will not change and invite you to give RFID Reader feedback in this thread.

flo2305 commented 5 years ago

Ich würde eventuell noch auf die genutzte Frequenz von 125 kHz hinweisen. Karten vom anderen Reader (13,56 Mhz) sind nicht kompatibel. Ich hatte im Vorfeld bereits 100 Karten bestellt... Leider jetzt nicht mehr nutzbar.

mariposastern commented 5 years ago

Halluuu,

das mit den CArdreadern scheint ja shcon ein Thema für sich..

ich habe mir den https://www.amazon.de/gp/product/B011XI2DE8/ref=as_li_qf_sp_asin_il_tl?ie=UTF8&camp=1638&creative=6742&creativeASIN=B011XI2DE8&linkCode=as2&tag=diebarnfeld-21 gekauft und habe den selben fehler wie alle hier im Board.

Habe aber auf den Fotos bei amazon gesehen, dass man hinten auf der Platine etwas umstellen kann, ich berichte wenn ich hier erfolge erziele....

wenn jemand hier mehr plan hat :), höre ich auch gerne zu ^^ +Update: reader beept, also erkennt er die karte, nur überträgt er wohl nicht....

grützi Christian

kris711 commented 5 years ago

@flo2305 Als was wird das Gerät bei Dir erkannt? Ich habe mir das Ding auch mal bestellt. leider ähnlich schlechtes Ergebnis:

grafik

In der deviceName.txt steht nun das (gibt nur nuch 0 als Auswahl): grafik

@MiczFlor Ja bin auf #235 - kein Unterschied

flo2305 commented 5 years ago

Bei mir wird das neue Gerät erkannt und es hat sofort funktioniert.

kris711 commented 5 years ago

Bei mir leider nicht -.-

@flo2305 Kannst Du mir den Inhalt der deviceName.txt nennen? Du findest die Datei hier: /home/pi/RPi-Jukebox-RFID/scripts/

flo2305 commented 5 years ago

File: deviceName.txt
HXGCoLtd HIDKeys

ploegy commented 5 years ago

Hab auch den https://www.amazon.de/gp/product/B011XI2DE8/ref=as_li_qf_sp_asin_il_tl?ie=UTF8&camp=1638&creative=6742&creativeASIN=B011XI2DE8&linkCode=as2&tag=diebarnfeld-21 gekauft.bei mir funktioniert es aber nur sporadisch ohne das ich nachvollziehen kann wieso, meist nach mehrmaligem Umstecken. Hab den Reader auseinander genommen und auf der Platine steht eine Anleitung geschrieben.man soll am PC ein schreibprogramm öffnen und dann das Lesegerät 2mal für ne Sekunde anstecken.beim 3ten Mal Pieps 3mal und im schreibprogramm läuft die Sequenz mit verschiedenen Einstellungen...hilft aber auch nicht...

MiczFlor commented 5 years ago

Hi all, Hallo an alle hier im Thread,

I merged the following stuff to master: #240 There is a new way now loading the RFID reader device if and when a card is used. I could only test it on my USB reader(s) and it works. Please update to the latest version, see here for details: upgrade AND PLEASE: check in the web app under "Settings" at the bottom of the page, if you reader is switched on. (ich übersetze das jetzt nicht, wir können aber gerne weiter auch in Deutsch hier posten)

Please tell me if this works for you and then also post

kris711 commented 5 years ago

Hi @MiczFlor, leider kein Erfolg. Zunächst Deine Fragen:

  1. 3B+
  2. HXGCoLtd HIDKeys (selber Reader der mit diesen Einstellungen bei @flo2305 funktionier)

Was mir bei der #240 auffällt:

  1. RegisterDevice.py kann nicht mehr ausgeführt werden:

grafik

  1. RFID Reader unter Setting Einstellung in der WebApp kann nicht aktiviert werden, bzw. ist nach einem Refresh der Seite immer wieder auf disabled.

Um Probleme auszschliessen habe ich meinen Pi frisch aufgesetzt - diesmal die full Version. Ausser RPi-Jukebox-RFID habe ich nichts weiter installiert. In der grafischen Oberfläche funktionieren die Reader:

grafik

Kann ich irgendwas tun, um dir beim debuggen zu helfen?

kris711 commented 5 years ago

Vielleicht hilfreich.... error.log vom Webserver: grafik

Die Dateien Latest_Folder_Played und latestID.txt waren auch ewig oft drin, da sie nicht vorhanden waren. Habe Sie nun manuell angelegt und damit zumindest weniger Fehler im Log.

black-dahila commented 5 years ago

Ich habe seit heute das gleiche Problem. Das System wurde ebenfalls komplett neu aufgesetzt. fehler pb

gizmo21 commented 5 years ago

So I updated (git pull with additional commands seen in README.md) my test-SD from 1.0.0 where everything worked great to 1.1.4 and now the RFID-reader always seems to unregister (to be seen in settings - it switches to OFF after some seconds) and it really doesn't work anymore.

So it seems it's not the hardware, so I would suggest not just to buy new readers, but perhaps revert to and older master version on git. Perhaps Micz could guide to a git command to a perhaps working version. I'll just put in my kids SD on 1.0.0 to verify the reader is not the problem, will report back.

[Update] Also was zu erwarten war, die 1.0.0. geht wunderbar mit dem Neuftech Reader (siehe den von @black-dahila oder @kris711 und anderen hier) . Dies nur als Hinweis für alle die einen git rollback hinbekommen.

black-dahila commented 5 years ago

Das komische ist, dass gestern noch alles einwandfrei funktioniert hat (komplette Neuinstallation). Wenn ich das richtig sehe, würde seitdem aber kaum was geändert.

MiczFlor commented 5 years ago

HI @black-dahila @gizmo21

was sich verändert hat ist nicht unwesentlich und hat genau mit den RFID Lesegeräten zu tun. Allerdings gab es die Probleme schon vorher. Aber ich denke mit dem letzten merge ist was aus dem Ruder geraten: https://github.com/MiczFlor/RPi-Jukebox-RFID/pull/240

Wie gesagt, davor gab es auch schon Probleme, da hatte sich aber ewig nichts am Reader code geändert.

Ich überleg mal, wie man das am besten wieder auf einen stabilen Stand bringen kann UND die Neuerungen besser testen kann UND diese dann leicht auf die laufenden Geräte einspielen kann.

black-dahila commented 5 years ago

Hi @MiczFlor Erstmal danke für Mühe und die schnelle Antwort. Das ist echt ein Super Projekt. Ich habe die Änderungen, die mit dem RFID-Reader zu hat, jetzt auch entdeckt. Die habe ich vorhin wohl übersehen. Ich benutze übrigens den neu-verlinkten Reader und bis jetzt hatte ich da nie Probleme mit. Schönen Sonntag noch.

MiczFlor commented 5 years ago

I will write this in English, so everybody who managed to read through the documentation can also get this. And I assume the partly German discussion will also understand the following:

In order to step back a few commits to a time where the reader did (or might have) worked, please do the following. https://github.com/MiczFlor/RPi-Jukebox-RFID/issues/231#issuecomment-428241167

NOTE: do this if you are sure that your setup did work once and does not work anymore. Only then. There have been reports that some more recently purchased readers don't work. The RFID reader linked on the front page has been reported to work. The revert process here is constructed in a way that you can jump ahead again, if and when this problem is fixed.

So, enough talking, if you want to revert to an older code base, this has worked on my test Phoniebox.

Firstly, jump back to the tag v1.1.3 (if you want to go back even further, you can try other tags, listed here). NOTE Actually, this is old, I keep it here as learning material, Don't jump back to 1.1.3 but ahead to 1.1.6 https://github.com/MiczFlor/RPi-Jukebox-RFID/issues/231#issuecomment-428241167

git reset --hard "v1.1.3" git checkout master

Now you can register the device by typing the following:

cd /home/pi/RPi-Jukebox-RFID/scripts/
rm /home/pi/RPi-Jukebox-RFID/scripts/deviceName.txt
python2 RegisterDevice.py

And see the results:

cat /home/pi/RPi-Jukebox-RFID/scripts/deviceName.txt

Now, let's make sure the correct daemon is installed and running:

sudo cp /home/pi/RPi-Jukebox-RFID/misc/sampleconfigs/rfid-reader.service.stretch-default.sample /etc/systemd/system/rfid-reader.service 
sudo chown root:root /etc/systemd/system/rfid-reader.service
sudo chmod 644 /etc/systemd/system/rfid-reader.service
sudo systemctl enable rfid-reader

And please reboot to be sure.

sudo reboot

Now see if the rfid-reader daemon is running. Firstly, go to the web app and check at the bottom of the page. Secondly, in the terminal you can type:

sudo systemctl status rfid-reader.service

Which should return something like this:

● rfid-reader.service - RFID-Reader Service
   Loaded: loaded (/etc/systemd/system/rfid-reader.service; enabled; vendor pres
   Active: active (running) since Sun 2018-10-07 17:32:18 UTC; 46min ago
 Main PID: 399 (python2)
   CGroup: /system.slice/rfid-reader.service
           └─399 /usr/bin/python2 /home/pi/RPi-Jukebox-RFID/scripts/daemon_rfid_

Just for you to know, you don't need to do this now. Live and learn: you can stop and start the Phoniebox rfid-reader daemon by typing the following:

sudo systemctl stop rfid-reader.service
sudo systemctl start rfid-reader.service

Now the big test. Swipe a card and then see if it was noticed by the Phoniebox by typing (after the swipe):

cat /home/pi/RPi-Jukebox-RFID/shared/latestID.txt

Which should return something like this:

Card ID '0007698255' was used at '2018-10-07.18:22:00'.
This ID was used for the first time.
The shortcut points to audiofolder '0007698255'.

If this is the case, the card reader works, is recognized AND pipes the ID to the Phoniebox script(s).

Having reverted to an older version might mean that some stuff is not as luxurious or even a bit buggy. But at least you don't have the big bug that brought us all to this thread.

kris711 commented 5 years ago

Yeehawww - ok I ignored your tipp not do go back if my setup never worked before - but I switched to 1.0.0 and it works for the first time now. Afterwards switched to 1.1.3 and it keeps working fine.

MiczFlor commented 5 years ago

Hi everybody,

to put an end to the RFID reader registration problem, I did something I am not proud of :) I reverted part of the code to the older python script for registration. But because other stuff had progressed, I did not want to keep this out. So there is now the 1.1.6 release that should work just like the 1.1.3 revert that I proposed a bit earlier here.

If somebody has a box in the making and would be happy to reinstall using the one line script, please do so - and tell us if it still works. If it does, I will close this thread - and if need be we start another.

You can also update a running version of the Phoniebox with the commands listed here: https://github.com/MiczFlor/RPi-Jukebox-RFID/blob/master/docs/UPGRADE.md#upgrade-from-version-111-to-116

gizmo21 commented 5 years ago

Are the commands for 1.1.4 to 1.1.6 the same as 1.1.1 to 1.1.6 mentioned above, or just a simple pull or ontop even special treatment for the readers-config?

MiczFlor commented 5 years ago

The commands from 1.1.1 to 1.1.6.

It‘s important to replace the rfid systemd script. A simple git pull doesn‘t cut that cake :)

mariposastern commented 5 years ago

went back to v. 1.1.3 or any other version, tried to register rfid reader

now with that output..

cd /home/pi/RPi-Jukebox-RFID/scripts/ rm /home/pi/RPi-Jukebox-RFID/scripts/deviceName.txt python2 RegisterDevice.py

pi@raspberrypi:~/RPi-Jukebox-RFID/scripts $ python2 RegisterDevice.py Traceback (most recent call last): File "RegisterDevice.py", line 4, in from evdev import InputDevice, list_devices ImportError: No module named evdev

MiczFlor commented 5 years ago

@mariposastern please try this:

cd /home/pi/RPi-Jukebox-RFID
git checkout master
git fetch origin
git reset --hard origin/master
git pull
sudo chown -R pi:www-data /home/pi/RPi-Jukebox-RFID/shared
sudo chmod -R 775 /home/pi/RPi-Jukebox-RFID/shared
sudo chown -R pi:www-data /home/pi/RPi-Jukebox-RFID/htdocs
sudo chmod -R 775 /home/pi/RPi-Jukebox-RFID/htdocs
sudo chown -R pi:www-data /home/pi/RPi-Jukebox-RFID/settings
sudo chmod -R 777 /home/pi/RPi-Jukebox-RFID/settings
sudo cp /home/pi/RPi-Jukebox-RFID/misc/sampleconfigs/rfid-reader.service.stretch-default.sample /etc/systemd/system/rfid-reader.service 
sudo chown root:root /etc/systemd/system/rfid-reader.service
sudo chmod 644 /etc/systemd/system/rfid-reader.service
sudo systemctl enable rfid-reader
mariposastern commented 5 years ago

pi@raspberrypi:~/RPi-Jukebox-RFID/scripts $ python2 RegisterDevice.py Traceback (most recent call last): File "RegisterDevice.py", line 4, in from evdev import InputDevice, list_devices ImportError: No module named evdev

same results. if you need anything else?

raspi 1, clean raspbian installation used 1 line install script

Gruß Christian =D

pgx3d commented 5 years ago

Hi Ich habe leider gerade diese Woche den 13.56er Leser gekauft aus deinem Link. Bei mir wird auch nur HID 413d:2107 aufgeführt.

Habe verschiedene Pis und Installationen getestet. Auch das aus dem vorletzten Post. Leider ohne Erfolg.

Grüsse Manuel

MiczFlor commented 5 years ago

Hi @pgx3d welche Version läuft bei dir? Das steht im File settings/version. Versuch auch bitte mal diesen Schritt: https://github.com/MiczFlor/RPi-Jukebox-RFID/issues/231#issuecomment-428241167

MiczFlor commented 5 years ago

Hi @mariposastern welche Version läuft bei dir? Das steht im File settings/version. Ich muss mich noch mal am Kinn kratzen und nachdenken. Wenn's dir nichts ausmacht, dann mach doch noch mal einen Install mit dem one line scrip - und lösche vorher den gesamten RPi-Jukebox-RFID Ordner Wenn du vorher was anderes probieren möchtest, das aber nicht gehen sollte, dann entferne im scripts Ordner alle Datein, die mit .pyc enden und versuche es dann noch mal.

pgx3d commented 5 years ago

Hi @MiczFlor

Ich habe #231 probiert und auch nochmals alles gelöscht und neu installiert. Version 1.1.6 mit Pi3.

Leider immer noch das gleiche Problem. Ich würde ja einen 125 KHz Reader kaufen, aber da ich möchte gerne die von der Migros (CH) angebotenen Storybox-Figuren weiter verwenden.

(Danke für deine Bemühungen und dem tollen Projekt!)

jonach66 commented 5 years ago

Hi @all,

Neuftech reader works fine, reader HID 413d:2107 seems to have a hardware problem (mine is a M301 V4 - SODIAL 13.56mhz reader!).

Check with linux command "cat < /dev/hidraw0" what the readers are sending.

kr j

pgx3d commented 5 years ago

Hi @jonach66

my output is '#! &" $(

jonach66 commented 5 years ago

Hi @pgx3d,

IMHO this is exactly the problem, a proper reader should send nice numbers to the keyboard input. My conclusion is, that this is a hardware, not a software problem.

I think you have 2 options:

Remark: my HID 413d:2107 (hardware Version M301 - V4 - no DIP switches) works ok on a windows machine, not on linux at all (tried on 3 different linux systems)

kr j

pgx3d commented 5 years ago

hi @jonach66

The funny thing is that mine worked on the linux desktop without a fault. I have to look for a Neuftech with 13.56 MHz.

Thx for the infos.

BR Manuel

MiczFlor commented 5 years ago

Hi @jonach66 @pgx3d my hunch is that the reader does work, the output is read ok by the operating system when trying it - the way the numbers show up in the terminal when you swipe. Phoniebox requires this output to be kind of routed through the software evdev https://python-evdev.readthedocs.io/en/latest/ so that the output of the reader is not simply "typed" in, but routed to the Phoniebox daemon that is waiting for input from the reader. And somewhere in this process, there is an incompatibility. So who is to blame :) ??? One might say the reader developers, because they seem to somehow not live up to the standards that other reader provide. Or, I don't know, the evdev developers for not accounting for new standards that might have come along. Or Phoniebox for not providing a good list for compatible hardware (my link went out of date, I didn't keep buying and checking, of course) or Phoniebox for not finding a software other than evdev to make that connection. The answer is, of course, it's a bit of everything. And that is part of the tinkering we do here in the Phoniebox open source world. The most I do learn in projects like this is trying to understand and fix errors - that I didn't see coming. What I mean to say: it's unfortunate but part of the process. There are no guarantees, there is only expericence and life long learning :)

jonach66 commented 5 years ago

Hi @pgx3d, just to be clear, I have the Neuftech 125khz reader up an running! Which evdev version installed?

Hi @MiczFlor, evdev is a good hint, maybe an older evdev version could do the job for the HID 413d:2107!? Will check over the weekend... You are right, maybe I was to fast to blame the hardware!

kr j