mirror of
https://github.com/home-assistant/core.git
synced 2025-07-20 03:37:07 +00:00
Handle None when trucating long Environment Canada state values (#29208)
* Handle None when trucating long state values, add info message * Black
This commit is contained in:
parent
1c824f5ca7
commit
1322661ee0
@ -134,8 +134,11 @@ class ECSensor(Entity):
|
||||
)
|
||||
elif self.sensor_type == "tendency":
|
||||
self._state = str(value).capitalize()
|
||||
else:
|
||||
elif value is not None and len(value) > 255:
|
||||
self._state = value[:255]
|
||||
_LOGGER.info("Value for %s truncated to 255 characters", self._unique_id)
|
||||
else:
|
||||
self._state = value
|
||||
|
||||
if sensor_data.get("unit") == "C" or self.sensor_type in [
|
||||
"wind_chill",
|
||||
|
Loading…
x
Reference in New Issue
Block a user