Skip to content

eresgit/mqt_hook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mqt_hook

A home automation switch augmented with Home Assistant MQTT discovery protocol.

Prerequisites

System Dependencies

sudo apt-get install libjson-c-dev libpaho-mqtt-dev

Build Dependencies

sudo apt-get install build-essential libssl-dev cmake gcc make cmake-gui cmake-curses-gui libssl-dev doxygen graphviz

Optional Dependencies

For UPnP functionality:

sudo apt-get install miniupnpc

Building

Compile the project using:

gcc -o mqt_hook mqt_hook.c config.c -ljson-c -lpaho-mqtt3c

Service Setup

  1. Create a systemd service file:
sudo nano /etc/systemd/system/mqt_hook.service
  1. Add the following content to /etc/systemd/system/mqt_hook.service
[Unit]
Description=MQTT Hook Service
After=network.target

[Service]
Environment="MQTT_HOST=your_mqtt_host"
Environment="MQTT_USERNAME=your_username"
Environment="MQTT_PASSWORD=your_password"
ExecStart=/home/pi/c/mqt_hook/mqt_hook
WorkingDirectory=/home/pi/c/mqt_hook
Restart=always
RestartSec=30
User=pi
Group=pi
Environment="LD_LIBRARY_PATH=/usr/local/lib"
StandardOutput=journal
StandardError=journal

[Install]
WantedBy=multi-user.target

Note: You can optionally specify a config file path: /home/pi/c/mqt_hook/config.json

Service Management

Check service status:

sudo systemctl status mqt_hook.service

Restart service:

sudo systemctl restart mqt_hook.service

Monitoring

View service logs:

sudo journalctl -f -n 100 | grep mqt_hook

About

a augmented switch implemented with the home assistant mqtt discovery protocol

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages