Getting water/energy data from shower head


I have an Oras digital shower head, which can give some information about the consumption of water and energy - but I have some challenges on figuring out how to create the sensors and build some of the logic…

Data is fetched upon a BLE connect and a service/characteristic notification…
The notification comes several times per second when water is flowing through the showerhead…

I can get data like:

[20:37:07][D][sensor:127]: 'dsh_lastBathTemp': Sending state 31.00000 C with 1 decimals of accuracy
[20:37:51][D][sensor:127]: 'dsh_totShowers': Sending state 45.00000 # with 1 decimals of accuracy
[20:37:54][D][sensor:127]: 'dsh_lastBathkWh': Sending state 2.29000 kWh with 1 decimals of accuracy
[20:37:56][D][sensor:127]: 'dsh_lastBathLiter': Sending state 58.00000 L with 1 decimals of accuracy

Where some values are updated multiple times per second… Very handy, if you want to create a graph per shower,

I am more interested in just getting the last data - meaning the last numbers recorded …
The catch is, that the BLE connection can be disconnected if water stops flowing through the shower head (if you stop the water to apply soap/shampoo), and then starts the shower again (typically within 2 minutes).

Also, it will be nice to have statistics about the length/duration of the shower (approx time), which I cannot grab via BLE (I have not found the information yet) - so it will be something about staging/comparing timestamps…

Any hints on to solve this ?

Let me know if the yaml file for the ESP32 device is needed …


Just a few random ideas that may help you get started/thinking…

I guess you’ll need a sensor for “time since last sensor update” for determining the end of a shower.

Maybe you could create a “count up timer” in ESPHome using interval which you reset to 0 every time a new value comes in?

Then if the time since last update is more than X min you assume the shower is finished and publish last values to a template sensor as end-of-shower values?

You’d need shower start time too. Perhaps you push some values using on_value_range (above 0.5L?). And/or kick off a timer somehow too?

Perhaps you can determine when then shower is on based on the stream of data? Turn on a binary sensor when any value comes in with a delayed off so it stays on between updates?

Thanks for the input - I managed to cook something together, now I just need to fine-tune it, in order to get a more accurate total shower time…
Output so far:

[07:28:30][D][sensor:127]: 'dsh_lastBathkWh': Sending state 0.14000 kWh with 2 decimals of accuracy
[07:28:30][D][sensor:127]: 'dsh_lastBathTemp': Sending state 32.00000 °C with 1 decimals of accuracy
[07:28:30][D][sensor:127]: 'dsh_lastBathLiter': Sending state 4.30000 L with 1 decimals of accuracy
[07:28:30][D][sensor:127]: 'dsh_lastBathM3': Sending state 0.00430 m³ with 5 decimals of accuracy
[07:28:30][D][sensor:127]: 'dsh_ShowerTimeSeconds': Sending state 23.00000 s with 1 decimals of accuracy