Git Product home page Git Product logo

domoticz_blueconnect's Introduction

domoticz_blueconnect

Introduction

The goal of this code is to query the temperature, pH, and chlorine levels from the Blueriiot Blue Connect pool sensor (https://www.blueriiot.com/), and to update Domoticz (https://domoticz.com/) with the queried data.

Marcel van der Veldt (@marcelveldt) already wrote a very elegant python library for communicating to the Blue Connect web server: https://github.com/marcelveldt/python-blueconnect. His library uses data classes to hold the sensor data and async calls, which is generally speaking a very nice design for many purposes. One pitfall with this design is that when the manufacturer of the sensor decides to change their JSON data model (which they may do at any given time as it is an internal api), the python code and the JSON model are out of sync, and the library does not work anymore. And exactly this seems to have happened at the time I checked out the library (August 2022). Of course it is possible to update the data models in the library, but this comes at some maintenance costs.

Therefore, I have decided to take a far simpler approach; A single file with procedural functions (no classes) that directly uses the JSON output of the REST calls to the blueconnect web server. Also, for a single threaded process that does nothing more than updating the sensor information, the asynchronous io calls are not necessary.

Credits

The __get_credentials and __get_data functions where directly copied from https://github.com/marcelveldt/python-blueconnect and only slightly modified. Also, I used https://github.com/LordMike/MBW.Client.BlueRiiotApi to help me figuring out the correct REST calls to the Blue Connect web server.

Usage

First make sure you have the aws-request-signer python package installed:

pip3 install aws-request-signer

Then you will need to create dummy hardware in Domoticz: https://www.domoticz.com/wiki/Dummy_for_virtual_Switches. Create the following virtual sensors:

  • A temperature sensor
  • A custom sensor for pH
  • A custom sensor for chlorine

Note down the idx for these virtual sensors. Then put domoticz_blueconnect.py python script in /domoticz/scripts/python/ folder and update in the script the following global variables:

  • _user = '[email protected]' #login user name for blueconnect app
  • _passwd = 'YourPassword' #login user password for blueconnect app
  • _domoticz_idx_temp = 523 #Domoticz idx for pool temperature sensor
  • _domoticz_idx_ph = 524 #Domoticz idx for pool pH sensor
  • _domoticz_idx_chlorine = 525 #Domoticz idx for pool chlorine level sensor

Finally configure e.g. crontab to call the python script at regular (e.g. hourly) intervals:

crontab -e

with an entry like:

0 * * * * /home/pi/domoticz/scripts/python/domoticz_blueconnect.py

domoticz_blueconnect's People

Contributors

dannyruijters avatar

Stargazers

 avatar  avatar  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.