Magic Cards - Queue music, play movies, or trigger events with RFID cards

Sorry I have tried it with sudo and without on the docker install when I try to clone the repo I get the following message. Many thanks for your help

pi@raspberrypi:~ $ git clone [email protected]:maddox/magic-cards-docker.git
Cloning into ‘magic-cards-docker’…
The authenticity of host ‘github.com (140.82.118.3)’ can’t be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘github.com,140.82.118.3’ (RSA) to the list of known hosts.

[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
pi@raspberrypi:~ $

Clone & Set Up Configs

Clone down the repo.

git clone [email protected]:maddox/magic-cards-docker.git

Cloning github is NOT part of the docker instructions!

Docker Install
Docker Stars Docker Pulls

Installing using Docker is the easiest path. You'll need to make sure you have Docker installed on your Pi first.

Install Docker
Installing Docker is as easy as a couple of commands:

curl -sSL https://get.docker.com/ | sh
If you are using a Raspberry Pi Zero W, there is an issue with Docker 18.09.1 that prevents Docker from properly installing. The current workaround is to downgrade to Docker 18.06.1, by using the following command:

sudo apt-get install docker-ce=18.06.2~ce~3-0~raspbian
Once it's installed, run this command so your pi user can use Docker.

sudo usermod -G docker pi
Log out of your Pi and back in so your user has permissions to use Docker.

Create Configuration
To run the Docker container, you need to do a couple things first. Create a directory for it to run in, set up your configuration, and then run the command to load up the container.

cd ~/
mkdir magic-cards
cd magic-cards
mkdir config
cd config
After that, you should be in the config directory. Read the standalone docs to learn how to configure Magic Cards. While you read that, you may want to pull down the image because this takes a while (docker pull jonmaddox/magic-cards)

Run Container
Once you've set up your configuration, navigate back to the magic-cards directory and load the Docker container:

cd ~/magic-cards
docker run \
  --name magic-cards \
  --restart=always \
  -d \
  -p 5000:5000 \
  -v `pwd`/config:/usr/src/app/config \
  --device=/dev/input/event0 \
  jonmaddox/magic-cards
This will download the image (if not already present), and create and run the container on port 5000 with the config directory you specified so it knows how to run. You may need to edit the device param to properly map to the input device Magic Cards will be reading from for your card reader. You can read about that in the standalone docs.

After that, the container will start up. It may take a little bit. It's just a little Raspberry Pi after all.

sorry I had been following this https://github.com/maddox/magic-cards-docker

pi@raspberrypi:~ $ mkdir magic-cards
pi@raspberrypi:~ $ cd magic-cards
pi@raspberrypi:~/magic-cards $ mkdir config
pi@raspberrypi:~/magic-cards $ cd config
pi@raspberrypi:~/magic-cards/config $ docker pull jonmaddox/magic-cards
Using default tag: latest
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.40/images/create?fromImage=jonmaddox%2Fmagic-cards&tag=latest: dial unix /var/run/docker.sock: connect: permission denied
pi@raspberrypi:~/magic-cards/config $

Following the other install and still get the permission refused I have enabled the user and logged out but I will fully check my end many thanks

If you can’t run docker commands, you probably forgot this step

sudo usermod -G docker pi

followed by log out and back in. To make sure you are in the docker group run

id

pi@raspberrypi:~ $ sudo usermod -G docker pi
pi@raspberrypi:~ $ id
uid=1000(pi) gid=1000(pi) groups=1000(pi),995(docker)
pi@raspberrypi:~ $ git clone [email protected]:maddox/magic-cards-docker.git
Cloning into ‘magic-cards-docker’…
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
pi@raspberrypi:~ $ pi@raspberrypi:~ $ sudo usermod -G docker pi
pi@raspberrypi:~ $

Many thanks for your help I have done that step and numerous re installs of the os etc but no joy.

git is not a docker command. I told you how to fix docker.

Moving on to git, try

git clone  https://github.com/maddox/magic-cards

Many thanks, I have gone through the steps no probs with Docker it was the step in the tutorial step 4 https://github.com/maddox/magic-cards-docker I have tried on two different systems and networks but seems to be a permission issue.

OK so it works now?

No Sorry no it does not work I have tried to get it going but have the permission error. I cannot download part 4 on the tutorial. I have left it now and will try again in a few days but cannot get pass the permission issue. I have loaded a new sd card different networks etc. Updated my keys etc but I just cant get it to download. Thanks for your help.

Did you try the git clone command I gave you in this post? Magic Cards - Queue music, play movies, or trigger events with RFID cards

Hi yes I did sorry and same problem, I have managed to get it sorted through another program I have used the esprfid progam and a 8266 and MC522 and home assistant and have it all working now many thanks.

Hi,

does anyone use Magic Card with SSL encryption? For me it only works without encryption.
How is your config?

It works!

{
  "Home Assistant": {
    "type": "home_assistant",
    "host": "IP",
    "port": "8123",
    "ssl": true,
    "verify_ssl": false,
    "token": xxxxxxxxxxxxxxxxxx
    },

Does your project work on a x86 based host? Or just on Raspberry Pi?

Anybody knows about addons architecture? Log says: "standard_init_linux.go:211: exec user process caused "exec format error" on my HP thin terminal.

Do you know maybe how to write an automation in Home assistant, that a specific song will trigger a specific action?
like:
trigger:

  • platform: event
    event_type: magic_card_scanned
    event_data:
    card_type: song
    media_content_id: “{{ trigger.event.data.card_uri }}”
    action:
    if card_uri 1:
    • action1
      if card_uri 2:
    • action2
      .
      .
      .

You could use a condition, but you’ll need to duplicate your automations AFAIK

condition:
    condition: template
    value_template: "{{ 'something-you-need' in trigger.event.data.card_uri }}"

Hi .

Having problems getting Magic Cards and Hassio working together.

I’ve got a freshly installed a PiZero and using the guide to install Magic Cards in docker.

I’ve created the follow json files
actions.json


{
  "type": "home_assistant",
  "host": "192.168.x.x",
  "port": "8123",
  "ssl": false,
  "verify_ssl": false,  
  "password: "mypassword"
}

(I’ve also tried "token: “mylonglivedtoken)”

config.json

{
  "room": "Living Room",
  "input_device": "event0",
  "spotify": {
    "clientID": "myid",
    "clientSecret": "mysecret"
  }
}

I’m not sure I understand what I need to do for Home Assistant side of things? I know I will have to create an automation but do I need to create an entity or install a plugin or even add to the config.yaml?

On my PiZero magic cards loads and i can see the web interface on port 5000.
I’ve created card for testing.

using the docker logs --timestamps --follow magic-cards
i can see the following error when i read a card

2020-10-31T16:30:59.362811777Z [1] undefined:7
2020-10-31T16:30:59.364317723Z [1]   "password: "myPassword"
2020-10-31T16:30:59.387236901Z [1]                 ^
2020-10-31T16:30:59.388680849Z [1]
2020-10-31T16:30:59.388894841Z [1] SyntaxError: Unexpected token P in JSON at position

I get the same error if I’m using the token and it points to a random letter.

Any help would be greatly apricated.
Many Thanks

Also noticed if I create a card I can’t fill in the action field. Its just blank.

Thanks

In the docs I see “token” is preferred over of “password”. Maybe “password” doesn’t work anymore with latest HA. MagicCards docs is from feb 2019, so a lot has changed on HA side. You can create a Long-Lived Access Token on the profile page. I have configured it using a token.

I’m not sure I understand what I need to do for Home Assistant side of things? I know I will have to create an automation but do I need to create an entity or install a plugin or even add to the config.yaml?

On the HA side you only need to capture the event magic_card_scanned.
See Dev Tools > Events
image