mirror of
https://github.com/XiaoMi/ha_xiaomi_home.git
synced 2026-01-16 14:40:43 +08:00
Compare commits
3 Commits
d902bbdf1c
...
7a04177d43
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7a04177d43 | ||
|
|
e174a73f52 | ||
|
|
1dc376887f |
@ -89,4 +89,8 @@ class BinarySensor(MIoTPropertyEntity, BinarySensorEntity):
|
||||
@property
|
||||
def is_on(self) -> bool:
|
||||
"""On/Off state. True if the binary sensor is on, False otherwise."""
|
||||
if self.spec.name == 'contact-state':
|
||||
return self._value is False
|
||||
elif self.spec.name == 'occupancy-status':
|
||||
return bool(self._value)
|
||||
return self._value is True
|
||||
|
||||
@ -85,37 +85,37 @@ urn:miot-spec-v2:device:thermostat:0000A031:suittc-wk168:1:
|
||||
prop.2.3:
|
||||
value-list:
|
||||
- value: 1
|
||||
description: one
|
||||
description: '1'
|
||||
- value: 2
|
||||
description: two
|
||||
description: '2'
|
||||
- value: 3
|
||||
description: three
|
||||
description: '3'
|
||||
- value: 4
|
||||
description: four
|
||||
description: '4'
|
||||
- value: 5
|
||||
description: five
|
||||
description: '5'
|
||||
- value: 6
|
||||
description: six
|
||||
description: '6'
|
||||
- value: 7
|
||||
description: seven
|
||||
description: '7'
|
||||
- value: 8
|
||||
description: eight
|
||||
description: '8'
|
||||
- value: 9
|
||||
description: nine
|
||||
description: '9'
|
||||
- value: 10
|
||||
description: ten
|
||||
description: '10'
|
||||
- value: 11
|
||||
description: eleven
|
||||
description: '11'
|
||||
- value: 12
|
||||
description: twelve
|
||||
description: '12'
|
||||
- value: 13
|
||||
description: thirteen
|
||||
description: '13'
|
||||
- value: 14
|
||||
description: fourteen
|
||||
description: '14'
|
||||
- value: 15
|
||||
description: fifteen
|
||||
description: '15'
|
||||
- value: 16
|
||||
description: sixteen
|
||||
description: '16'
|
||||
urn:miot-spec-v2:device:outlet:0000A002:chuangmi-212a01:3:
|
||||
prop.5.1:
|
||||
expr: round(src_value*6/1000000, 3)
|
||||
|
||||
@ -48,6 +48,7 @@ Conversion rules of MIoT-Spec-V2 instance to Home Assistant entity.
|
||||
from homeassistant.components.sensor import SensorDeviceClass
|
||||
from homeassistant.components.sensor import SensorStateClass
|
||||
from homeassistant.components.event import EventDeviceClass
|
||||
from homeassistant.components.binary_sensor import BinarySensorDeviceClass
|
||||
|
||||
from homeassistant.const import (
|
||||
CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
||||
@ -454,12 +455,28 @@ SPEC_PROP_TRANS_MAP: dict = {
|
||||
'format': {'int', 'float'},
|
||||
'access': {'read'}
|
||||
},
|
||||
'binary_sensor': {
|
||||
'format': {'bool', 'int', 'float'},
|
||||
'access': {'read'}
|
||||
},
|
||||
'switch': {
|
||||
'format': {'bool'},
|
||||
'access': {'read', 'write'}
|
||||
}
|
||||
},
|
||||
'properties': {
|
||||
'submersion-state': {
|
||||
'device_class': BinarySensorDeviceClass.MOISTURE,
|
||||
'entity': 'binary_sensor'
|
||||
},
|
||||
'contact-state': {
|
||||
'device_class': BinarySensorDeviceClass.DOOR,
|
||||
'entity': 'binary_sensor'
|
||||
},
|
||||
'occupancy-status': {
|
||||
'device_class': BinarySensorDeviceClass.OCCUPANCY,
|
||||
'entity': 'binary_sensor',
|
||||
},
|
||||
'temperature': {
|
||||
'device_class': SensorDeviceClass.TEMPERATURE,
|
||||
'entity': 'sensor',
|
||||
|
||||
Loading…
Reference in New Issue
Block a user