maddox/magic-cards

Unhandled 'error' event

Closed this issue · 7 comments

Magic Card installed as per instructed with docker-compose provided from project. I have however removed the Sonos part since I am not using Sonos at the moment. Everything works fine, I get Spotify to play through automation in Home-Assistant. But after some hours (uncertain how long) something happens and when trying to read a card nothing happens and I get the following error:

[1] events.js:165
[1]       throw er; // Unhandled 'error' event
[1]       ^
[1] 
[1] Error: ENODEV: no such device, read
[1] Emitted 'error' event at:
[1]     at ReadStream.<anonymous> (/usr/src/app/scanner/node_modules/input-event/lib/index.js:45:10)
[1]     at ReadStream.emit (events.js:180:13)
[1]     at fs.read (fs.js:2116:12)
     at FSReqWrap.wrapper [as oncomplete] (fs.js:673:17)
[1] error Command failed with exit code 1.
[1] info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
[1] error Command failed with exit code 1.
[1] info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
[1] yarn scanner exited with code 1

Only solution so far has been to restart docker.

docker-compose.yaml file:

version: "3"

services:
  magic-cards:
    image: jonmaddox/magic-cards:latest
    container_name: magic-cards
    network_mode: host
    ports:
      - "5000:5000"
    restart: always
    volumes:
      - $PWD/magic-cards/config:/usr/src/app/config
    devices:
      - "/dev/input/event0:/dev/input/event0"

config.json:

{
  "input_device": "event0",
  "spotify": {
    "clientID": "0000000000000000000",
    "clientSecret": "000000000000000000000"
  }
}

actions.json:

{
  "Home Assistant": {
    "type": "home_assistant",
    "host": "x.x.x.x",
    "port": "xxx",
    "ssl": false,
    "password": "MyPassword"
  }
}

Unfortunately it looks like it’s loosing track of your scanner. I’ll try to prevent it from crashing, but you still might have an issue with why it’s disconnecting.

Ok, so I have an idea, the power supply that came with the Pi was not for my outlet, so I used an iPad power supply. This gives only 2.1A and the Pi should have 2.5A, and I guess the reader doesn't help to the equation. I'll try to switch the power supply and see if this does anything to the stability.

That could definitely be it. Is it a Pi 3? With a usb device attached, it probably definitely needs 2.5amps. I can see how it might drop usb to utilize the power best.

It's a Pi Zero W. Exchanged the power supply now so will check it again tomorrow.

Sadly, changing the power supply didn't have any effect. It crashed again. Next step, replace the RFID reader 👍

Status update: Everything is working fine now after changing the card reader, so you can close this issue. Thank you so much for the help and for this über cool project :)

Thanks so much for following up!