Skip to content

Commit

Permalink
🪞 add demist control for yeelink.mirror.bm1 (#1250)
Browse files Browse the repository at this point in the history
  • Loading branch information
al-one committed Mar 3, 2025
1 parent 275edbb commit 4acca98
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 46 deletions.
4 changes: 4 additions & 0 deletions custom_components/xiaomi_miot/core/device_customizes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2101,6 +2101,10 @@
'yeelink.light.*': {
'switch_properties': 'bg_on,init_power_opt,fan_init_power_opt',
},
'yeelink.mirror.bm1': {
'switch_properties': 'heat_control',
'number_properties': 'off_delay_time,heat_delayoff',
},
'yeelink.switch.sw1': {
'miot_mapping': {
'switch1.on': {'siid': 2, 'piid': 1},
Expand Down
49 changes: 36 additions & 13 deletions custom_components/xiaomi_miot/core/miio2miot_specs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2084,6 +2084,18 @@ def cbk(prop, params, props, **kwargs):
},
},

'yeelink.light._base': {
'miio_specs': {
'prop.2.1': {'prop': 'power', 'setter': True, 'format': 'onoff'},
'prop.2.2': {'prop': 'bright', 'setter': True},
'prop.2.3': {'prop': 'ct', 'setter': 'set_ct_abx', 'set_template': '{{ [value,"smooth",500] }}'},
'prop.2.102': {
'prop': 'delayoff',
'setter': 'set_scene',
'set_template': '{{ ["auto_delay_off",props.bright|default(100)|int,value] }}',
},
},
},
'yeelink.light.bslamp1': {
'extend_model': 'yeelink.light.color1',
'miio_specs': {
Expand Down Expand Up @@ -2180,7 +2192,7 @@ def cbk(prop, params, props, **kwargs):
},
},
'yeelink.light.ceiling6': {
'extend_model': 'yeelink.mirror.bm1',
'extend_model': 'yeelink.light._base',
'miio_props': ['nl_br'],
'miio_specs': {
'prop.2.2': {
Expand Down Expand Up @@ -2326,6 +2338,29 @@ def cbk(prop, params, props, **kwargs):
'yeelink.light.strip4': 'yeelink.light.ceiling16',
'yeelink.light.strip6': 'yeelink.light.strip2',
'yeelink.light.strip8': 'yeelink.light.strip2',
'yeelink.mirror.bm1': {
'miio_specs': {
'prop.2.1': {'prop': 'power', 'setter': True, 'format': 'onoff'},
'prop.2.2': {'prop': 'bright', 'setter': True},
'prop.2.3': {'prop': 'ct', 'setter': 'set_ct_abx', 'set_template': '{{ [value,"smooth",500] }}'},
'prop.2.102': {
'prop': 'delayoff',
'setter': 'set_scene',
'set_template': '{{ ["auto_delay_off",props.bright|default(100)|int,value] }}',
},
'prop.200.201': {
'prop': 'heat_control',
'setter': 'set_ps',
'template': '{{ value|int == 1 }}',
'set_template': '{{ ["heat_control",value|int] }}',
},
'prop.200.202': {
'prop': 'heat_delayoff',
'setter': 'set_ps',
'set_template': '{{ ["heat_delayoff",value] }}',
},
},
},
'yeelink.ven_fan.vf1': {
'miio_specs': {
'prop.2.1': {
Expand All @@ -2346,18 +2381,6 @@ def cbk(prop, params, props, **kwargs):
},
},
},
'yeelink.mirror.bm1': {
'miio_specs': {
'prop.2.1': {'prop': 'power', 'setter': True, 'format': 'onoff'},
'prop.2.2': {'prop': 'bright', 'setter': True},
'prop.2.3': {'prop': 'ct', 'setter': 'set_ct_abx', 'set_template': '{{ [value,"smooth",500] }}'},
'prop.2.102': {
'prop': 'delayoff',
'setter': 'set_scene',
'set_template': '{{ ["auto_delay_off",props.bright|default(100)|int,value] }}',
},
},
},
'yeelink.ven_fan.vf3': {
'extend_model': 'yeelink.ven_fan.vf5',
'miio_specs': {
Expand Down
95 changes: 62 additions & 33 deletions custom_components/xiaomi_miot/core/miot_specs_extend.json
Original file line number Diff line number Diff line change
Expand Up @@ -1387,37 +1387,6 @@
}
],

"yeelink.light.color1": [
{
"iid": 2,
"properties": [
{
"iid": 101,
"type": "urn:miot-spec-v2:property:nl_br",
"description": "Nightlight Brightness",
"format": "uint8",
"access": ["read", "write"],
"unit": "percentage",
"value-range": [1, 100, 1]
},
{
"iid": 102,
"type": "urn:miot-spec-v2:property:off-delay-time",
"format": "uint32",
"access": ["read", "write"],
"unit": "minutes",
"value-range": [0, 60, 1]
}
]
}
],
"yeelink.light.color2": "yeelink.light.color1",
"yeelink.light.color3": "yeelink.light.color1",
"yeelink.light.color4": "yeelink.light.color1",
"yeelink.light.color5": "yeelink.light.color1",
"yeelink.light.color6": "yeelink.light.color1",
"yeelink.light.color7": "yeelink.light.color1",
"yeelink.light.color8": "yeelink.light.color1",
"yeelink.light.ceiling1": [
{
"iid": 2,
Expand Down Expand Up @@ -1524,6 +1493,37 @@
"yeelink.light.ceiling22": "yeelink.light.ceiling1",
"yeelink.light.ceiling23": "yeelink.light.ceiling1",
"yeelink.light.ceiling24": "yeelink.light.ceiling1",
"yeelink.light.color1": [
{
"iid": 2,
"properties": [
{
"iid": 101,
"type": "urn:miot-spec-v2:property:nl_br",
"description": "Nightlight Brightness",
"format": "uint8",
"access": ["read", "write"],
"unit": "percentage",
"value-range": [1, 100, 1]
},
{
"iid": 102,
"type": "urn:miot-spec-v2:property:off-delay-time",
"format": "uint32",
"access": ["read", "write"],
"unit": "minutes",
"value-range": [0, 60, 1]
}
]
}
],
"yeelink.light.color2": "yeelink.light.color1",
"yeelink.light.color3": "yeelink.light.color1",
"yeelink.light.color4": "yeelink.light.color1",
"yeelink.light.color5": "yeelink.light.color1",
"yeelink.light.color6": "yeelink.light.color1",
"yeelink.light.color7": "yeelink.light.color1",
"yeelink.light.color8": "yeelink.light.color1",
"yeelink.light.fancl5": [
{
"iid": 3,
Expand All @@ -1550,8 +1550,6 @@
]
}
],
"yeelink.light.panel1": "yeelink.light.ceiling1",
"yeelink.light.panel3": "yeelink.light.ceiling1",
"yeelink.light.lamp15": [
{
"iid": 200,
Expand Down Expand Up @@ -1585,6 +1583,37 @@
]
}
],
"yeelink.light.panel1": "yeelink.light.ceiling1",
"yeelink.light.panel3": "yeelink.light.ceiling1",
"yeelink.mirror.bm1": [
{
"iid": 2,
"properties": [
{
"iid": 102,
"type": "urn:miot-spec-v2:property:off-delay-time",
"format": "uint32",
"access": ["read", "write"],
"unit": "minutes",
"value-range": [0, 60, 1]
},
{
"iid": 201,
"type": "urn:miot-spec-v2:property:heat_control",
"format": "bool",
"access": ["read", "write"]
},
{
"iid": 202,
"type": "urn:miot-spec-v2:property:heat_delayoff",
"format": "uint32",
"access": ["read", "write"],
"unit": "minutes",
"value-range": [0, 120, 5]
}
]
}
],

"yunmi.waterpuri.lx5": [
{
Expand Down

0 comments on commit 4acca98

Please # to comment.