Closed sonicmingit closed 1 year ago
# https://miot-spec.org/miot-spec-v2/instance?type=urn:miot-spec-v2:device:outlet:0000A002:chuangmi-212a01:1
{
"type" : "urn:miot-spec-v2:device:outlet:0000A002:chuangmi-212a01:1",
"services" : [
{
"description" : "Device Information",
"properties" : [
{
"iid" : 1,
"type" : "urn:miot-spec-v2:property:manufacturer:00000001:chuangmi-212a01:1",
"access" : [
"read"
],
"format" : "string",
"description" : "Device Manufacturer"
},
{
"description" : "Device Model",
"iid" : 2,
"type" : "urn:miot-spec-v2:property:model:00000002:chuangmi-212a01:1",
"access" : [
"read"
],
"format" : "string"
},
{
"description" : "Device Serial Number",
"type" : "urn:miot-spec-v2:property:serial-number:00000003:chuangmi-212a01:1",
"format" : "string",
"access" : [
"read"
],
"iid" : 3
},
{
"description" : "Current Firmware Version",
"iid" : 4,
"access" : [
"read"
],
"format" : "string",
"type" : "urn:miot-spec-v2:property:firmware-revision:00000005:chuangmi-212a01:1"
}
],
"type" : "urn:miot-spec-v2:service:device-information:00007801:chuangmi-212a01:1",
"iid" : 1
},
{
"description" : "Switch",
"iid" : 2,
"type" : "urn:miot-spec-v2:service:switch:0000780C:chuangmi-212a01:1",
"properties" : [
{
"iid" : 1,
"type" : "urn:miot-spec-v2:property:on:00000006:chuangmi-212a01:1",
"format" : "bool",
"access" : [
"read",
"write",
"notify"
],
"description" : "Switch Status"
},
{
"format" : "uint8",
"value-range" : [
0,
255,
1
],
"description" : "Temperature",
"type" : "urn:miot-spec-v2:property:temperature:00000020:chuangmi-212a01:1",
"access" : [
"read",
"notify"
],
"iid" : 6,
"unit" : "celsius"
},
{
"description" : "Working Time",
"type" : "urn:miot-spec-v2:property:working-time:00000079:chuangmi-212a01:1",
"access" : [
"read",
"notify"
],
"unit" : "minutes",
"iid" : 7,
"format" : "uint32",
"value-range" : [
0,
300,
1
]
}
]
},
{
"description" : "Indicator Light",
"iid" : 3,
"properties" : [
{
"iid" : 1,
"format" : "bool",
"access" : [
"read",
"write",
"notify"
],
"type" : "urn:miot-spec-v2:property:on:00000006:chuangmi-212a01:1",
"description" : "Switch Status"
}
],
"type" : "urn:miot-spec-v2:service:indicator-light:00007803:chuangmi-212a01:1"
},
{
"description" : "Power Consumption",
"type" : "urn:miot-spec-v2:service:power-consumption:0000780E:chuangmi-212a01:1",
"properties" : [
{
"description" : "Power Consumption",
"iid" : 1,
"unit" : "none",
"access" : [
"read",
"notify"
],
"type" : "urn:miot-spec-v2:property:power-consumption:0000002F:chuangmi-212a01:1",
"value-range" : [
0,
65535000,
1
],
"format" : "uint32"
},
{
"type" : "urn:miot-spec-v2:property:electric-current:00000030:chuangmi-212a01:1",
"access" : [
"read",
"notify"
],
"format" : "uint16",
"value-range" : [
0,
65535,
1
],
"iid" : 2,
"description" : "Electric Current"
},
{
"iid" : 3,
"value-range" : [
0,
65535,
1
],
"format" : "uint16",
"access" : [
"read",
"notify"
],
"type" : "urn:miot-spec-v2:property:voltage:00000031:chuangmi-212a01:1",
"description" : "Voltage"
},
{
"description" : "Electric Power",
"access" : [
"read",
"notify"
],
"type" : "urn:miot-spec-v2:property:electric-power:00000066:chuangmi-212a01:1",
"unit" : "watt",
"iid" : 6,
"format" : "uint32",
"value-range" : [
0,
6553500,
1
]
}
],
"iid" : 5
},
{
"iid" : 4,
"type" : "urn:chuangmi-spec:service:imilab-timer:00007801:chuangmi-212a01:1",
"properties" : [
{
"value-range" : [
0,
86500,
1
],
"format" : "uint32",
"description" : "on-duration",
"iid" : 1,
"unit" : "seconds",
"access" : [
"read",
"notify",
"write"
],
"type" : "urn:chuangmi-spec:property:on-duration:00000001:chuangmi-212a01:1"
},
{
"value-range" : [
0,
86500,
1
],
"format" : "uint32",
"description" : "off-duration",
"unit" : "seconds",
"iid" : 2,
"access" : [
"read",
"notify",
"write"
],
"type" : "urn:chuangmi-spec:property:off-duration:00000002:chuangmi-212a01:1"
},
{
"format" : "uint32",
"value-range" : [
0,
86500,
1
],
"description" : "countdown",
"type" : "urn:chuangmi-spec:property:countdown:00000003:chuangmi-212a01:1",
"access" : [
"read",
"notify",
"write"
],
"unit" : "seconds",
"iid" : 3
},
{
"description" : "task-switch",
"iid" : 4,
"unit" : "none",
"type" : "urn:chuangmi-spec:property:task-switch:00000004:chuangmi-212a01:1",
"access" : [
"read",
"notify",
"write"
],
"format" : "bool"
},
{
"format" : "bool",
"unit" : "none",
"iid" : 5,
"type" : "urn:chuangmi-spec:property:countdown-info:00000005:chuangmi-212a01:1",
"access" : [
"read",
"notify"
],
"description" : "countdown-info"
},
{
"description" : "switch-toggle",
"type" : "urn:chuangmi-spec:property:switch-toggle:00000006:chuangmi-212a01:1",
"access" : [
"write"
],
"iid" : 6,
"unit" : "none",
"format" : "bool"
}
],
"description" : "imilab-timer"
},
{
"events" : [
{
"description" : "event",
"arguments" : [
1
],
"type" : "urn:chuangmi-spec:event:event:00005001:chuangmi-212a01:1",
"iid" : 1
}
],
"iid" : 6,
"properties" : [
{
"format" : "bool",
"description" : "switch-event",
"iid" : 1,
"unit" : "none",
"access" : [
"notify"
],
"type" : "urn:chuangmi-spec:property:switch-event:00000001:chuangmi-212a01:1"
}
],
"type" : "urn:chuangmi-spec:service:relay-event:00007802:chuangmi-212a01:1",
"description" : "relay-event"
}
],
"description" : "Outlet"
}
It looks like the device doesn't expose the bluetooth gateway via miot.
"description" : "Device Information",
"description" : "Device Manufacturer",
"description" : "Device Model",
"description" : "Device Serial Number",
"description" : "Current Firmware Version"
"description" : "Switch Status",
"description" : "Temperature",
"description" : "Working Time",
"description" : "Switch"
"description" : "Switch Status",
"description" : "Indicator Light"
"description" : "Power Consumption",
"description" : "Power Consumption",
"description" : "Electric Current"
"description" : "Voltage",
"description" : "Electric Power"
"description" : "on-duration",
"description" : "off-duration",
"description" : "countdown",
"description" : "task-switch",
"description" : "countdown-info",
"description" : "switch-toggle",
"description" : "imilab-timer",
"description" : "event"
"description" : "switch-event",
"description" : "relay-event"
"description" : "Outlet"
ble gateway is never exposed. it just pass data to cloud from ble sensors in range.
@syssi Can the socket switch status and power be obtained like the previous version?
Should be possible, yes.
{
# Source https://miot-spec.org/miot-spec-v2/instance?type=urn:miot-spec-v2:device:outlet:0000A002:chuangmi-212a01:1
"power": {"siid": 2, "piid": 1},
"temperature": {"siid": 2, "piid": 6},
"working_time": {"siid": 2, "piid": 7},
"led": {"siid": 3, "piid": 1},
"power_consumption": {"siid": 5, "piid": 1},
"current": {"siid": 5, "piid": 2},
"voltage": {"siid": 5, "piid": 3},
"power": {"siid": 5, "piid": 6},
"on_duration": {"siid": 4, "piid": 1},
"off_duration": {"siid": 4, "piid": 2},
"countdown": {"siid": 4, "piid": 3},
"task_switch": {"siid": 4, "piid": 4},
"countdown_info": {"siid": 4, "piid": 5},
"switch_toggle" {"siid": 4, "piid": 6},
},
Hi, @syssi I tried to support this device. but it come out some error, what I do is add the type of 212a01 to the chuangmi_plug and discovery, it does't work. please help me
@ziqiDev The device isn't supported right now.
any progress now?
Also waiting for a solution.
waiting for the solution
hope it can be supported soon..!
hope it can be supported soon..!
Is there any progress?
This is one of my new year's wishes :-)
求解决
Same!!!! Please help us!
Unsupported device found! Please create an issue at https://github.com/rytilahti/python-miio/issues and provide the following data: chuangmi.plug.212a01
It can be accessed at this format:
get the state of the switch
{"id":65028,"method":"get_properties","params":[{"did":"xxx","siid": 2, "piid": 1}]}
turn on the switch
{"id":65029,"method":"set_properties","params":[{"did":"xxx","siid": 2, "piid": 1,"value":true}]}
i tested with chuangmi.plug.212a01 and it works!
verification video attached: https://www.youtube.com/watch?v=-XNrR7BpW5c
Does it work on the current release?
Dear @ms300
{"id":65028,"method":"get_properties","params":[{"did":"xxx","siid": 2, "piid": 1}]} {"id":65029,"method":"set_properties","params":[{"did":"xxx","siid": 2, "piid": 1,"value":true}]}
How do I use this to control my plugs (This code is not similar to the ones I have come across in configurations of Home assistant or automations of Domoticz)? Could you provide a quick guide or some tips on what to learn to apply your code and make my sockets work?
Dear @ms300
{"id":65028,"method":"get_properties","params":[{"did":"xxx","siid": 2, "piid": 1}]} {"id":65029,"method":"set_properties","params":[{"did":"xxx","siid": 2, "piid": 1,"value":true}]}
How do I use this to control my plugs (This code is not similar to the ones I have come across in configurations of Home assistant or automations of Domoticz)? Could you provide a quick guide or some tips on what to learn to apply your code and make my sockets work?
Dear @ms300, you are so cool! Thank you!!!! You saved me time, money and made my morning happy !!!! After a bit of googling, I was able to figure out how to use the codes you sent !!!!
I will leave a small instruction for those who are new to this topic:
miiocli -d device --ip YOUR_DEVICE_IP --token YOUR_DEVICE_TOKEN raw_command get_properties "[{'did': 'MYDID', 'siid': 2, 'piid': 1 }]"
miiocli -d device --ip YOUR_DEVICE_IP --token YOUR_DEVICE_TOKEN raw_command set_properties "[{'did': 'MYDID', 'siid': 2, 'piid': 1, 'value':True}]"
(notice, that True must be written with big T)sensor:
- platform: xiaomi_miio_raw
name: smart_plug
host: 192.168.x.x
token: xxxxxxxxxx
max_properties: 10
default_properties_getter: get_properties
default_properties:
- "{'did': 'power', 'piid': 1, 'siid': 2}"
- "{'did': 'temperature', 'piid': 6, 'siid': 2}"
- "{'did': 'indicator_light', 'piid': 1, 'siid': 3}"
- "{'did': 'on_duration', 'piid': 1, 'siid': 4}"
- "{'did': 'off_duration', 'piid': 2, 'siid': 4}"
- "{'did': 'countdown', 'piid': 3, 'siid': 4}"
- "{'did': 'task_switch', 'piid': 4, 'siid': 4}"
- "{'did': 'countdown_info', 'piid': 5, 'siid': 4}"
- "{'did': 'power_consumption', 'piid': 1, 'siid': 5}"
- "{'did': 'electric_current', 'piid': 2, 'siid': 5}"
- "{'did': 'voltage', 'piid': 3, 'siid': 5}"
- "{'did': 'electric_power', 'piid': 6, 'siid': 5}"
- platform: template
sensors:
smart_plug_power:
unique_id: smart_plug_power
unit_of_measurement: W
value_template: "{{ state_attr('sensor.smart_plug', 'electric_power')/100 }}"
availability_template: "{{ not is_state('sensor.smart_plug', 'unavailable') }}"
icon_template: "mdi:flash"
switch:
- platform: template
switches:
smart_plug_switch:
unique_id: smart_plug_switch
value_template: "{{ state_attr('sensor.smart_plug', 'power') }}"
availability_template: "{{ not is_state('sensor.smart_plug', 'unavailable') }}"
turn_on:
service: xiaomi_miio_raw.sensor_raw_command
data:
entity_id: sensor.smart_plug
method: set_properties
params:
- did: power
siid: 2
piid: 1
value: true
turn_off:
service: xiaomi_miio_raw.sensor_raw_command
data:
entity_id: sensor.smart_plug
method: set_properties
params:
- did: power
siid: 2
piid: 1
value: false
Wow! This is working without any change of the custom component?
@lovelylain Thanks for the yaml. did is supposed to be the device ID of the plug not the name of the properties.
小米miot知识讲解及设备接入【6日更新支持cover、加速响应】 - 『HomeAssistant』综合讨论区 - 『瀚思彼岸』» 智能家居技术论坛 - Powered by Discuz!: https://bbs.hassbian.com/thread-11749-1-1.html
ha0y/xiaomi_miot_raw: https://github.com/ha0y/xiaomi_miot_raw
小米miot知识讲解及设备接入【6日更新支持cover、加速响应】 - 『HomeAssistant』综合讨论区 - 『瀚思彼岸』» 智能家居技术论坛 - Powered by Discuz!: https://bbs.hassbian.com/thread-11749-1-1.html
ha0y/xiaomi_miot_raw: https://github.com/ha0y/xiaomi_miot_raw
居然真的可以,之前还在瀚思彼岸看到这个帖子,都没注意. 非常感谢.
小米miot知识讲解及设备接入【6日更新支持cover、加速响应】 - 『HomeAssistant』综合讨论区 - 『瀚思彼岸』» 智能家居技术论坛 - Powered by Discuz!: https://bbs.hassbian.com/thread-11749-1-1.html
ha0y/xiaomi_miot_raw: https://github.com/ha0y/xiaomi_miot_raw
Thank you very much. It works
switch:
- platform: xiaomi_miot_raw
name: smart_ble_plug
host: !secret smart_ble_plug_host
token: !secret smart_ble_plug_token
mapping:
switch_status:
siid: 2
piid: 1
temperature:
siid: 2
piid: 6
power:
siid: 5
piid: 6
params:
switch_status:
power_on: True
power_off: False
小米miot知识讲解及设备接入【6日更新支持cover、加速响应】 - 『HomeAssistant』综合讨论区 - 『瀚思彼岸』» 智能家居技术论坛 - Powered by Discuz!: https://bbs.hassbian.com/thread-11749-1-1.html
ha0y/xiaomi_miot_raw: https://github.com/ha0y/xiaomi_miot_raw
这个太棒了,感觉可以写一个HomeBridge的大一统插件了
@ms300 @MystiqueWind @lovelylain great, thanks
@syssi no, must modify code. I just submitted a pull request to your repo. https://github.com/syssi/xiaomi_raw/pull/11/commits
@ms300 did must exist, but it will not be checked for this plug, so I use it as the property name. For devices that will check the did, you can set it like this "{'name': 'power', 'did': 'xxxx', 'piid': 1, 'siid': 2}"
https://github.com/syssi/xiaomi_raw/pull/11/commits/4b155d094787c93f3cb2e7ae66709f9b4c8bcbd7#diff-b1cb0a6decbd6619adb0a70516e3300a7ba9504d8d904ad77b0e729ef88782a1R189
Thank you very much. It really works. chuangmi.plug.212a01
sensor: - platform: xiaomi_miio_raw name: smart_plug host: 192.168.x.x token: xxxxxxxxxx max_properties: 10 default_properties_getter: get_properties default_properties: - "{'did': 'power', 'piid': 1, 'siid': 2}" - "{'did': 'temperature', 'piid': 6, 'siid': 2}" - "{'did': 'indicator_light', 'piid': 1, 'siid': 3}" - "{'did': 'on_duration', 'piid': 1, 'siid': 4}" - "{'did': 'off_duration', 'piid': 2, 'siid': 4}" - "{'did': 'countdown', 'piid': 3, 'siid': 4}" - "{'did': 'task_switch', 'piid': 4, 'siid': 4}" - "{'did': 'countdown_info', 'piid': 5, 'siid': 4}" - "{'did': 'power_consumption', 'piid': 1, 'siid': 5}" - "{'did': 'electric_current', 'piid': 2, 'siid': 5}" - "{'did': 'voltage', 'piid': 3, 'siid': 5}" - "{'did': 'electric_power', 'piid': 6, 'siid': 5}" - platform: template sensors: smart_plug_power: unique_id: smart_plug_power unit_of_measurement: W value_template: "{{ state_attr('sensor.smart_plug', 'electric_power')/100 }}" availability_template: "{{ not is_state('sensor.smart_plug', 'unavailable') }}" icon_template: "mdi:flash" switch: - platform: template switches: smart_plug_switch: unique_id: smart_plug_switch value_template: "{{ state_attr('sensor.smart_plug', 'power') }}" availability_template: "{{ not is_state('sensor.smart_plug', 'unavailable') }}" turn_on: service: xiaomi_miio_raw.sensor_raw_command data: entity_id: sensor.smart_plug method: set_properties params: - did: power siid: 2 piid: 1 value: true turn_off: service: xiaomi_miio_raw.sensor_raw_command data: entity_id: sensor.smart_plug method: set_properties params: - did: power siid: 2 piid: 1 value: false
Hello, I am new to this topic and was very happy to get my chuangmi.plug.212a01 up and running in home assistant using this code. My question is how I can set up multiple Sockets at once in this configuration. Best regards, David
Hello,
Thanks a lot to make it working. Is there any plan to support it officially in Home Assistant without a custom component?
@DavidBoettger add mutiple xiaomi_miio_raw config under 'sensor' and mutiple switch config under 'switches', do not forget to modify name.
@DavidBoettger add mutiple xiaomi_miio_raw config under 'sensor' and mutiple switch config under 'switches', do not forget to modify name.
Thanks for your answer. I tried it like this, but now I have two switches that both control my paper lamp. The power output is also just the one of the paper lamp. sensor:
platform: xiaomi_miio_raw name: Paper Lamp host: 192.168.50.80 token: 141061fd4g3b0547bc8f225cede1477e max_properties: 10 default_properties_getter: get_properties default_properties:
platform: template sensors: paper_lamp_power: unique_id: smart_plug_power unit_of_measurement: W value_template: "{{ state_attr('sensor.smart_plug', 'electric_power')/100 }}" availability_template: "{{ not is_state('sensor.smart_plug', 'unavailable') }}" icon_template: "mdi:flash"
platform: xiaomi_miio_raw name: Heating Solutions host: 192.168.50.210 token: 71135aab337c8205e934acedf74806d7 max_properties: 10 default_properties_getter: get_properties default_properties:
platform: template sensors: heating_solutions_power: unique_id: heating_solutions_power unit_of_measurement: W value_template: "{{ state_attr('sensor.smart_plug', 'electric_power')/100 }}" availability_template: "{{ not is_state('sensor.smart_plug', 'unavailable') }}" icon_template: "mdi:flash"
switch:
platform: template switches: paper_lamp_switch: unique_id: smart_plug_switch value_template: "{{ state_attr('sensor.smart_plug', 'power') }}" availability_template: "{{ not is_state('sensor.smart_plug', 'unavailable') }}" turn_on: service: xiaomi_miio_raw.sensor_raw_command data: entity_id: sensor.smart_plug method: set_properties params:
platform: template switches: heating_solutions_switch: unique_id: heating_solutions_switch value_template: "{{ state_attr('sensor.smart_plug', 'power') }}" availability_template: "{{ not is_state('sensor.smart_plug', 'unavailable') }}" turn_on: service: xiaomi_miio_raw.sensor_raw_command data: entity_id: sensor.smart_plug method: set_properties params:
I think the problem is happening, because both switches plugs are referring to sensor.smart_plug. Any idea how to change that? Am I missing something? Best regards, David
@DavidBoettger
sensor:
- platform: xiaomi_miio_raw
name: Paper Lamp
host: 192.168.50.80
token: 141061fd4g3b0547bc8f225cede1477e
max_properties: 10
default_properties_getter: get_properties
default_properties:
- "{'did': 'power', 'piid': 1, 'siid': 2}"
- "{'did': 'temperature', 'piid': 6, 'siid': 2}"
- "{'did': 'indicator_light', 'piid': 1, 'siid': 3}"
- "{'did': 'on_duration', 'piid': 1, 'siid': 4}"
- "{'did': 'off_duration', 'piid': 2, 'siid': 4}"
- "{'did': 'countdown', 'piid': 3, 'siid': 4}"
- "{'did': 'task_switch', 'piid': 4, 'siid': 4}"
- "{'did': 'countdown_info', 'piid': 5, 'siid': 4}"
- "{'did': 'power_consumption', 'piid': 1, 'siid': 5}"
- "{'did': 'electric_current', 'piid': 2, 'siid': 5}"
- "{'did': 'voltage', 'piid': 3, 'siid': 5}"
- "{'did': 'electric_power', 'piid': 6, 'siid': 5}"
- platform: xiaomi_miio_raw
name: Heating Solutions
host: 192.168.50.210
token: 71135aab337c8205e934acedf74806d7
max_properties: 10
default_properties_getter: get_properties
default_properties:
- "{'did': 'power', 'piid': 1, 'siid': 2}"
- "{'did': 'temperature', 'piid': 6, 'siid': 2}"
- "{'did': 'indicator_light', 'piid': 1, 'siid': 3}"
- "{'did': 'on_duration', 'piid': 1, 'siid': 4}"
- "{'did': 'off_duration', 'piid': 2, 'siid': 4}"
- "{'did': 'countdown', 'piid': 3, 'siid': 4}"
- "{'did': 'task_switch', 'piid': 4, 'siid': 4}"
- "{'did': 'countdown_info', 'piid': 5, 'siid': 4}"
- "{'did': 'power_consumption', 'piid': 1, 'siid': 5}"
- "{'did': 'electric_current', 'piid': 2, 'siid': 5}"
- "{'did': 'voltage', 'piid': 3, 'siid': 5}"
- "{'did': 'electric_power', 'piid': 6, 'siid': 5}"
- platform: template
sensors:
paper_lamp_power:
unique_id: paper_lamp_power
unit_of_measurement: W
value_template: "{{ state_attr('sensor.paper_lamp', 'electric_power')/100 }}"
availability_template: "{{ not is_state('sensor.paper_lamp', 'unavailable') }}"
icon_template: "mdi:flash"
heating_solutions_power:
unique_id: heating_solutions_power
unit_of_measurement: W
value_template: "{{ state_attr('sensor.heating_solutions', 'electric_power')/100 }}"
availability_template: "{{ not is_state('sensor.heating_solutions', 'unavailable') }}"
icon_template: "mdi:flash"
switch:
- platform: template
switches:
paper_lamp_switch:
unique_id: paper_lamp_switch
value_template: "{{ state_attr('sensor.paper_lamp', 'power') }}"
availability_template: "{{ not is_state('sensor.paper_lamp', 'unavailable') }}"
turn_on:
service: xiaomi_miio_raw.sensor_raw_command
data:
entity_id: sensor.paper_lamp
method: set_properties
params:
- did: power
siid: 2
piid: 1
value: true
turn_off:
service: xiaomi_miio_raw.sensor_raw_command
data:
entity_id: sensor.paper_lamp
method: set_properties
params:
- did: power
siid: 2
piid: 1
value: false
heating_solutions_switch:
unique_id: heating_solutions_switch
value_template: "{{ state_attr('sensor.heating_solutions', 'power') }}"
availability_template: "{{ not is_state('sensor.heating_solutions', 'unavailable') }}"
turn_on:
service: xiaomi_miio_raw.sensor_raw_command
data:
entity_id: sensor.heating_solutions
method: set_properties
params:
- did: power
siid: 2
piid: 1
value: true
turn_off:
service: xiaomi_miio_raw.sensor_raw_command
data:
entity_id: sensor.heating_solutions
method: set_properties
params:
- did: power
siid: 2
piid: 1
value: false
https://github.com/al-one/hass-xiaomi-miot
This component is also supported well without yaml.
https://github.com/al-one/hass-xiaomi-miot/issues/12#issuecomment-770413743
@DavidBoettger
sensor: - platform: xiaomi_miio_raw name: Paper Lamp host: 192.168.50.80 token: 141061fd4g3b0547bc8f225cede1477e max_properties: 10 default_properties_getter: get_properties default_properties: - "{'did': 'power', 'piid': 1, 'siid': 2}" - "{'did': 'temperature', 'piid': 6, 'siid': 2}" - "{'did': 'indicator_light', 'piid': 1, 'siid': 3}" - "{'did': 'on_duration', 'piid': 1, 'siid': 4}" - "{'did': 'off_duration', 'piid': 2, 'siid': 4}" - "{'did': 'countdown', 'piid': 3, 'siid': 4}" - "{'did': 'task_switch', 'piid': 4, 'siid': 4}" - "{'did': 'countdown_info', 'piid': 5, 'siid': 4}" - "{'did': 'power_consumption', 'piid': 1, 'siid': 5}" - "{'did': 'electric_current', 'piid': 2, 'siid': 5}" - "{'did': 'voltage', 'piid': 3, 'siid': 5}" - "{'did': 'electric_power', 'piid': 6, 'siid': 5}" - platform: xiaomi_miio_raw name: Heating Solutions host: 192.168.50.210 token: 71135aab337c8205e934acedf74806d7 max_properties: 10 default_properties_getter: get_properties default_properties: - "{'did': 'power', 'piid': 1, 'siid': 2}" - "{'did': 'temperature', 'piid': 6, 'siid': 2}" - "{'did': 'indicator_light', 'piid': 1, 'siid': 3}" - "{'did': 'on_duration', 'piid': 1, 'siid': 4}" - "{'did': 'off_duration', 'piid': 2, 'siid': 4}" - "{'did': 'countdown', 'piid': 3, 'siid': 4}" - "{'did': 'task_switch', 'piid': 4, 'siid': 4}" - "{'did': 'countdown_info', 'piid': 5, 'siid': 4}" - "{'did': 'power_consumption', 'piid': 1, 'siid': 5}" - "{'did': 'electric_current', 'piid': 2, 'siid': 5}" - "{'did': 'voltage', 'piid': 3, 'siid': 5}" - "{'did': 'electric_power', 'piid': 6, 'siid': 5}" - platform: template sensors: paper_lamp_power: unique_id: paper_lamp_power unit_of_measurement: W value_template: "{{ state_attr('sensor.paper_lamp', 'electric_power')/100 }}" availability_template: "{{ not is_state('sensor.paper_lamp', 'unavailable') }}" icon_template: "mdi:flash" heating_solutions_power: unique_id: heating_solutions_power unit_of_measurement: W value_template: "{{ state_attr('sensor.heating_solutions', 'electric_power')/100 }}" availability_template: "{{ not is_state('sensor.heating_solutions', 'unavailable') }}" icon_template: "mdi:flash" switch: - platform: template switches: paper_lamp_switch: unique_id: paper_lamp_switch value_template: "{{ state_attr('sensor.paper_lamp', 'power') }}" availability_template: "{{ not is_state('sensor.paper_lamp', 'unavailable') }}" turn_on: service: xiaomi_miio_raw.sensor_raw_command data: entity_id: sensor.paper_lamp method: set_properties params: - did: power siid: 2 piid: 1 value: true turn_off: service: xiaomi_miio_raw.sensor_raw_command data: entity_id: sensor.paper_lamp method: set_properties params: - did: power siid: 2 piid: 1 value: false heating_solutions_switch: unique_id: heating_solutions_switch value_template: "{{ state_attr('sensor.heating_solutions', 'power') }}" availability_template: "{{ not is_state('sensor.heating_solutions', 'unavailable') }}" turn_on: service: xiaomi_miio_raw.sensor_raw_command data: entity_id: sensor.heating_solutions method: set_properties params: - did: power siid: 2 piid: 1 value: true turn_off: service: xiaomi_miio_raw.sensor_raw_command data: entity_id: sensor.heating_solutions method: set_properties params: - did: power siid: 2 piid: 1 value: false
Hello, I tried this code, but this time only the heating_solutions switch and sensor works and my paper_lamp is listed as unknown and not available. I hope you can find a solution, David
@DavidBoettger The entity_id must match.
Hello, I don't know where to ask, it looks most of the questions are here. So I post my question here.
I need to get the total power consumption report of the device, but when I try to get the value 'power_consumption', it always yield the number 100. even a new device.
here fllows my settings:
sensor:
- platform: xiaomi_miio_raw
name: WorkStation
host: 10.0.0.*
token: t_o_k_e_n
max_properties: 10
default_properties_getter: get_properties
default_properties:
- "{'did': 'power', 'piid': 1, 'siid': 2}"
- "{'did': 'temperature', 'piid': 6, 'siid': 2}"
- "{'did': 'indicator_light', 'piid': 1, 'siid': 3}"
- "{'did': 'on_duration', 'piid': 1, 'siid': 4}"
- "{'did': 'off_duration', 'piid': 2, 'siid': 4}"
- "{'did': 'countdown', 'piid': 3, 'siid': 4}"
- "{'did': 'task_switch', 'piid': 4, 'siid': 4}"
- "{'did': 'countdown_info', 'piid': 5, 'siid': 4}"
- "{'did': 'power_consumption', 'piid': 1, 'siid': 5}"
- "{'did': 'electric_current', 'piid': 2, 'siid': 5}"
- "{'did': 'voltage', 'piid': 3, 'siid': 5}"
- "{'did': 'electric_power', 'piid': 6, 'siid': 5}"
- platform: template
sensors:
smart_plug_pusage_1:
unique_id: smart_plug_pusage_1
unit_of_measurement: Wh
value_template: "{{ state_attr('sensor.WorkStation', 'power_consumption') }}"
availability_template: "{{ not is_state('sensor.WorkStation', 'unavailable') }}"
icon_template: "mdi:flash"
Any advisement would be appreciated.
Hello. What is still pending for closing it? It would be great if the official miio integration in Home Assistant supports this device. Thanks!
still does not work on the latest version!
This device should have been supported months ago. @ssarioglu @a1ekseev If you use it in Home Assistant, you may try https://github.com/ha0y/xiaomi_miot_raw
I cant use my devices let me check thanks
This device should have been supported months ago. @ssarioglu @a1ekseev If you use it in Home Assistant, you may try https://github.com/ha0y/xiaomi_miot_raw
Out of the box, it only works through the cloud. But in this way it gives an error:
[custom_components.xiaomi_miot] Got MiioException while fetching the state for Power Plug Switch: {'code': -32602, 'message': 'need siid'}
Firmware version: 2.1.0_0025
@a1ekseev You used the wrong integration. Use xiaomi_miot_raw, not xiaomi_miot. I am using the former and it works perfectly, without cloud.
@a1ekseev You used the wrong integration. Use xiaomi_miot_raw, not xiaomi_miot. I am using the former and it works perfectly, without cloud.
Thanks, I'll give it a try. It's just that @al-one above said that support has been added.
@a1ekseev Yes it used to be supported by that integration, but maybe the support was broken by an update. May the author fix it soon.
I'm not aware of any issue (of the xiaomi_raw
integration). I would be happy about some input.
Device information:
Name(s) of the device: Mi Smart Power Plug 2 (Wi-Fi and Bluetooth Gateway)
Link: https://www.mi.com/buy/detail?product_id=12777
Model: chuangmi.plug.212a01
Hardware version: esp32
Firmware version: 2.1.0_0017