This is a pythons script to connect an Raspberry PI to an Zemismart Roller Shade, it’s listen to an MQTT topic and execute a close or open command based on that topic.
The Zemismart Roller shade are great and have a good price (Thanks @TheHookUp video I discovered them!), but they only have bluetooth connection! this script help integrate them to HA using a Raspberry PI (I’m currently using a cheap RPi W). This is my first “public” script and so far has been a long journey to make it work!! My programming skills are kind of limit, but with a lot of copy/past and google I made it happen!!
Where do I get it??
Here is the link to this github project link! First time using github, so hope I don’t mess up too much… like I did uploading my password in there last week!
- Download or clone the repository:
- In the directory run
pip install -r requirements.txt
- Configure details in
rollshade.pyand then run with
In HA you can add some switch with each one of the shades, just add this:
cover: - platform: mqtt name: "Blinds Bedroom" state_topic: "blinds/00:00:00:00:00:00/status" command_topic: "blinds/00:00:00:00:00:00" qos: 0 state_open: "on" state_closed: "off" payload_open: "open" payload_close: "close" payload_stop: "stop" retain: false optimistic: false
- Get information from the Shade (battery, state, etc…), currently it’s just sending command, for open and close.
ESP32 version - Would prefer to run this in a ESP32 instead of a Raspberry PISomeone already did a great job doing this!! https://github.com/buxtronix/am43
- Since I can’t get information on current state and home assistant start with Off, if the shade is Open (On) you need to rapidly click the button twice to make it close and sync the state.
Run on boot
- In case someone is interested, just used did the following steps to run the script as service so it starts when reboot:
sudo nano /lib/systemd/system/rollershade.service
Add the following lines into that file:
[Unit] Description=Rollshade After=multi-user.target [Service] Type=simple ExecStart=/usr/bin/python /home/pi/zemirollshade/rollshade.py Restart=on-abort [Install] WantedBy=multi-user.target
Now we need to active the service:
sudo chmod 644 /lib/systemd/system/rollshade.service chmod +x /home/pi/zemirollshade/rollshade.py sudo systemctl daemon-reload sudo systemctl enable rollshade.service sudo systemctl start rollshade.service