Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion homeassistant/components/withings/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,7 @@ def _async_device_listener() -> None:
config_entry_id
)
)
and config_entry.state == ConfigEntryState.LOADED
and config_entry.state is ConfigEntryState.LOADED
for config_entry_id in device.config_entries
):
continue
Expand Down
6 changes: 3 additions & 3 deletions homeassistant/components/wyoming/assist_satellite.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ async def async_set_configuration(

def on_pipeline_event(self, event: PipelineEvent) -> None:
"""Set state based on pipeline stage."""
if event.type == assist_pipeline.PipelineEventType.RUN_END:
if event.type is assist_pipeline.PipelineEventType.RUN_END:
# Pipeline run is complete — always update bookkeeping state
# even after a disconnect so follow-up reconnects don't retain
# stale _is_pipeline_running / _pipeline_ended_event state.
Expand All @@ -192,7 +192,7 @@ def on_pipeline_event(self, event: PipelineEvent) -> None:
# Satellite disconnected, don't try to write to the client
return

if event.type == assist_pipeline.PipelineEventType.RUN_START:
if event.type is assist_pipeline.PipelineEventType.RUN_START:
if event.data and (tts_output := event.data.get("tts_output")):
# Get stream token early.
# If "tts_start_streaming" is True in INTENT_PROGRESS event, we
Expand Down Expand Up @@ -861,7 +861,7 @@ def _handle_timer(

_LOGGER.debug("Timer event: type=%s, info=%s", event_type, timer)
event: Event | None = None
if event_type == intent.TimerEventType.STARTED:
if event_type is intent.TimerEventType.STARTED:
event = TimerStarted(
id=timer.id,
total_seconds=timer.seconds,
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/wyoming/devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def set_volume_multiplier(self, volume_multiplier: float) -> None:
@callback
def set_vad_sensitivity(self, vad_sensitivity: VadSensitivity) -> None:
"""Set VAD sensitivity."""
if vad_sensitivity != self.vad_sensitivity:
if vad_sensitivity is not self.vad_sensitivity:
self.vad_sensitivity = vad_sensitivity
if self._audio_settings_listener is not None:
self._audio_settings_listener()
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/xbox/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class XboxRemote(XboxConsoleBaseEntity, RemoteEntity):
@property
def is_on(self) -> bool:
"""Return True if device is on."""
return self.data.status.power_state == PowerState.On
return self.data.status.power_state is PowerState.On

@exception_handler
async def async_turn_on(self, **kwargs: Any) -> None:
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/xiaomi_ble/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def process_service_info(
# not verified then we need to reauth
if (
not data.pending
and data.encryption_scheme != EncryptionScheme.NONE
and data.encryption_scheme is not EncryptionScheme.NONE
and not data.bindkey_verified
):
entry.async_start_reauth(hass, data={"device": data})
Expand Down
6 changes: 3 additions & 3 deletions homeassistant/components/xiaomi_ble/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ async def async_step_bluetooth(
# encryption later, we can do a reauth
return await self.async_step_confirm_slow()

if device.encryption_scheme == EncryptionScheme.MIBEACON_LEGACY:
if device.encryption_scheme is EncryptionScheme.MIBEACON_LEGACY:
return await self.async_step_get_encryption_key_legacy()
if device.encryption_scheme == EncryptionScheme.MIBEACON_4_5:
return await self.async_step_get_encryption_key_4_5_choose_method()
Expand Down Expand Up @@ -296,7 +296,7 @@ async def async_step_user(

self._discovered_device = discovery.device

if discovery.device.encryption_scheme == EncryptionScheme.MIBEACON_LEGACY:
if discovery.device.encryption_scheme is EncryptionScheme.MIBEACON_LEGACY:
return await self.async_step_get_encryption_key_legacy()

if discovery.device.encryption_scheme == EncryptionScheme.MIBEACON_4_5:
Expand Down Expand Up @@ -338,7 +338,7 @@ async def async_step_reauth(

self._discovery_info = device.last_service_info

if device.encryption_scheme == EncryptionScheme.MIBEACON_LEGACY:
if device.encryption_scheme is EncryptionScheme.MIBEACON_LEGACY:
return await self.async_step_get_encryption_key_legacy()

if device.encryption_scheme == EncryptionScheme.MIBEACON_4_5:
Expand Down
10 changes: 5 additions & 5 deletions homeassistant/components/xiaomi_miio/humidifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ async def async_set_humidity(self, humidity: float) -> None:
if (
self.supported_features & HumidifierEntityFeature.MODES == 0
or AirhumidifierOperationMode(self._attributes[ATTR_MODE])
== AirhumidifierOperationMode.Auto
is AirhumidifierOperationMode.Auto
or AirhumidifierOperationMode.Auto.name not in self.available_modes
):
self.async_write_ha_state()
Expand Down Expand Up @@ -310,7 +310,7 @@ def target_humidity(self) -> float | None:
return (
self._target_humidity
if AirhumidifierMiotOperationMode(self._mode)
== AirhumidifierMiotOperationMode.Auto
is AirhumidifierMiotOperationMode.Auto
else None
)
return None
Expand All @@ -331,7 +331,7 @@ async def async_set_humidity(self, humidity: float) -> None:
if (
self.supported_features & HumidifierEntityFeature.MODES == 0
or AirhumidifierMiotOperationMode(self._attributes[ATTR_MODE])
== AirhumidifierMiotOperationMode.Auto
is AirhumidifierMiotOperationMode.Auto
):
self.async_write_ha_state()
return
Expand Down Expand Up @@ -385,7 +385,7 @@ def target_humidity(self) -> float | None:
if self.is_on:
if (
AirhumidifierMjjsqOperationMode(self._mode)
== AirhumidifierMjjsqOperationMode.Humidity
is AirhumidifierMjjsqOperationMode.Humidity
):
return self._target_humidity
return None
Expand All @@ -406,7 +406,7 @@ async def async_set_humidity(self, humidity: float) -> None:
if (
self.supported_features & HumidifierEntityFeature.MODES == 0
or AirhumidifierMjjsqOperationMode(self._attributes[ATTR_MODE])
== AirhumidifierMjjsqOperationMode.Humidity
is AirhumidifierMjjsqOperationMode.Humidity
):
self.async_write_ha_state()
return
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/xiaomi_tv/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,14 @@ def turn_off(self) -> None:
because the TV won't accept any input when turned off. Thus, the user
would be unable to turn the TV back on, unless it's done manually.
"""
if self.state != MediaPlayerState.OFF:
if self.state is not MediaPlayerState.OFF:
self._tv.sleep()

self._attr_state = MediaPlayerState.OFF

def turn_on(self) -> None:
"""Wake the TV back up from sleep."""
if self.state != MediaPlayerState.ON:
if self.state is not MediaPlayerState.ON:
self._tv.wake()

self._attr_state = MediaPlayerState.ON
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/yale_smart_alarm/lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ async def async_set_lock(self, state: YaleLockState, code: str | None) -> None:
@property
def is_locked(self) -> bool | None:
"""Return true if the lock is locked."""
return LOCK_STATE_MAP.get(self.lock_data.state()) == LockState.LOCKED
return LOCK_STATE_MAP.get(self.lock_data.state()) is LockState.LOCKED

@property
def is_open(self) -> bool | None:
"""Return true if the lock is open."""
return LOCK_STATE_MAP.get(self.lock_data.state()) == LockState.OPEN
return LOCK_STATE_MAP.get(self.lock_data.state()) is LockState.OPEN
2 changes: 1 addition & 1 deletion homeassistant/components/yalexs_ble/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ def _async_update_state(
self, new_state: LockState, lock_info: LockInfo, connection_info: ConnectionInfo
) -> None:
"""Update the state."""
self._attr_is_on = new_state.door == DoorStatus.OPENED
self._attr_is_on = new_state.door is DoorStatus.OPENED
super()._async_update_state(new_state, lock_info, connection_info)
8 changes: 4 additions & 4 deletions homeassistant/components/yamaha_musiccast/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ async def async_play_media(
)
media_id = play_item.url

if self.state == MediaPlayerState.OFF:
if self.state is MediaPlayerState.OFF:
await self.async_turn_on()

if media_id:
Expand Down Expand Up @@ -468,7 +468,7 @@ def supported_features(self) -> MediaPlayerEntityFeature:
supported_features |= MediaPlayerEntityFeature.PLAY
supported_features |= MediaPlayerEntityFeature.STOP

if self.state != MediaPlayerState.OFF:
if self.state is not MediaPlayerState.OFF:
supported_features |= MediaPlayerEntityFeature.BROWSE_MEDIA

return supported_features
Expand Down Expand Up @@ -729,7 +729,7 @@ async def async_join_players(self, group_members: list[str]) -> None:
if entity.entity_id in group_members
]

if self.state == MediaPlayerState.OFF:
if self.state is MediaPlayerState.OFF:
await self.async_turn_on()

if not self.is_server and self.musiccast_zone_entity.is_server:
Expand Down Expand Up @@ -812,7 +812,7 @@ async def async_client_join(self, group_id, server) -> bool:
# If we should join the group, which is served by the main zone,
# we can simply select main_sync as input.
_LOGGER.debug("%s called service client join", self.entity_id)
if self.state == MediaPlayerState.OFF:
if self.state is MediaPlayerState.OFF:
await self.async_turn_on()
if self.ip_address == server.ip_address:
if server.zone == DEFAULT_ZONE:
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/yeelight/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ async def _async_handle_discovery_with_unique_id(self) -> ConfigFlowResult:
CONF_ID
):
continue
reload = entry.state == ConfigEntryState.SETUP_RETRY
reload = entry.state is ConfigEntryState.SETUP_RETRY
if entry.data.get(CONF_HOST) != self._discovered_ip:
self.hass.config_entries.async_update_entry(
entry, data={**entry.data, CONF_HOST: self._discovered_ip}
Expand Down
6 changes: 3 additions & 3 deletions homeassistant/components/yeelight/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ async def async_set_hs(self, hs_color, duration) -> None:
return
if (
not self.device.is_color_flow_enabled
and self.color_mode == ColorMode.HS
and self.color_mode is ColorMode.HS
and self.hs_color == hs_color
):
_LOGGER.debug("HS already set to: %s", hs_color)
Expand All @@ -664,7 +664,7 @@ async def async_set_rgb(self, rgb, duration) -> None:
return
if (
not self.device.is_color_flow_enabled
and self.color_mode == ColorMode.RGB
and self.color_mode is ColorMode.RGB
and self.rgb_color == rgb
):
_LOGGER.debug("RGB already set to: %s", rgb)
Expand All @@ -690,7 +690,7 @@ async def async_set_colortemp(self, temp_in_k, duration) -> None:

if (
not self.device.is_color_flow_enabled
and self.color_mode == ColorMode.COLOR_TEMP
and self.color_mode is ColorMode.COLOR_TEMP
and self.color_temp_kelvin == temp_in_k
):
_LOGGER.debug("Color temp already set to: %s", temp_in_k)
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/yolink/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ async def handle_speaker_hub_play_call(service_call: ServiceCall) -> None:
continue
if entry.domain == DOMAIN:
break
if entry is None or entry.state != ConfigEntryState.LOADED:
if entry is None or entry.state is not ConfigEntryState.LOADED:
raise ServiceValidationError(
translation_domain=DOMAIN,
translation_key="invalid_config_entry",
Expand Down
8 changes: 4 additions & 4 deletions homeassistant/components/zha/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ async def async_step_choose_serial_port(
self._radio_mgr.device_path = device_path

probe_result = await self._radio_mgr.detect_radio_type()
if probe_result == ProbeResult.WRONG_FIRMWARE_INSTALLED:
if probe_result is ProbeResult.WRONG_FIRMWARE_INSTALLED:
return self.async_abort(
reason="wrong_firmware_installed",
description_placeholders={"repair_url": REPAIR_MY_URL},
Expand Down Expand Up @@ -333,7 +333,7 @@ async def async_step_choose_setup_strategy(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Choose how to set up the integration from scratch."""
if self._flow_strategy == ZigbeeFlowStrategy.RECOMMENDED:
if self._flow_strategy is ZigbeeFlowStrategy.RECOMMENDED:
# Fast path: automatically form a new network
return await self.async_step_setup_strategy_recommended()
if self._flow_strategy == ZigbeeFlowStrategy.ADVANCED:
Expand Down Expand Up @@ -372,7 +372,7 @@ async def async_step_choose_migration_strategy(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Choose how to deal with the current radio's settings during migration."""
if self._flow_strategy == ZigbeeFlowStrategy.RECOMMENDED:
if self._flow_strategy is ZigbeeFlowStrategy.RECOMMENDED:
# Fast path: automatically migrate everything
return await self.async_step_migration_strategy_recommended()
if self._flow_strategy == ZigbeeFlowStrategy.ADVANCED:
Expand Down Expand Up @@ -852,7 +852,7 @@ async def async_step_confirm(
else:
probe_result = ProbeResult.RADIO_TYPE_DETECTED

if probe_result == ProbeResult.WRONG_FIRMWARE_INSTALLED:
if probe_result is ProbeResult.WRONG_FIRMWARE_INSTALLED:
return self.async_abort(
reason="wrong_firmware_installed",
description_placeholders={"repair_url": REPAIR_MY_URL},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ async def warn_on_wrong_silabs_firmware(hass: HomeAssistant, device: str) -> boo
# Failed to probe, we can't tell if the wrong firmware is installed
return False

if app_type == ApplicationType.EZSP:
if app_type is ApplicationType.EZSP:
# If connecting fails but we somehow probe EZSP (e.g. stuck in bootloader),
# reconnect, it should work
raise AlreadyRunningEZSP
Expand All @@ -102,7 +102,7 @@ async def warn_on_wrong_silabs_firmware(hass: HomeAssistant, device: str) -> boo
severity=ir.IssueSeverity.ERROR,
translation_key=(
ISSUE_WRONG_SILABS_FIRMWARE_INSTALLED
+ ("_nabucasa" if hardware_type != HardwareType.OTHER else "_other")
+ ("_nabucasa" if hardware_type is not HardwareType.OTHER else "_other")
),
translation_placeholders={"firmware_type": app_type.name},
)
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/zhong_hong/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def set_temperature(self, **kwargs: Any) -> None:

def set_hvac_mode(self, hvac_mode: HVACMode) -> None:
"""Set new target operation mode."""
if hvac_mode == HVACMode.OFF:
if hvac_mode is HVACMode.OFF:
if self.is_on:
self.turn_off()
return
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/ziggo_mediabox_xl/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def update(self) -> None:
try:
if self._mediabox.test_connection():
if self._mediabox.turned_on():
if self.state != MediaPlayerState.PAUSED:
if self.state is not MediaPlayerState.PAUSED:
self._attr_state = MediaPlayerState.PLAYING
else:
self._attr_state = MediaPlayerState.OFF
Expand Down Expand Up @@ -151,7 +151,7 @@ def media_pause(self) -> None:
def media_play_pause(self) -> None:
"""Simulate play pause media player."""
self.send_keys(["PAUSE"])
if self.state == MediaPlayerState.PAUSED:
if self.state is MediaPlayerState.PAUSED:
self._attr_state = MediaPlayerState.PLAYING
else:
self._attr_state = MediaPlayerState.PAUSED
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/zwave_js/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ def async_on_node_removed(self, event: dict) -> None:
# We don't want to remove the device so we can keep the user customizations
return

if reason == RemoveNodeReason.RESET:
if reason is RemoveNodeReason.RESET:
device_name = device.name_by_user or device.name or f"Node {node.node_id}"
identifier = get_network_identifier_for_notification(
self.hass, self.config_entry, self.driver_events.driver.controller
Expand Down Expand Up @@ -1207,7 +1207,7 @@ async def async_ensure_addon_running(
if addon_has_esphome and socket_path is not None:
addon_config[CONF_ADDON_SOCKET] = socket_path

if addon_state == AddonState.NOT_INSTALLED:
if addon_state is AddonState.NOT_INSTALLED:
addon_manager.async_schedule_install_setup_addon(
addon_config,
catch_error=True,
Expand Down
6 changes: 3 additions & 3 deletions homeassistant/components/zwave_js/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,7 @@ async def websocket_node_alerts(
[
strategy.value
for strategy in InclusionStrategy
if strategy != InclusionStrategy.SMART_START
if strategy is not InclusionStrategy.SMART_START
]
),
),
Expand Down Expand Up @@ -869,7 +869,7 @@ def device_registered(device: dr.DeviceEntry) -> None:
)
# Check for nodes that have been added but not fully included
for node in controller.nodes.values():
if node.status != NodeStatus.DEAD and not node.ready:
if node.status is not NodeStatus.DEAD and not node.ready:
forward_node_added(
node,
not node.is_secure,
Expand Down Expand Up @@ -1470,7 +1470,7 @@ def node_removed(event: dict) -> None:
[
strategy.value
for strategy in InclusionStrategy
if strategy != InclusionStrategy.SMART_START
if strategy is not InclusionStrategy.SMART_START
]
),
),
Expand Down
Loading
Loading