mirror of
https://github.com/home-assistant/core.git
synced 2026-02-06 15:25:33 +01:00
Cleanup default None value from dict.get (#162396)
This commit is contained in:
@@ -201,5 +201,5 @@ class ArwnSensor(SensorEntity):
|
||||
ev: dict[str, Any] = {}
|
||||
ev.update(event)
|
||||
self._attr_extra_state_attributes = ev
|
||||
self._attr_native_value = ev.get(self._state_key, None)
|
||||
self._attr_native_value = ev.get(self._state_key)
|
||||
self.async_write_ha_state()
|
||||
|
||||
@@ -40,7 +40,7 @@ async def async_setup_platform(
|
||||
name=disc_info[sensor]["name"],
|
||||
egardia_system=hass.data[EGARDIA_DEVICE],
|
||||
device_class=EGARDIA_TYPE_TO_DEVICE_CLASS.get(
|
||||
disc_info[sensor]["type"], None
|
||||
disc_info[sensor]["type"]
|
||||
),
|
||||
)
|
||||
for sensor in disc_info
|
||||
|
||||
@@ -254,7 +254,7 @@ class LyricClimate(LyricDeviceEntity, ClimateEntity):
|
||||
@property
|
||||
def hvac_action(self) -> HVACAction | None:
|
||||
"""Return the current hvac action."""
|
||||
action = HVAC_ACTIONS.get(self.device.operation_status.mode, None)
|
||||
action = HVAC_ACTIONS.get(self.device.operation_status.mode)
|
||||
if action == HVACAction.OFF and self.hvac_mode != HVACMode.OFF:
|
||||
action = HVACAction.IDLE
|
||||
return action
|
||||
|
||||
@@ -397,7 +397,7 @@ async def async_parse_tplink_detector(uid: str, msg) -> Event | None:
|
||||
rule = source.Value
|
||||
|
||||
for item in payload.Data.SimpleItem:
|
||||
event_template = _TAPO_EVENT_TEMPLATES.get(item.Name, None)
|
||||
event_template = _TAPO_EVENT_TEMPLATES.get(item.Name)
|
||||
if event_template is None:
|
||||
continue
|
||||
|
||||
|
||||
@@ -228,7 +228,7 @@ class ViCareClimate(ViCareEntity, ClimateEntity):
|
||||
"""Return current hvac mode."""
|
||||
if self._current_mode is None:
|
||||
return None
|
||||
return VICARE_TO_HA_HVAC_HEATING.get(self._current_mode, None)
|
||||
return VICARE_TO_HA_HVAC_HEATING.get(self._current_mode)
|
||||
|
||||
def set_hvac_mode(self, hvac_mode: HVACMode) -> None:
|
||||
"""Set a new hvac mode on the ViCare API."""
|
||||
|
||||
@@ -151,4 +151,4 @@ class ViCareWater(ViCareEntity, WaterHeaterEntity):
|
||||
"""Return current operation ie. heat, cool, idle."""
|
||||
if self._current_mode is None:
|
||||
return None
|
||||
return VICARE_TO_HA_HVAC_DHW.get(self._current_mode, None)
|
||||
return VICARE_TO_HA_HVAC_DHW.get(self._current_mode)
|
||||
|
||||
Reference in New Issue
Block a user