Coder Social home page Coder Social logo

python-vesync-to-mqtt's Introduction

python-vesync-to-mqtt

python script to bridge between mqtt and vesync devices.

This allows MQTT dashboard apps or Home Automation systems like iobroker to control vesync air purifiers via MQTT. Air purifier status updates are detected and published retained via MQTT.

This is not a binding for iobroker, but a standalone script.

State

This script is in a usable state and currently deployd to my home automation system.

But: it currently only supports the functionalty I actually need.

Might be expanded in the future to support more devices and features, feel free to contribute.

Prerequisites:

  • python 3.
  • pip3 install paho-mqtt
  • pip3 install pyvesync

Configuration

You need to create an ini file named python-vesync-to-mqtt.ini specifiing all needed credentials.

The ini file is excluded via .gitignore

[vesync]
username=<username of vesync account>
password=<password of vesync account>
timezone=<your timezone, for example Europe/Berlin>

[mqtt]
brokerip=<ip address of your broker>
brokerport=<port of your broker, defaults to 1833 if not set>
brokerauth=<does the broker require auth? (username/passwort only supported by now)
username=<broker username>
password=<broker password>
clientid=<a unique client id. will default to python-vesync-to-mqtt if not set.>
roottopic=<the root topic the script will subscribe and publish to. defaults to vesync if not set>

Starting and stopping

General usage

  • start the script as usual: python3 python-vesync-to-mqtt.py
  • stop the script using ctrl+c

Using the script as a background task in linux (continue running after user logout)

  • make the script executable
  • start the script using nohup ./python-vesync-to-mqtt.py >/dev/null 2>&1 &
  • stop the script using ps -fA | grep python to get the PID and kill PID to stop the script

Usage

The script connects to the specified vesync accound and gets a list of active devices. It then starts monitoring these devices and posts status updates via mqtt. Currently only Levoid Air Purifiers are supported.

device status information

topics are build following the schema <root-topic>/<Device Name>/#

subtopic information payload values
level fan speed 1, 2, 3
mode device mode sleep, manual, auto
combined see below 0, 1, 2, 3

setting values

This script follows the style of espurna devices. To set a value, attach /set to the topic.

For example to activate sleep mode, send payload sleep to <root topic>/<device name>/mode/set.

the combined setting

combined is a calculated value. It's an extension to the fan speed using speed 0 to indicate sleep mode.

So if a purifier is set to fan speed 3 and sleep mode, combined will read 0 while level will read 3

This allows to use only one widget in your favorite MQTT control app to switch between for example sleep mode and fan level 3.

python-vesync-to-mqtt's People

Contributors

sychron avatar

Watchers

 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.