diff --git a/homeassistant/components/homematic/climate.py b/homeassistant/components/homematic/climate.py index 16c345c563548eb3642a1a57ec97c9da93d731ac..2b0306809b0e3a248c664aa117365712653b6c1e 100644 --- a/homeassistant/components/homematic/climate.py +++ b/homeassistant/components/homematic/climate.py @@ -140,10 +140,8 @@ class HMThermostat(HMDevice, ClimateEntity): def set_temperature(self, **kwargs: Any) -> None: """Set new target temperature.""" - if (temperature := kwargs.get(ATTR_TEMPERATURE)) is None: - return None - - self._hmdevice.writeNodeData(self._state, float(temperature)) + if (temperature := kwargs.get(ATTR_TEMPERATURE)) is not None: + self._hmdevice.writeNodeData(self._state, float(temperature)) def set_hvac_mode(self, hvac_mode: HVACMode) -> None: """Set new target hvac mode.""" diff --git a/homeassistant/components/nest/media_source.py b/homeassistant/components/nest/media_source.py index 6c481806e4f8d33bcc82c81d002938d30fe722a7..1260474ad88ee0c80a551ee5093dac83523bf82f 100644 --- a/homeassistant/components/nest/media_source.py +++ b/homeassistant/components/nest/media_source.py @@ -227,10 +227,9 @@ class NestEventMediaStore(EventMediaStore): filename = self.get_media_filename(media_key) def remove_media(filename: str) -> None: - if not os.path.exists(filename): - return None - _LOGGER.debug("Removing event media from disk store: %s", filename) - os.remove(filename) + if os.path.exists(filename): + _LOGGER.debug("Removing event media from disk store: %s", filename) + os.remove(filename) try: await self._hass.async_add_executor_job(remove_media, filename) diff --git a/homeassistant/components/telnet/switch.py b/homeassistant/components/telnet/switch.py index 805f037dbae12748128b3a31febd117ecee56766..8aae49f8730cec9c9cda0feafc0aa03ecab041bf 100644 --- a/homeassistant/components/telnet/switch.py +++ b/homeassistant/components/telnet/switch.py @@ -142,10 +142,9 @@ class TelnetSwitch(SwitchEntity): response = self._telnet_command(self._command_state) if response and self._value_template: rendered = self._value_template.render_with_possible_json_value(response) + self._attr_is_on = rendered == "True" else: _LOGGER.warning("Empty response for command: %s", self._command_state) - return None - self._attr_is_on = rendered == "True" def turn_on(self, **kwargs: Any) -> None: """Turn the device on.""" diff --git a/homeassistant/components/tradfri/switch.py b/homeassistant/components/tradfri/switch.py index 4ad1424aa9afcbb2a234f42e6ab4c05d9c925245..88126f1ffce269dac8dfa31be02b77c0497e9ea0 100644 --- a/homeassistant/components/tradfri/switch.py +++ b/homeassistant/components/tradfri/switch.py @@ -72,12 +72,10 @@ class TradfriSwitch(TradfriBaseEntity, SwitchEntity): async def async_turn_off(self, **kwargs: Any) -> None: """Instruct the switch to turn off.""" - if not self._device_control: - return None - await self._api(self._device_control.set_state(False)) + if self._device_control: + await self._api(self._device_control.set_state(False)) async def async_turn_on(self, **kwargs: Any) -> None: """Instruct the switch to turn on.""" - if not self._device_control: - return None - await self._api(self._device_control.set_state(True)) + if self._device_control: + await self._api(self._device_control.set_state(True))