-
Notifications
You must be signed in to change notification settings - Fork 824
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: potential problems for properties identification error for sensors #595
base: main
Are you sure you want to change the base?
Conversation
@@ -415,12 +423,12 @@ | |||
'unit_of_measurement': UnitOfPower.WATT | |||
} | |||
}, | |||
'electric-current': { | |||
'device_class': SensorDeviceClass.CURRENT, | |||
'over-electric-power': { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
over-electric-power is a invalid SPEC prop
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sorry but maybe I didn't notice before, how can I know if something is a valid SPEC prop? In the issue #589 it has "过功率" as a property, and I have no idea what's its SPEC prop is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The SPEC is defined as follows: http://miot-spec.srv/miot-spec-v2/instance?type=urn:miot-spec-v2:device:outlet:0000A002:chuangmi-212a01:3
{
"iid": 5,
"type": "urn:miot-spec-v2:service:power-consumption:0000780E:chuangmi-212a01:1",
"description": "Power Consumption",
"properties": [
{
"iid": 1,
"type": "urn:miot-spec-v2:property:power-consumption:0000002F:chuangmi-212a01:1",
"description": "Power Consumption",
"format": "uint32",
"access": [
"read",
"notify"
],
"unit": "none",
"value-range": [
0,
65535000,
1
]
},
{
"iid": 2,
"type": "urn:miot-spec-v2:property:electric-current:00000030:chuangmi-212a01:1",
"description": "Electric Current",
"format": "uint16",
"access": [
"read",
"notify"
],
"value-range": [
0,
65535,
1
]
},
{
"iid": 3,
"type": "urn:miot-spec-v2:property:voltage:00000031:chuangmi-212a01:1",
"description": "Voltage",
"format": "uint16",
"access": [
"read",
"notify"
],
"value-range": [
0,
65535,
1
]
},
{
"iid": 6,
"type": "urn:miot-spec-v2:property:electric-power:00000066:chuangmi-212a01:1",
"description": "Electric Power",
"format": "uint32",
"access": [
"read",
"notify"
],
"unit": "watt",
"value-range": [
0,
6553500,
1
],
"gatt-access": []
},
{
"iid": 7,
"type": "urn:miot-spec-v2:property:surge-power:00000033:chuangmi-212a01:2",
"description": "Surge power",
"format": "uint32",
"access": [
"read",
"notify"
],
"value-range": [
0,
65525,
1
]
}
]
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Although I cannot open the link, I changed the corresponding SPEC name from the code you provided.
Issue
To fix #589
Why?
The SPEC_PROP_TRANS_MAP in specs/specv2entity.py seem to have potential problems for electrical current, power assumption and over load power assumption (OPP). For features like OPP, there seems to have no clear definitions in Home Assistant Sensor properties. For others, I believe the mapping can be the source of idenfication errors.