Fix state of fan entity for Miele hobs with extractor when turned off (#144025)

This commit is contained in:
Andrea Turri 2025-05-01 10:42:27 +02:00 committed by GitHub
parent bc47049d42
commit 83b9b8b032
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 177 additions and 2 deletions

View File

@ -99,8 +99,10 @@ class MieleFan(MieleEntity, FanEntity):
@property @property
def is_on(self) -> bool: def is_on(self) -> bool:
"""Return current on/off state.""" """Return current on/off state."""
assert self.device.state_ventilation_step is not None return (
return self.device.state_ventilation_step > 0 self.device.state_ventilation_step is not None
and self.device.state_ventilation_step > 0
)
@property @property
def speed_count(self) -> int: def speed_count(self) -> int:

View File

@ -210,5 +210,129 @@
"ecoFeedback": null, "ecoFeedback": null,
"batteryLevel": null "batteryLevel": null
} }
},
"DummyAppliance_74_off": {
"ident": {
"type": {
"key_localized": "Device type",
"value_raw": 74,
"value_localized": "Hob with vapour extraction"
},
"deviceName": "",
"protocolVersion": 2,
"deviceIdentLabel": {
"fabNumber": "**REDACTED**",
"fabIndex": "00",
"techType": "KMDA7473",
"matNumber": "",
"swids": ["000"]
},
"xkmIdentLabel": {
"techType": "EK039W",
"releaseVersion": "02.80"
}
},
"state": {
"ProgramID": {
"value_raw": 0,
"value_localized": "",
"key_localized": "Program name"
},
"status": {
"value_raw": 1,
"value_localized": "Off",
"key_localized": "status"
},
"programType": {
"value_raw": 0,
"value_localized": "",
"key_localized": "Program type"
},
"programPhase": {
"value_raw": 0,
"value_localized": "",
"key_localized": "Program phase"
},
"remainingTime": [0, 0],
"startTime": [0, 0],
"targetTemperature": [
{
"value_raw": -32768,
"value_localized": null,
"unit": "Celsius"
},
{
"value_raw": -32768,
"value_localized": null,
"unit": "Celsius"
},
{
"value_raw": -32768,
"value_localized": null,
"unit": "Celsius"
}
],
"coreTargetTemperature": [
{
"value_raw": -32768,
"value_localized": null,
"unit": "Celsius"
}
],
"temperature": [
{
"value_raw": -32768,
"value_localized": null,
"unit": "Celsius"
},
{
"value_raw": -32768,
"value_localized": null,
"unit": "Celsius"
},
{
"value_raw": -32768,
"value_localized": null,
"unit": "Celsius"
}
],
"coreTemperature": [
{
"value_raw": -32768,
"value_localized": null,
"unit": "Celsius"
}
],
"signalInfo": false,
"signalFailure": false,
"signalDoor": false,
"remoteEnable": {
"fullRemoteControl": false,
"smartGrid": false,
"mobileStart": false
},
"ambientLight": null,
"light": null,
"elapsedTime": [],
"spinningSpeed": {
"unit": "rpm",
"value_raw": null,
"value_localized": null,
"key_localized": "Spin speed"
},
"dryingStep": {
"value_raw": null,
"value_localized": "",
"key_localized": "Drying level"
},
"ventilationStep": {
"value_raw": null,
"value_localized": "",
"key_localized": "Fan level"
},
"plateStep": [],
"ecoFeedback": null,
"batteryLevel": null
}
} }
} }

View File

@ -48,6 +48,55 @@
'state': 'on', 'state': 'on',
}) })
# --- # ---
# name: test_fan_states[fan_devices.json-platforms0][fan.hob_with_extraction_fan_2-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': dict({
}),
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'fan',
'entity_category': None,
'entity_id': 'fan.hob_with_extraction_fan_2',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'options': dict({
}),
'original_device_class': None,
'original_icon': None,
'original_name': 'Fan',
'platform': 'miele',
'previous_unique_id': None,
'supported_features': 0,
'translation_key': 'fan',
'unique_id': 'DummyAppliance_74_off-fan_readonly',
'unit_of_measurement': None,
})
# ---
# name: test_fan_states[fan_devices.json-platforms0][fan.hob_with_extraction_fan_2-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'friendly_name': 'Hob with extraction Fan',
'supported_features': <FanEntityFeature: 0>,
}),
'context': <ANY>,
'entity_id': 'fan.hob_with_extraction_fan_2',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'off',
})
# ---
# name: test_fan_states[fan_devices.json-platforms0][fan.hood_fan-entry] # name: test_fan_states[fan_devices.json-platforms0][fan.hood_fan-entry]
EntityRegistryEntrySnapshot({ EntityRegistryEntrySnapshot({
'aliases': set({ 'aliases': set({