-
-
Notifications
You must be signed in to change notification settings - Fork 564
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
Add Mi Smart Power Plug 2 (chuangmi.plug.212a01) support #844
Comments
|
It looks like the device doesn't expose the bluetooth gateway via miot.
|
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. |
|
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..! |
1 similar comment
hope it can be supported soon..! |
Is there any progress? |
This is one of my new year's wishes :-) |
求解决 |
Same!!!! Please help us!
|
It can be accessed at this format: get the state of the switch
turn on the switch
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
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:
|
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 |
小米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 |
@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.
switch:
|
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? |
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. |
Hello, |
|
Hello, 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:
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. |
I cant use my devices let me check thanks |
Out of the box, it only works through the cloud.
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 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 |
There is no issue with |
waiting for adding this function into python-miio |
I'm trying to access this plug in the API but without any luck.
Any ideas? BTW, the raw requests from the console work fine, but I would like to use them in python |
hello,i got some troubles when i run it,the result shows error:code:-9999, user act timeout, i dont know how to solve it |
metoo,have you solved this problem? |
Maybe you guys can try this code:
|
thank u for ur reply,i'v already solve this |
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
The text was updated successfully, but these errors were encountered: