Closed Tomobikimn closed 2 years ago
Hi, thanks for logging this, I really should check on here more than I do :-) So thanks for also posting this on the Community as well. I expect this will be related to the introduction of the Leaf Sensor messing with the case statements and detecting battery levels for other sensors. I'll look to make the change you suggested and get the user with the leaf sensor to also test the change.
Hopefully that latest version will fix the WH31 battery readings. Give it a go and let me know the results. Thanks for your help on this.
As I have reported on the Hubitat forum the WH31 is reading the battery as "0" when it is good and "100" when needing replacement. The driver for the RF modules has the WH31 batt[1-8] in with the leaf_batt[1-8]. The WH31 sensor is the !bool value and the leaf_batt is a voltage value. Moving the 'case ~/batt[1-8]/:' to next case statement that starts with 'case "wh25batt":' would put in the correct statement for the !bool value.
Here is the old lines:
case ~/batt[1-8]/: case ~/leaf_batt[1-8]/: state.sensor = 1; updated = attributeUpdateBattery(val, "battery", "batteryIcon", "batteryOrg", 1); // voltage break; case "wh25batt": case "wh65batt": state.sensor = 1; updated = attributeUpdateBattery(val, "battery", "batteryIcon", "batteryOrg", 0); // !boolean break;
Here is the proposed new lines:
case ~/leaf_batt[1-8]/: state.sensor = 1; updated = attributeUpdateBattery(val, "battery", "batteryIcon", "batteryOrg", 1); // voltage break;
case ~/batt[1-8]/: case "wh25batt": case "wh65batt": state.sensor = 1; updated = attributeUpdateBattery(val, "battery", "batteryIcon", "batteryOrg", 0); // !boolean break;