enesbcs / shellyteacher4domo

Shelly device teacher for Domoticz MQTT Autodiscovery hardware
Apache License 2.0
10 stars 4 forks source link
domoticz mqtt shelly

[Release downloads]() [Code size]() [Last commit]()

ShellyTeacher 4 Domoticz

Shelly device teacher for Domoticz MQTT Autodiscovery hardware

You need to understand before installation:

If you got a message "template not found" when teaching, than either your database is outdated/corrupted or your device is not supported. Please try to download latest *.txt files from github, before reporting issues.

How it works

When this program started it connects to the MQTT server and awaits for Shelly device announcements. Domoticz MQTT Autodiscovery hardware has to be enabled and Shelly devices has to connect to the same MQTT broker, as the Domoticz and this program.

How to install

A. Please use the precompiled windows binary if you are not familiar with Linux: https://github.com/enesbcs/shellyteacher4domo/releases

The Teacher can be run on ANY machine on the network, which accessing the MQTT IP addres, does not need to run on the Domoticz server directly!!!

B. For Linux users for any platform capable of running python3:

-Install git (Debian/Ubuntu if user has root right)

apt install git

-OR install git (Debian/Ubuntu if user has sudo right)

sudo apt install git

-Download application with git

git clone https://github.com/enesbcs/shellyteacher4domo.git

-Run the installation script first, and only once (which will deal python venv)

cd shellyteacher4domo
./preinstall.sh

-If installation was succesful, ShellyTeacher now can be run from the venv named 'paho' with this command:

./run.sh

In case you want to save the configurations after rebooting, please make sure that MQTT broker persistence settings configured correctly!

If you are unable to install or run the program, please download the windows binary! ˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇ

Windows and Linux x64 binary builds published and can be downloaded from releases: https://github.com/enesbcs/shellyteacher4domo/releases

A GUI is also available when TKInter works, this is the default now, Console mode can be requested by specifying -c parameter at the command line!

Youtube tutorial

HINT: If you have to add multiple Shelly devices to MQTT, you can use Shelly Scanner app to set MQTT on them.

How to update the program

First: backup your templates.txt files if you modified it, than:

git pull

How to use

  1. Edit settings.py file with a plain text editor, and set MQTT server IP address. If discovery prefix is leaved as default 'homeassistant' on the Domoticz MQTT AD hardware, than other settings will fine.
  2. Make sure that the Shelly device connects to the same MQTT broker IP address.
  3. Start Teacher
    cd shellyteacher4domo
    ./run.sh
  4. Power Shelly device or restart it
  5. If Teacher finds the device ID in the mqtt_templates.txt, those will be automatically forwarded for the Discovery topic, and as the default publish method is 'RETAIN', it will survive reboot, and Teacher application is not needed to run, until you wants a new Shelly device to be installed

(In case of Gen2/Gen3 device, the device has to be started before the Teacher, and make sure to enable "Generic status update over MQTT" at MQTT settings page)

Windows and Linux x64 binary builds published and can be downloaded from releases: https://github.com/enesbcs/shellyteacher4domo/releases

A GUI is also available when TKInter works, this is the default now, Console mode can be requested by specifying -c parameter at the command line!

Implemented devices

Gen1:

Gen2:

Gen3: (Experimental! needs feedback!)

Known problems with devices