Open litinoveweedle opened 2 years ago
Ciao,
this is strange.. The software is managing it with a function that a guy added to the code that is _getStateSafe What I see is that the value received is not 'unknown' or 'unavailable', but an empty string.
If you have an idea how to fix this, feel free to send a pull request. Otherwise I'll have a look when I have time, but in this moment I'm pretty busy on some personal topics
Daniele
Hello, it actually depends on the way, how given sensor is updated. Previously I have no checks in my sensor REST API templating, so if sensor device was not yet ready templating returned error on conversion to float and sensors had value of string 'Unknown' To avoid that, I updated template of the sensors, to update only if device value is number / float:
value_template: "{{ value_json.Data.Value | int if 'Data' in value_json and 'Value' in value_json.Data and is_number(value_json.Data.Value)}}"
But now if sensor device is not yet ready, sensor is updated with empty string - as you correctly observed.
The issue in both cases is, that there is no way, how I can postpone thermostat init to wait until linked sensors is initialized with some meaningful value and therefore without triggering described problem. Maybe there could/should be defined/documented sensor initial value (probably undefined / None), which thermostat integration silently process as 'wait for init' without triggering error.
There is same issue reported even for native thermostat integration: https://github.com/home-assistant/core/issues/22535
If you have any other idea how to get rid of these errors...
When after HA reload values of linked sensors are not yet known, integrations is not able to handle this situation correctly and raise error as bellow.
Proposal: correct input sanitation shall be implemented to only update integration temperature if:
is_number(states(sensors.given_sensor))