dave-code-ruiz / uhomeuponor

Custom Component to connect Home Assistant with Uhome Uponor Smatrix App
MIT License
19 stars 7 forks source link

Battery alarm not updating if battery is empty #36

Open onsmam opened 3 months ago

onsmam commented 3 months ago

Hi,

today i discovered that 2 of my thermostats have low battery's but in homeassistant the battery_alarm attribute stay's 0 also checked where the fault is (i think) after some reverse engineering of the uponor api found;

That the formula for battery alarm is "101 + (500 * "controller") + (40 * "thermostat") which is correct (if im reading correct your using an offset of 80 + address 21 = 101) in the custom_components/uhomeuponor/uponor_api/const.py

i think the script is trying to read property 85 of the address defined by the formula above. but it needs to read property 662. i have no python skills to make a pull request to you git... i've checked it via a shell script, with the following line:

battery=$(curl -s "http://$uhomeip/api" --data-binary '{"jsonrpc": "2.0", "id": 8, "method": "read", "params": {"objects": [{"id": "'$battery'", "properties": {"662": {}}}]}}' | jq -r '.result.objects[0].properties["662"].value')

which gave me the battery warning on the empty thermostats. is it possible without to many hassle to add this in the code?

thanx!

raympie commented 3 months ago

@dave-code-ruiz I have the same issue. Hope this can be fixed! TIA

dave-code-ruiz commented 3 months ago

I test all you say , and it is correct

I dont know why , for values technical_alarm, tamper_indication, rf_alarm and battery_alarm need 662 property instead of 85

Im trying to solves it

dave-code-ruiz commented 3 months ago

please @onsmam and @raympie test changes in 1.3.3 version y havent battery alarms in my uponor system

onsmam commented 3 months ago

yes! working! thanx for the quick fix!

dave-code-ruiz commented 3 months ago

Great! , please dont close issue because i want to develop new state sensor or binary sensor with state alarm can get states "battery alarm, technical_alarm, tamper_indication, rf_alarm, remote_access_alarm or device_lost_alarm

raympie commented 2 months ago

Works! Great! Thank you very much!