Xiaomi Smart Home Suite (very cheap) compatibilty?

Xiaomi, Ikea TRÅDFRI, Philips Hue and more.

Moderator: leecollings

Geitje
Posts: 170
Joined: Monday 22 January 2018 21:52
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Xiaomi Smart Home Suite (very cheap) compatibilty?

Post by Geitje »

I guess there is no guide, you probably need coding skills? You might want to try to propose it here?
Domoticz beta, on Raspberry Pi 3B, Raspian Buster
Zwave, Zigate, RFlink etc.
Huupke
Posts: 25
Joined: Monday 21 October 2019 10:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Boxtel, Netherlands
Contact:

Re: Xiaomi Smart Home Suite (very cheap) compatibilty?

Post by Huupke »

Coding skills I have. I also ordered a second Pi for development so my existing Pi can keep on running a stable release.

This is what I have so far on the Aqara Wireless Relay Controller(2 Channels).

I've the following messages when turning both channels on and off once:
2020-03-16 21:26:15.831 Status: XiaomiGateway (ID=2): unhandled model: , name: Xiaomi Switch
2020-03-16 21:26:15.831 Status: {"cmd":"heartbeat","model":"","sid":"158d0003cbe6e8","short_id":44412,"data":"{\"voltage\":3600}"}
2020-03-16 21:26:42.490 Status: XiaomiGateway (ID=2): unhandled model: , name: Xiaomi Switch
2020-03-16 21:26:42.490 Status: {"cmd":"report","model":"","sid":"158d0003cbe6e8","short_id":44412,"data":"{\"channel_0\":\"on\"}"}
2020-03-16 21:26:47.391 Status: XiaomiGateway (ID=2): unhandled model: , name: Xiaomi Switch
2020-03-16 21:26:47.391 Status: {"cmd":"report","model":"","sid":"158d0003cbe6e8","short_id":44412,"data":"{\"channel_1\":\"on\"}"}
2020-03-16 21:26:51.318 Status: XiaomiGateway (ID=2): unhandled model: , name: Xiaomi Switch
2020-03-16 21:26:51.318 Status: {"cmd":"report","model":"","sid":"158d0003cbe6e8","short_id":44412,"data":"{\"channel_1\":\"off\"}"}
2020-03-16 21:26:53.828 Status: XiaomiGateway (ID=2): unhandled model: , name: Xiaomi Switch
2020-03-16 21:26:53.828 Status: {"cmd":"report","model":"","sid":"158d0003cbe6e8","short_id":44412,"data":"{\"channel_0\":\"off\"}"}
2020-03-16 21:27:38.541 Status: XiaomiGateway (ID=2): unhandled model: , name: Xiaomi Switch
2020-03-16 21:27:38.541 Status: {"cmd":"report","model":"","sid":"158d0003cbe6e8","short_id":44412,"data":"{\"channel_0\":\"off\"}"}
2020-03-16 21:27:38.595 Status: XiaomiGateway (ID=2): unhandled model: , name: Xiaomi Switch
2020-03-16 21:27:38.595 Status: {"cmd":"report","model":"","sid":"158d0003cbe6e8","short_id":44412,"data":"{\"channel_1\":\"off\"}"}
2020-03-16 21:27:40.583 Status: XiaomiGateway (ID=2): unhandled model: , name: Xiaomi Switch
2020-03-16 21:27:40.584 Status: {"cmd":"heartbeat","model":"","sid":"158d0003cbe6e8","short_id":44412,"data":"{\"voltage\":3600}"}
Model seems to be empty so I hope that doesn't give a problem with in 'XiaomiGateway::xiaomi_udp_server::handle_receive'. I was also wondering what the unit code would be, where are these numbers defined?

Code: Select all

if (xcmd->unitcode == 8) {
I see all these magic numbers in the XiaomiGateway::WriteToHardware method and I hoped to find these codes somewhere, anybody? Do I just take the next unitcode available?

This relay should work very similar to the 'plug' (unitcode == 1 ) or even better the wired dual channel switch named 'ctrl_neutral2' (xcmd->unitcode == 9 || xcmd->unitcode == 10).

Also what are these 'xcmd->subtype', 'sid' and 'short_id'. I see sometimes they are static and some are variable. I even see static + variable like this:

Code: Select all

message = "{\"cmd\":\"write\",\"model\":\"curtain\",\"sid\":\"158d00" + sid + "\",\"short_id\" ....
I see I'm not the first encountering the empty model which is blocking:
https://www.domoticz.com/forum/viewtopi ... el#p233410
Running V2024.4 on RPi3B+ & development/HEAD on RPi4B
Huupke
Posts: 25
Joined: Monday 21 October 2019 10:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Boxtel, Netherlands
Contact:

Re: Xiaomi Smart Home Suite (very cheap) compatibilty?

Post by Huupke »

I've prepared a PR with a more clean Xiaomi Gateway implementation in preparation of adding support for new devices. Could someone have a look at my PR? Let me know if this is in line with the guidelines.
Running V2024.4 on RPi3B+ & development/HEAD on RPi4B
Huupke
Posts: 25
Joined: Monday 21 October 2019 10:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Boxtel, Netherlands
Contact:

Re: Xiaomi Smart Home Suite (very cheap) compatibilty?

Post by Huupke »

Above PR is already merged.

I have some new improvements in the 'write' method of the Xiaomi Gateway code. Could someone test my branch with a wired wall switch, for instance:
ctrl_neutral1
ctrl_ln1
ctrl_ln1.aq1
ctrl_neutral2
ctrl_ln2
ctrl_ln2.aq1

see: https://github.com/Huupke/domoticz/tree ... mi-methods
Running V2024.4 on RPi3B+ & development/HEAD on RPi4B
Huupke
Posts: 25
Joined: Monday 21 October 2019 10:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Boxtel, Netherlands
Contact:

Re: Xiaomi Smart Home Suite (very cheap) compatibilty?

Post by Huupke »

I was able to test it with a ctrl_ln2.aq. Anyone with a single rocker?
Running V2024.4 on RPi3B+ & development/HEAD on RPi4B
Huupke
Posts: 25
Joined: Monday 21 October 2019 10:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Boxtel, Netherlands
Contact:

Re: Xiaomi Smart Home Suite (very cheap) compatibilty?

Post by Huupke »

Did someone file an issue at Xiaomi or Aqara with success?

Via de Xiaomi Mi Home app I filed several 'feedback' issues. On one I got the response to ask my question in the 'developer forum': Aqara IOT OpenCloud but I was not able to register myself as I don't know what to fill in for 'ID card number'.

Also when going directly to the forum I don't see any link to signup or create an account. Anyone succeeded?

BTW, I found quite some extra documentation and information:
http://docs.opencloud.aqara.com/en/guid ... tion/#home
https://github.com/aqara
Running V2024.4 on RPi3B+ & development/HEAD on RPi4B
Huupke
Posts: 25
Joined: Monday 21 October 2019 10:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Boxtel, Netherlands
Contact:

Re: Xiaomi Smart Home Suite (very cheap) compatibilty?

Post by Huupke »

Huupke wrote: Tuesday 07 April 2020 20:57 Did someone file an issue at Xiaomi or Aqara with success?

Via de Xiaomi Mi Home app I filed several 'feedback' issues. On one I got the response to ask my question in the 'developer forum': Aqara IOT OpenCloud but I was not able to register myself as I don't know what to fill in for 'ID card number'.

Also when going directly to the forum I don't see any link to signup or create an account. Anyone succeeded?

BTW, I found quite some extra documentation and information:
http://docs.opencloud.aqara.com/en/guid ... tion/#home
https://github.com/aqara
You can create an account with and 'ID card number' of 18 digits, all '1's works. I've posted a request for fixing 'ZNLDP12LM' and 'LLKZMK11LM'.

Maybe emailing with '[email protected]' also works but I haven't got any response yet.
Running V2024.4 on RPi3B+ & development/HEAD on RPi4B
fantom
Posts: 269
Joined: Thursday 26 March 2015 10:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Poland
Contact:

Re: Xiaomi Smart Home Suite (very cheap) compatibilty?

Post by fantom »

Can anyone may add support for thermometer 2 (LYWSD03MMC) ?

Fantom
Huupke
Posts: 25
Joined: Monday 21 October 2019 10:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Boxtel, Netherlands
Contact:

Re: Xiaomi Smart Home Suite (very cheap) compatibilty?

Post by Huupke »

I've created a 'workaround' for devices that do not report a model via the gateways API. For now this only works for the Xiaomi Aqara relais LLKZMK11LM (lumi.relay.c2acn01 or relay.c2acn01).

Branch on my fork:
https://github.com/Huupke/domoticz/tree ... mi-devices

See also issues that could potentially be closed with a PR for this 'fix':
#3577
#3769
#4029

Some feedback on the code would be great and you're welcome to test it on your own setup of course.
https://github.com/domoticz/domoticz/pull/4839

For usage you can either add some hardcoded values in the DeviceSupport but probably easier is to add a user variable named 'XiaomiDeviceSupportRelais'. You can add a single device ID like '158d00045c25cf' or comma separated for multiple like this: '158d00045c25cf,158d0003cbe6e8'. Notice always the prefix of '158d00' with respect to what you see in the 'Devices' overview UI.
Running V2024.4 on RPi3B+ & development/HEAD on RPi4B
abaratian
Posts: 22
Joined: Thursday 12 July 2018 20:19
Target OS: Windows
Domoticz version: 2021.1
Contact:

Re: Xiaomi Smart Home Suite (very cheap) compatibilty?

Post by abaratian »

Hi everyone,
I have a problem with the xiaomi gateway. I have been using the hub for about 4 years now and recently my xiaomi devices have stopped working. I get 'Error: Xiaomi Gateway: unable to write command - Invalid key' in the log. I cant find the option for the lan passcode. I installed an old version of the app and renewed the passcode and updated in domoticz, but no luck.
can anyone help me resolve this?
-----------------------------------
UPDATAE: the problem was with the firewall blocking port 9898
askold
Posts: 4
Joined: Sunday 06 May 2018 4:15
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Xiaomi Smart Home Suite (very cheap) compatibilty?

Post by askold »

Xiaomi aquara temperature, humidity and pressure sensor WSDCGQ11LM connected through the DGNWG02LM hub. The domoticz updates the data once an hour. At the same time, the sensor itself measures much more often, which can be seen in Mi Home. The hub, therefore, can also transmit information more often. But how do you get it to domoticz? I wanted to use this sensor for automatic fan control, but once an hour is not good enough.
Huupke
Posts: 25
Joined: Monday 21 October 2019 10:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Boxtel, Netherlands
Contact:

Re: Xiaomi Smart Home Suite (very cheap) compatibilty?

Post by Huupke »

askold wrote: Wednesday 21 July 2021 13:53 Xiaomi aquara temperature, humidity and pressure sensor WSDCGQ11LM connected through the DGNWG02LM hub. The domoticz updates the data once an hour. At the same time, the sensor itself measures much more often, which can be seen in Mi Home. The hub, therefore, can also transmit information more often. But how do you get it to domoticz? I wanted to use this sensor for automatic fan control, but once an hour is not good enough.
For some HW there are multiple 'devices' created. For instance for the 'Temperature' sensor the following devices are created:
  • Temp + Humidity + Baro
  • Temp + Humidity
  • Temp
Some of these devices are updated more than the other for (to me) an unknown reasons. It's on my TODO list to look into why one device would update more often the temperature than the other. For now I would pick the device that receives the most updates. I'm using mostly the 'Temp + Humidity' type.
Running V2024.4 on RPi3B+ & development/HEAD on RPi4B
DAVIZINHO
Posts: 234
Joined: Sunday 27 August 2017 18:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Spain
Contact:

Re: Xiaomi Smart Home Suite (very cheap) compatibilty?

Post by DAVIZINHO »

Hello.
I have the Last beta (2021.1.13872) in docker and my 3 xiaomi gateways stop working. It lost the connection an restart every hour.

Someone whith the same error?
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest