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

the 401 is caused because I couldn’t find out how to add the token in the Chrome extension. I only send a empty POST request to the home assistant api. It was just to test if the api was ‘listening’.

Just created a new token, double checked admin rights. Same behavior.
Tried to add api: to home assistant configuration.yaml, no effect. Tried to remove my base_url on the http: component, no effect.

I’ll think about it over night :slight_smile: Maybe I can come up with something different to try.

Got it!

for me (using nginx reverse proxy) magic-cards only worked not using my local IP, but using the external URL:
actions.json:

{
  "Home Assistant": {
    "type": "home_assistant",
    "host": "MYURL",
    "port": "443",
    "ssl": true,
    "verify_ssl": true,
    "token": "MYTOKEN"
  }
}

Now getting my automations right and modifying my selfmade reader to fit in the raspberry and the reader:

Thanks Maddox!

I am triying to install via the docker intructions and coming up with
sudo 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.

any ideas ??

I don’t see that command in the docker instructions.

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
      .
      .
      .