Skip to content

Commit

Permalink
fix: sensor link is optional
Browse files Browse the repository at this point in the history
  • Loading branch information
mypal committed Aug 12, 2024
1 parent 872d868 commit e78ba05
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions custom_components/ds_air/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,20 @@ def __init__(self, config_entry: config_entries.ConfigEntry) -> None:
self._climates = list(map(lambda state: state.alias, Service.get_aircons()))
sensors = hass.states.async_all("sensor")
self._sensors_temp = {
state.entity_id: f"{state.attributes.get(ATTR_FRIENDLY_NAME, state.entity_id)} ({state.entity_id})"
for state in sensors
if state.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.TEMPERATURE
None: 'None',
**{
state.entity_id: f"{state.attributes.get(ATTR_FRIENDLY_NAME, state.entity_id)} ({state.entity_id})"
for state in sensors
if state.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.TEMPERATURE
}
}
self._sensors_humi = {
state.entity_id: f"{state.attributes.get(ATTR_FRIENDLY_NAME, state.entity_id)} ({state.entity_id})"
for state in sensors
if state.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.HUMIDITY
None: 'None',
**{
state.entity_id: f"{state.attributes.get(ATTR_FRIENDLY_NAME, state.entity_id)} ({state.entity_id})"
for state in sensors
if state.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.HUMIDITY
}
}
self._len = len(self._climates)
self._cur = -1
Expand Down

0 comments on commit e78ba05

Please sign in to comment.