Jan Bouwhuis

Results 244 comments of Jan Bouwhuis

> > I don't think the suggested solution takes into consideration that there is also an issue with codes consisting of > 4 digits. My error reads: "Call-service error. Code...

Needs to be rebased with #87527

Not sure what value is causing the issue, but I am working on a bugfix to allow an empty string to be ignored and None to be accepted as an...

> With 2023.2, I started to get this same error but with Modbus sensors: > > ``` > Logger: homeassistant.components.sensor > Source: components/sensor/__init__.py:608 > Integration: Sensor ([documentation](https://www.home-assistant.io/integrations/sensor), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+sensor%22)) > First...

> What about template sensors? I have plenty of template sensors which may be “unknown” on HA startup. As a result my log is flooded by these warnings. Please open...

@epenet We will not add this to 2023.2, that allows us up update the sensor base class first as you suggested. Will set this PR to draft for now.

~Would like to merge #87129 before this PR, and then update the docs PR to say that a numeric value is also expected if `suggested_display_precision` is set.~

Have a look at https://github.com/home-assistant/core/pull/87013 that was recently merged. The sensor entity now has a new protected property `_numeric_state_expected` that can be used to determine the sensor expects numeric values.

It seems the literal string `"unavailable"` is assigned to the state, that causes the warning, assign `None` instead.

You can use `entity._numeric_state_expected` to check if a sensor expects a number or `None`. If a non numeric string is assigned the warning will popup.