Connects a MQTT message broker to a LIRC infrared device
256
Connects a MQTT message broker to a LIRC infrared device. Up to now, it can just send codes using 'irsend'.
-v /var/run/lirc/lircd:/var/run/lirc/lircdThis lirc2mqtt service can just send IR commands. For that it's listening to one MQTT-topic for each of your remotes defined in lirc:
lirc/\<nameOfRemote\>/send
To send an key send a message to the corresponding MQTT-topic. You can try it using the commandline clients from mosquitto-clients:
mosquitto_pub -h localhost -t "lirc/\<nameOfRemote\>/send" -m '{ "send":"once", "commands": ["cmd1", "cmd2", "cmd1"] }'
mosquitto_pub -h localhost -t "lirc/\<nameOfRemote\>/send" -m '{ "send":"hold", "time_msec":"1500", "commands": ["vol_up"] }'
The second will send the command for 1.5 seconds.
This service can not recive commands from a IR-remote.
cd /opt
git clone https://github.com/orbifly/lirc2mqtt.git
cd ./lirc2mqtt/
docker build -t lirc2mqtt .
#On your host, create a folder for a config file
mkdir /opt/config_lirc2mqtt
#Start the continer once
docker run --name my_lirc2mqtt -v /opt/config_lirc2mqtt:/data lirc2mqtt
#Stop the container after some seconds
docker container stop my_lirc2mqtt
#Now there is a file /opt/config_lirc2mqtt/lirc2mqtt.config
#Edit this file to fit your requirements
nano /opt/config_lirc2mqtt/lirc2mqtt.config
#Now the container is ready to run
docker run --name my_lirc2mqtt -v /opt/config_lirc2mqtt:/data -v /var/run/lirc/lircd:/var/run/lirc/lircd lirc2mqtt
Create a docker-compose.yml or extend a existing one. Add the following lines if you build the container as described above.
lirc2mqtt:
image: "lirc2mqtt"
volumes:
- /opt/config_lirc2mqtt:/data
- /var/run/lirc/lircd:/var/run/lirc/lircd
restart: always
This project fits to ct-Smart-Home. A container is available on Docker Hub, so you just have to add the following lines to docker-compose.yml
lirc2mqtt:
image: "orbifly/lirc2mqtt:latest-armv7"
volumes:
- ./data/lirc2mqtt:/data
- /var/run/lirc/lircd:/var/run/lirc/lircd
restart: always
I started in 2020 with the ct-Smart-Home and some zigbee devices. Now it is grown including MPD and Lirc. A lot of good stuff I found in this article and some related. My smartphone is invlolved by Tasker and M.A.L.P. as frontend for MPD. My desktop frontend for MPD is Cantata. When the music player is started, lirc enables my amplifier - it's a Harman/Kardon AVR2000 in use since 2000.
Content type
Image
Digest
sha256:abbd74895…
Size
138.5 MB
Last updated
about 3 years ago
docker pull orbifly/lirc2mqtt:latest-armv7