Open samnewman86 opened 3 years ago
Firstly outstanding work here @alexpilotti. This is exactly what I was hoping to find or create!
@samnewman86 I'm about to embark on this journey myself having just fitted a Mira Mode shower and bath filler. One train of thought is for this library to post updates to MQTT and also receive command updates via MQTT that way you'd have control of the unit via Home Assistant too but this would only work if the shower/bath was always operated from this library. The app does update if the unit is controlled manually so it's likely there are some BLE updates that could be sniffed for continuous status. I'll clone this great work in the coming weeks and have a play.
@samnewman86 @jcallaghan thanks!
Is it possible to enable a sensor in home assistant using this library so that I can detect if the shower or bath is running? Thanks
Yes, just call miramode. get_state(address)
It will return the state if both outlets, I still have to add it to the README, sorry!
Firstly outstanding work here @alexpilotti. This is exactly what I was hoping to find or create!
@samnewman86 I'm about to embark on this journey myself having just fitted a Mira Mode shower and bath filler. One train of thought is for this library to post updates to MQTT and also receive command updates via MQTT that way you'd have control of the unit via Home Assistant too but this would only work if the shower/bath was always operated from this library. The app does update if the unit is controlled manually so it's likely there are some BLE updates that could be sniffed for continuous status. I'll clone this great work in the coming weeks and have a play.
This is exactly what I’m working on at the moment: a Home Assistant WaterHeater component that controls remotely via MQTT the Miramode outlets.
The way I use it ATM, is a Home Assistant switch that runs remote SSH commands. It works very reliably, but the temperature is defined in the script, with slight changes based on the external temperature and season, eg in summer I prefer slightly colder showers compared to winter.
The hardest part of the work in this library was about finding out the CRC style algorithm they use to validate the write commands for turning on/off the outlets. This requires a 16 bits Id (I called it client_id), which is most probably assigned during the device pairing. For the moment, I just retrieve the client_id by sniffing the BLE packets between the phone app and the Miramode device, doing the brute force math until I get a match. Since the id is 16bit, it is very quick.
If by any chance you have time, reversing the pairing between the app and the device would be great, as that’s the last missing piece to get the client_id, without a BLE sniffer.
A brief update on this thread, since now we have a (near) complete protocol implementation, the next step consists in implementing a full HA sensor
Is it possible to enable a sensor in home assistant using this library so that I can detect if the shower or bath is running? Thanks