feat: add an alongside switch entity for the water heater (#1115)

This commit is contained in:
Li Shuzhen
2025-05-23 09:10:11 +08:00
committed by GitHub
parent 1bd338639b
commit 62dd32a132
4 changed files with 81 additions and 53 deletions

View File

@ -601,7 +601,7 @@ class MIoTSpecProperty(_MIoTSpecBase):
if value is None:
return None
if self.format_ == int:
return int(value)
return int(round(value))
if self.format_ == float:
return round(value, self.precision)
if self.format_ == bool:

View File

@ -18,5 +18,45 @@
}
]
}
],
"urn:miot-spec-v2:device:water-heater:0000A02A:xiaomi-yms2:1": [
{
"iid": 2,
"type": "urn:miot-spec-v2:service:switch:0000780C:xiaomi-yms2:1",
"description": "Switch",
"properties": [
{
"iid": 6,
"type": "urn:miot-spec-v2:property:on:00000006:xiaomi-yms2:1",
"description": "Switch Status",
"format": "bool",
"access": [
"read",
"write",
"notify"
]
}
]
}
],
"urn:miot-spec-v2:device:water-heater:0000A02A:zimi-h03:1": [
{
"iid": 2,
"type": "urn:miot-spec-v2:service:switch:0000780C:zimi-h03:1",
"description": "Switch",
"properties": [
{
"iid": 6,
"type": "urn:miot-spec-v2:property:on:00000006:zimi-h03:1",
"description": "Switch Status",
"format": "bool",
"access": [
"read",
"write",
"notify"
]
}
]
}
]
}

View File

@ -397,7 +397,7 @@ SPEC_SERVICE_TRANS_MAP: dict = {
}
},
'optional': {
'properties': {'on', 'temperature', 'target-temperature', 'mode'}
'properties': {'temperature', 'target-temperature', 'mode'}
},
'entity': 'water_heater'
},