GithubHelp home page GithubHelp logo

kamaradclimber / hydrao-dump Goto Github PK

View Code? Open in Web Editor NEW
6.0 3.0 3.0 651 KB

A simple script to send data from hydrao shower head to Home Assistant through an MQTT server

Python 45.22% Shell 1.08% Lua 53.70%
hydrao iot-device reverse-engineering hacktoberfest

hydrao-dump's Introduction

This repository contains a standalone script to connect an Hydrao shower head to Home Assistant via MQTT. It also contains a work-in-progress wireshark dissector for the hydrao protocol.

๐Ÿ’ก Adizanni developed an integration for Home Assistant which should be usable.

Requirements

  • Home Assistant and a MQTT server
  • a bluetooth adapter
  • the mac address of the hydrao shower head
  • python >= 3.7

How-to

pip install -r requirements.txt
export MQTT_SERVER=1.2.3.4
export MQTT_PORT=1883
export MQTT_USER=my_user
export MQTT_PASSWORD=abcdef
python ./receiver.py shower_head_mac_address

I'm running this script as a long running systemd service on a raspberry 2 located next to the bathroom.

Credits

Code has been built my copy-pasting multiple existing scripts found to interact with bluetooth devices. If you recognize your code, drop me a note, I'll credit you.

Other files

I've done a few dumps from the exchange between my first (and then my second) shower head and my phone while using the app. All the .log, .pcap and .pcanpng files are those dumps. The latter is commented with my first findings. Open them with the wireshark dissector to get my current understanding of the protocol.

Decoded fields:

  • volume of current shower
  • volume of the last x showers
  • color and thresholds
  • firmware and hardware versions
  • shower head device id

Undecoded fields: temperature and water flow.

Some help from internet wisdom

In french: https://community.jeedom.com/t/plugin-blea-hydrao/11622/36

hydrao-dump's People

Contributors

kamaradclimber avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

hydrao-dump's Issues

Starting developing around your base code

Hello @kamaradclimber , I know that you are probably abandoning this repository, just wanted to tell you that I'm working on it right now as I'm a proud owner of a Hydrao Aloe, since yesterday. Starting from your base code I'm also using this package https://github.com/unixorn/ha-mqtt-discoverable to make it a little simpler. I'm improving on the management of the exceptions too. I'm not into decoding binary streams but I may give it a go (at least to be able to retrieve the temperature, is there maybe a default offset ?).
I had to overcome some bumps on the road (ex. the ha-mqtt-discoverable it is now requiring Python 3.10, not good for raspberries in still in debian 11).
It is working like a charm and I wanted to thank you for your effort.

After Connecting and reading -> BrokenPipeError

Hi, I also got a Hydrao Aloe and I saw your python script for conneting to it.

Do you have an idea why I can't read from the device. Trying with your script (reading the volumes) or trying with my own (for receiving the services) I always get after connecting and trying to access an "BrokenPipeError" ;-(

Have you although had issues with "BrokenPipeError"?

The Pi is round about 2,5m away from the Shower.
With Androind Phone (same distance) and using "nrf Connect" I can successful connect and read all the Services.
Unfortunatelly at the moment I can't get the Pi more nearby to the Shower :-(
But on the other side, the connecting itself seems to be successful.
Running in --dry_run mode runs successfull.
Other BLE devices can be connected and read from the same Pi.

root@Pi:/home/pi/hydrao/hydrao-dump# python3 receiver.py xx:xx:xx:xx:xx:xx
connect and read
Connecting...
Connected
Traceback (most recent call last):
File "receiver.py", line 203, in
main()
File "receiver.py", line 29, in main
connect_and_read(mqtt_client)
File "receiver.py", line 156, in connect_and_read
battery_service = hydrao.getServiceByUUID(so_called_battery_service_uuid)
File "/usr/local/lib/python3.7/site-packages/bluepy/btle.py", line 488, in getServiceByUUID
rsp = self._getResp('find')
File "/usr/local/lib/python3.7/site-packages/bluepy/btle.py", line 407, in _getResp
resp = self._waitResp(wantType + ['ntfy', 'ind'], timeout)
File "/usr/local/lib/python3.7/site-packages/bluepy/btle.py", line 361, in _waitResp
self._stopHelper()
File "/usr/local/lib/python3.7/site-packages/bluepy/btle.py", line 293, in _stopHelper
self._helper.stdin.flush()
BrokenPipeError: [Errno 32] Broken pipe
Exception ignored in: <function Peripheral.del at 0xb681b4b0>
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/bluepy/btle.py", line 630, in del
self.disconnect()
File "/usr/local/lib/python3.7/site-packages/bluepy/btle.py", line 453, in disconnect
self._writeCmd("disc\n")
File "/usr/local/lib/python3.7/site-packages/bluepy/btle.py", line 305, in _writeCmd
self._helper.stdin.flush()
BrokenPipeError: [Errno 32] Broken pipe

my bluepy is version 1.3:

root@Pi:/home/pi/hydrao/hydrao-dump# pip3 show bluepy
Name: bluepy
Version: 1.3.0
Summary: Python module for interfacing with BLE devices through Bluez
Home-page: https://github.com/IanHarvey/bluepy
Author: Ian Harvey
Author-email: [email protected]
License: UNKNOWN
Location: /usr/local/lib/python3.7/site-packages
Requires:
Required-by:

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.