Files
bipbipzizik/README.md
2019-07-09 14:41:50 +02:00

3.8 KiB

RFID Cards Trigger

This project is a fork of Music Card from hoveeman/music-cards forked from fsahli/music-cards.

It has been updated to be able to trig actions on others servers on rfid swipe. List of actions:

Requires

software:

  • python pip. To install:
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install python3-pip

  • python evdev. To install:
sudo pip3 --default-timeout=1000 install evdev

--default-timeout=1000 helps if the raspberry is too slow

hardware:

Remark : see on original project https://github.com/hoveeman/music-cards for printable rfid cards

####Raspberry Limitaion Please note that Raspberry Pi Zero is insufficient to run both the Home Assistant and and the rfid scanner. It is recommend you use a Raspberry Pi 3 if you intend to run both at the same time.

Test has to be done with node-sonos-http-api and rfid scanner, they should run together on all raspberry.

#####Raspberry Config Config the wifi on boot partition

Steps to Configure and/or Run once without AutoStart

  1. Copy/Downloar/Clone the project in home/pi
  2. Run python3 setup_reader.py to select the reader from the inputs
  3. Run python3 add_card.py to scan cards and enter your Google Play Music Playlist Name
  4. Make .sh scrypts executables : chmod +x sonosplay.sh
  5. Run python3 box.py to start the application and verify that it is reading your cards and csv list properly

Install Service to AutoStart

  • Change directory to music-cards/
cd music-cards/
  • Copy the musiccards.service file to systemd
sudo cp /home/pi/music-cards/musiccards.service /etc/systemd/system/musiccards.service
  • Reload the Daemon
sudo systemctl daemon-reload
  • Start the musiccards.service
sudo systemctl enable  musiccards.service
sudo systemctl start musiccards.service
  • Check if musiccards.service is running
sudo systemctl status musiccards.service
  • Restart service after file update
sudo systemctl restart musiccards.service

HomeAssistant Setup for Google Music

TO BE CHECKED

  1. Add the configs from homeassistant_files in the config of your Homeassistant.
  2. You will need to create custom_components/switch directory in your config directory and place gmusic.py in there.
  3. Follow this forum post to install gmusicapi, find your device id, and set up the component.

For Dev

Unit test

Run all unit test of the project

python -m unittest discover -p "*_test.py"

Run unit test with coverage on it

Specific file:

coverage run xxx_Test.py

All unit test:

coverage run -m unittest discover -p "*_test.py"

Generate coverage report

coverage erase
coverage run -m unittest discover -p "*_test.py"
coverage report --omit "*_test.py"
coverage html --omit "*_test.py"