Fix lyric feedback (#100586)

This commit is contained in:
Joost Lekkerkerker 2023-09-19 11:40:05 +02:00 committed by GitHub
parent cf6eddee74
commit f01c71e514
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -98,8 +98,9 @@ DEVICE_SENSORS: list[LyricSensorEntityDescription] = [
value_fn=lambda device: get_datetime_from_future_time( value_fn=lambda device: get_datetime_from_future_time(
device.changeableValues.nextPeriodTime device.changeableValues.nextPeriodTime
), ),
suitable_fn=lambda device: device.changeableValues suitable_fn=lambda device: (
and device.changeableValues.nextPeriodTime, device.changeableValues and device.changeableValues.nextPeriodTime
),
), ),
LyricSensorEntityDescription( LyricSensorEntityDescription(
key="setpoint_status", key="setpoint_status",
@ -109,8 +110,9 @@ DEVICE_SENSORS: list[LyricSensorEntityDescription] = [
device.changeableValues.thermostatSetpointStatus, device.changeableValues.thermostatSetpointStatus,
device.changeableValues.nextPeriodTime, device.changeableValues.nextPeriodTime,
), ),
suitable_fn=lambda device: device.changeableValues suitable_fn=lambda device: (
and device.changeableValues.thermostatSetpointStatus, device.changeableValues and device.changeableValues.thermostatSetpointStatus
),
), ),
] ]
@ -119,7 +121,7 @@ def get_setpoint_status(status: str, time: str) -> str | None:
"""Get status of the setpoint.""" """Get status of the setpoint."""
if status == PRESET_HOLD_UNTIL: if status == PRESET_HOLD_UNTIL:
return f"Held until {time}" return f"Held until {time}"
return LYRIC_SETPOINT_STATUS_NAMES.get(status, None) return LYRIC_SETPOINT_STATUS_NAMES.get(status)
def get_datetime_from_future_time(time_str: str) -> datetime: def get_datetime_from_future_time(time_str: str) -> datetime: