Code Monkey home page Code Monkey logo

zemirollshade's Introduction

Zemismart Roller Shade Integration

This is a Python script to connect a Raspberry PI to a Zemismart Roller Shade. It listens to an MQTT topic and executes a close or open command based on that topic.

Requirements

  • Python 3+
  • pip (to automatically install python dependencies)

Dependencies

  • paho-mqtt
  • bluepy
  • Zemismart
  • libglib2.0-dev sudo apt-get install libglib2.0-dev

Install

  1. Download or clone the repository:
  2. In the directory run pip install -r requirements.txt
  3. Configure details in rollshade.py and then run with python3 rollshade.py

Home Assistant Config

Just add a MQTT cover:

...
cover:
  - platform: mqtt
    name: "Blinds Bedroom"
    state_topic: "blinds/02:86:FA:AF:DD:9C/status"
    command_topic: "blinds/02:86:FA:AF:DD:9C"
    position_topic: "blinds/02:86:FA:AF:DD:9C/position"
    set_position_topic: "blinds/02:86:FA:AF:DD:9C/set_position"   
    position_open: 0
    position_closed: 100    
    qos: 0
    state_open: "on"
    state_closed: "off"
    payload_open: "open"
    payload_close: "close"
    payload_stop: "stop"
    retain: false
    optimistic: false

Запускать при загрузке системы

Создайте файл

sudo nano /lib/systemd/system/rollershade.service

Добавьте в этот файл следующие строки:

[Unit] 
Description=Rollshade 
After=multi-user.target
 
[Service] 
Type=simple 
ExecStart=python3 /home/alex/blinds/zemirollshade/rollshade.py 
Restart=on-failure

StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=roll
 
[Install]
WantedBy=multi-user.target

Теперь нам нужно активировать сервис:

sudo chmod 644 /lib/systemd/system/rollershade.service
chmod +x /home/pi/zemirollshade/rollshade.py
sudo systemctl daemon-reload
sudo systemctl enable rollershade.service
sudo systemctl start rollershade.service

zemirollshade's People

Contributors

ccmtozzi avatar stcbus avatar codeitnos avatar gylletanken avatar eriknl1982 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.