mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 09:17:53 +00:00
Correct state and icon if fan is in standby mode in ViCare integration (#137565)
* handle standby mode * update snapshot
This commit is contained in:
parent
ec587e60e3
commit
44c79f4b9c
@ -196,6 +196,9 @@ class ViCareFan(ViCareEntity, FanEntity):
|
||||
@property
|
||||
def is_on(self) -> bool | None:
|
||||
"""Return true if the entity is on."""
|
||||
if self._api.getVentilationQuickmode(VentilationQuickmode.STANDBY):
|
||||
return False
|
||||
|
||||
return self.percentage is not None and self.percentage > 0
|
||||
|
||||
def turn_off(self, **kwargs: Any) -> None:
|
||||
@ -206,6 +209,8 @@ class ViCareFan(ViCareEntity, FanEntity):
|
||||
@property
|
||||
def icon(self) -> str | None:
|
||||
"""Return the icon to use in the frontend."""
|
||||
if self._api.getVentilationQuickmode(VentilationQuickmode.STANDBY):
|
||||
return "mdi:fan-off"
|
||||
if hasattr(self, "_attr_preset_mode"):
|
||||
if self._attr_preset_mode == VentilationMode.VENTILATION:
|
||||
return "mdi:fan-clock"
|
||||
|
@ -1,68 +1,4 @@
|
||||
# serializer version: 1
|
||||
# name: test_all_entities[fan.model0_ventilation-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'preset_modes': list([
|
||||
<VentilationMode.PERMANENT: 'permanent'>,
|
||||
<VentilationMode.VENTILATION: 'ventilation'>,
|
||||
<VentilationMode.SENSOR_DRIVEN: 'sensor_driven'>,
|
||||
<VentilationMode.SENSOR_OVERRIDE: 'sensor_override'>,
|
||||
]),
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'fan',
|
||||
'entity_category': None,
|
||||
'entity_id': 'fan.model0_ventilation',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': 'mdi:fan',
|
||||
'original_name': 'Ventilation',
|
||||
'platform': 'vicare',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': <FanEntityFeature: 9>,
|
||||
'translation_key': 'ventilation',
|
||||
'unique_id': 'gateway0_deviceSerialViAir300F-ventilation',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[fan.model0_ventilation-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': 'model0 Ventilation',
|
||||
'icon': 'mdi:fan',
|
||||
'percentage': 0,
|
||||
'percentage_step': 25.0,
|
||||
'preset_mode': None,
|
||||
'preset_modes': list([
|
||||
<VentilationMode.PERMANENT: 'permanent'>,
|
||||
<VentilationMode.VENTILATION: 'ventilation'>,
|
||||
<VentilationMode.SENSOR_DRIVEN: 'sensor_driven'>,
|
||||
<VentilationMode.SENSOR_OVERRIDE: 'sensor_override'>,
|
||||
]),
|
||||
'supported_features': <FanEntityFeature: 9>,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'fan.model0_ventilation',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'off',
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[fan.model1_ventilation-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
@ -92,7 +28,7 @@
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': 'mdi:fan',
|
||||
'original_icon': 'mdi:fan-off',
|
||||
'original_name': 'Ventilation',
|
||||
'platform': 'vicare',
|
||||
'previous_unique_id': None,
|
||||
@ -106,7 +42,7 @@
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': 'model1 Ventilation',
|
||||
'icon': 'mdi:fan',
|
||||
'icon': 'mdi:fan-off',
|
||||
'percentage': 0,
|
||||
'percentage_step': 25.0,
|
||||
'preset_mode': None,
|
||||
|
Loading…
x
Reference in New Issue
Block a user