Scripts that allows to use Ezviz smart WiFi plugs in dockerized Home Assistant.
- Template switch in
template_switch.yaml
is defined to send mqtt message onhome/mqttr/control
topic. - Daemonized bash script
mqttr-receiver
executesmosquitto_sub
which listens for /home/mqttr/# messages and pass payload to python script. - Python script
mqttr.py
is checking payload and sends it to a module given inserve
variable (for nowezviz-plug
only, but you can add more for your own purposes). - Python script
ezviz-plug.py
when executed frommqttr.py
is changing the state of plug but when executed from cron is updating Home Assistant sensors defined inmqttr_sensor.yaml
by sending mqtt message tohome/plug/QXXXXXXXX
Linux server with Python 3.10+, Mosquitto server, pyEzviz, Home Assistant, MQTT integration in HA, smart plugs added to your Ezviz account.
- Copy
mqttr
folder to/usr/local/bin
. - Edit
mqttr.conf
and provide your mosquitto server user and password. - Edit and copy template switch and mqtt sensor definitions from
homeassistant/*.yaml
to HA configuration - Edit
inc/ezviz_config.py
and change your Ezviz account user, password and plugs device serial number list. - Use
mqttr-receiver
as systemd service to receive mqtt messages from HA. Service file is insystemd/mqttr.service
and should be copied to '/lib/systemd/system`. Remeber to reload systemd, enable service and start it. - Use cron to execute
inc/ezviz-plug.py
to check plugs status.
Look into files and directories and you'll figure it out. ;)