lukas-clarke / eight_sleep

Home Assistant Eight Sleep integration that works with Eight Sleep's new API and OAUTH2
MIT License
62 stars 11 forks source link

Incorrect device class #25

Closed gkwok1 closed 2 months ago

gkwok1 commented 3 months ago

Entity sensor._previous_presence_end (<class 'custom_components.eight_sleep.sensor.EightUserSensor'>) is using state class 'measurement' which is impossible considering device class ('timestamp') it is using; expected None; Please update your configuration if your entity is manually configured, otherwise create a bug report at https://github.com/lukas-clarke/eight_sleep/issues Entity sensor._next_alarm (<class 'custom_components.eight_sleep.sensor.EightUserSensor'>) is using state class 'measurement' which is impossible considering device class ('timestamp') it is using; expected None; Please update your configuration if your entity is manually configured, otherwise create a bug report at https://github.com/lukas-clarke/eight_sleep/issues Entity sensor._previous_presence_start (<class 'custom_components.eight_sleep.sensor.EightUserSensor'>) is using state class 'measurement' which is impossible considering device class ('timestamp') it is using; expected None; Please update your configuration if your entity is manually configured, otherwise create a bug report at https://github.com/lukas-clarke/eight_sleep/issues Entity sensor._previous_presence_end (<class 'custom_components.eight_sleep.sensor.EightUserSensor'>) is using state class 'measurement' which is impossible considering device class ('timestamp') it is using; expected None; Please update your configuration if your entity is manually configured, otherwise create a bug report at https://github.com/lukas-clarke/eight_sleep/issues Entity sensor.eight_sleep_last_prime (<class 'custom_components.eight_sleep.sensor.EightRoomSensor'>) is using state class 'timestamp' which is impossible considering device class ('timestamp') it is using; expected None; Please update your configuration if your entity is manually configured, otherwise create a bug report at https://github.com/lukas-clarke/eight_sleep/issues

neildsb commented 3 months ago

same issue with -

Core 2024.4.0 Supervisor 2024.03.1 Operating System 12.1 Frontend 20240403.1

lukas-clarke commented 2 months ago

Issue fixed in latest release

gkwok1 commented 2 months ago

sensor._next_alarm is still having issues in the latest version.

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 668, in state numerical_value = float(value) # type:ignore[arg-type] ^^^^^^^^^^^^ TypeError: float() argument must be a string or a real number, not 'datetime.datetime'

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 580, in _async_add_entities await coro File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 890, in _async_add_entity await entity.add_to_platform_finish() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1334, in add_to_platform_finish self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 998, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1119, in _async_write_ha_state state, attr, capabilities, shadowed_attr = self.async_calculate_state() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1056, in async_calculate_state state = self._stringify_state(available) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1004, in _stringify_state if (state := self.state) is None: ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 670, in state raise ValueError( ValueError: Sensor sensor._next_alarm has device class 'None', state class 'measurement' unit 'None' and suggested precision 'None' thus indicating it has a numeric value; however, it has the non-numeric value: '2024-04-22 07:00:00-05:00' (<class 'datetime.datetime'>)

lukas-clarke commented 2 months ago

@gkwok1, thanks for the catch. Just released a new release with hotfix for this

gkwok1 commented 2 months ago

Updated and it's working now. Thank you for the hot fix.