Xiaomi Smart Home Suite (very cheap) compatibilty?

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

Moderator: leecollings

murtadin
Posts: 62
Joined: Saturday 31 December 2016 15:33
Target OS: Linux
Domoticz version: beta
Contact:

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

Post by murtadin »

@Corbin

Compiled binaries from your sources - can't control zigbee sockets too.
User avatar
corbin
Posts: 463
Joined: Saturday 20 August 2016 22:57
Target OS: Windows
Domoticz version: Beta
Location: Brisbane, Australia
Contact:

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

Post by corbin »

deennoo wrote: Xiaomi Cube + Yeelight : Rotative dimmer !
Cool!
Question about the Xiaomi Gateway in Domoticz? Please check the Wiki first: https://www.domoticz.com/wiki/Xiaomi_Gateway_(Aqara)
User avatar
corbin
Posts: 463
Joined: Saturday 20 August 2016 22:57
Target OS: Windows
Domoticz version: Beta
Location: Brisbane, Australia
Contact:

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

Post by corbin »

levynger wrote: I though removing it before sending to HW again..
the other issue was it could overflow the maximum int value, eg:

shortened sid hex: 012932CF
add 1 to the front to signify switch type: 1012932CF
convert 1012932CF to int: 4314444495
maximum int value: 2147483647

but if we reduced the hex string to 7 chars it could work. That would be assuming that the first number is always going to be 0 when shortened to 8 chars.
levynger wrote: UPDATE: found how to make 2 on/off type for the same HW.. had to change the xcmd.unitnumber before providing it to mainworker!
did you want to have 2 devices for the same switch?
Question about the Xiaomi Gateway in Domoticz? Please check the Wiki first: https://www.domoticz.com/wiki/Xiaomi_Gateway_(Aqara)
derrij
Posts: 14
Joined: Friday 30 December 2016 12:14
Target OS: Linux
Domoticz version:
Contact:

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

Post by derrij »

Whether it is possible to bind domoticz(Xiaomi gateway) to network interface?
It looks like, right now, it can not be started on router.
When I start it like this, Raspberry Pi-Domoticz can see the gateway.

Code: Select all

                                            router   
                                            192.168.1.1
                             				 |
                            ____________________________
                            |                           |
                  Xiaomi Gateway                         Raspberry Pi-Domoticz
                  192.168.1.11                              192.168.1.190
                               
But when i start domoticz on router 192.168.1.1, Domoticz can't see the gateway

Code: Select all

                                            router   
                                            192.168.1.1  Domoticz
                             				 |
                            ____________________________
                            |                           |
                  Xiaomi Gateway                         Raspberry Pi
                  192.168.1.11                              192.168.1.190
                               
levynger
Posts: 87
Joined: Wednesday 21 December 2016 19:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Israel
Contact:

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

Post by levynger »

corbin wrote:
levynger wrote: I though removing it before sending to HW again..
the other issue was it could overflow the maximum int value, eg:

shortened sid hex: 012932CF
add 1 to the front to signify switch type: 1012932CF
convert 1012932CF to int: 4314444495
maximum int value: 2147483647

but if we reduced the hex string to 7 chars it could work. That would be assuming that the first number is always going to be 0 when shortened to 8 chars.
yes, at certian point i have figured this one out, and dripped all changes andnreverted back to your original code, now using array strings, as you have suggested, and adding the ID of the ctrl2 devices there.
and in writetohardware function, i can identify this device by matching the xcmd id with the strings array.
levynger wrote: UPDATE: found how to make 2 on/off type for the same HW.. had to change the xcmd.unitnumber before providing it to mainworker!
did you want to have 2 devices for the same switch?

indeed, seems more logical to have 2 seperated on/off switches for the ctrl2 and a single on/off for the ctrl1
for the wireless switch (sw086) it should remain slector , as there is additonal trigger i have missed (both pressed).
deennoo
Posts: 784
Joined: Wednesday 10 December 2014 13:06
Target OS: Linux
Domoticz version: beta
Location: Bordeaux France
Contact:

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

Post by deennoo »

Sw086 simple switch wireless only send 'click' for the moment

For ctrl2 (wired dual switch) send on/off for each button and click both for when click both.

For ctrl2 need 3 devices : on/off for each button and one push on for click both
Domoticz stable 3.5877 for real & Domoticz beta for test
Rfxtrxe / RFLink / Milight / Yeelight / Tasmota / MQTT / BLE / Zigate
http://domo-attitude.fr
levynger
Posts: 87
Joined: Wednesday 21 December 2016 19:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Israel
Contact:

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

Post by levynger »

deennoo wrote:Sw086 simple switch wireless only send 'click' for the moment

For ctrl2 (wired dual switch) send on/off for each button and click both for when click both.

For ctrl2 need 3 devices : on/off for each button and one push on for click both
Ctrl2 doesn't have both click option.
It's only for the wireless.

You can always create group switch to turn both off/on..


Sent from my SM-N920C using Tapatalk
deennoo
Posts: 784
Joined: Wednesday 10 December 2014 13:06
Target OS: Linux
Domoticz version: beta
Location: Bordeaux France
Contact:

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

Post by deennoo »

levynger wrote:
deennoo wrote:Sw086 simple switch wireless only send 'click' for the moment

For ctrl2 (wired dual switch) send on/off for each button and click both for when click both.

For ctrl2 need 3 devices : on/off for each button and one push on for click both
Ctrl2 doesn't have both click option.
It's only for the wireless.

You can always create group switch to turn both off/on..


Sent from my SM-N920C using Tapatalk
Your right, i made inverssion with wireless one
Domoticz stable 3.5877 for real & Domoticz beta for test
Rfxtrxe / RFLink / Milight / Yeelight / Tasmota / MQTT / BLE / Zigate
http://domo-attitude.fr
pikapt
Posts: 37
Joined: Wednesday 25 January 2017 20:54
Target OS: Linux
Domoticz version:
Contact:

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

Post by pikapt »

@corbin i'm having random errors: "2017-01-28 15:11:05.873 Error: XiaomiGateway: unable to write command - Invalid Key"
They come and go very randomly i'm not sure if it's due to the device that is trying to be triggered is too far away from router (zigbee switch, which is around 8 m from router). Anyway we can debug this?
levynger
Posts: 87
Joined: Wednesday 21 December 2016 19:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Israel
Contact:

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

Post by levynger »

@corbin, added 2 new patches to your github for the cpp and the header file.
its a big change, as discuss previously in in this thread:
1) added string array to store all ID of the ctrl_neutral (1+2), so can be identified when creating them in Database, using "Unit Field" (for the dual switch), and when using from UI as well.
1) changed the ctrl_neutrals to on/off switches (i think upgrades will have to change it manually, or clean their deviceStatus table from ther database, as it wont change an exiting ID in this table

seems to work nicely here on my ctrl_neutral2 device, this time, kept in mind to deal with ctrl_neutral1 device, eventhough i dont have it.

happy weekend..

Capture.PNG
Capture.PNG (68.31 KiB) Viewed 2370 times
levynger
Posts: 87
Joined: Wednesday 21 December 2016 19:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Israel
Contact:

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

Post by levynger »

pikapt wrote:@corbin i'm having random errors: "2017-01-28 15:11:05.873 Error: XiaomiGateway: unable to write command - Invalid Key"
They come and go very randomly i'm not sure if it's due to the device that is trying to be triggered is too far away from router (zigbee switch, which is around 8 m from router). Anyway we can debug this?
not sureits related to the fact its far, this is the gateway answer, probably before even trying to reach your device..
does it happen after some command sent fine? is it for specific device? which one?
it may happen when starting the server, and the gateway didnt send the key for the first time.
User avatar
corbin
Posts: 463
Joined: Saturday 20 August 2016 22:57
Target OS: Windows
Domoticz version: Beta
Location: Brisbane, Australia
Contact:

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

Post by corbin »

pikapt wrote:@corbin i'm having random errors: "2017-01-28 15:11:05.873 Error: XiaomiGateway: unable to write command - Invalid Key"
They come and go very randomly i'm not sure if it's due to the device that is trying to be triggered is too far away from router (zigbee switch, which is around 8 m from router). Anyway we can debug this?
I've seen this too. What could be happening is the encryption token changes on the gateway and Domoticz sends the control message before the new token has been processed.
Question about the Xiaomi Gateway in Domoticz? Please check the Wiki first: https://www.domoticz.com/wiki/Xiaomi_Gateway_(Aqara)
User avatar
corbin
Posts: 463
Joined: Saturday 20 August 2016 22:57
Target OS: Windows
Domoticz version: Beta
Location: Brisbane, Australia
Contact:

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

Post by corbin »

levynger wrote:@corbin, added 2 new patches to your github for the cpp and the header file.
Thank you, I would have had much trouble doing it since I don't have these switches.
Question about the Xiaomi Gateway in Domoticz? Please check the Wiki first: https://www.domoticz.com/wiki/Xiaomi_Gateway_(Aqara)
levynger
Posts: 87
Joined: Wednesday 21 December 2016 19:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Israel
Contact:

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

Post by levynger »

corbin wrote:
levynger wrote:@corbin, added 2 new patches to your github for the cpp and the header file.
Thank you, I would have had much trouble doing it since I don't have these switches.

Thanks, updated from your git & compiled - seems to be working fine..
pikapt
Posts: 37
Joined: Wednesday 25 January 2017 20:54
Target OS: Linux
Domoticz version:
Contact:

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

Post by pikapt »

@corbin i have a suggestion to make regarding the xiaomi switch: if we press the switch (one,twice etc), domoticz is able to get that from xiaomi hub but the state is not updated to off after that. That means that in every script we should include an update to the switch status itself to turn it off otherwise domoticz will be triggering the script until the status is changed. Can we include a logic on the switch itself to set it to off everytime a new event is received from the hub? or, does it make sense to do that?
jjnj

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

Post by jjnj »

pikapt wrote:@corbin i have a suggestion to make regarding the xiaomi switch: if we press the switch (one,twice etc), domoticz is able to get that from xiaomi hub but the state is not updated to off after that. That means that in every script we should include an update to the switch status itself to turn it off otherwise domoticz will be triggering the script until the status is changed. Can we include a logic on the switch itself to set it to off everytime a new event is received from the hub? or, does it make sense to do that?
I think if changing the current behaviour, it should be optional. In my case its nice to see which action is preformed last for example.
deennoo
Posts: 784
Joined: Wednesday 10 December 2014 13:06
Target OS: Linux
Domoticz version: beta
Location: Bordeaux France
Contact:

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

Post by deennoo »

pikapt wrote:@corbin i have a suggestion to make regarding the xiaomi switch: if we press the switch (one,twice etc), domoticz is able to get that from xiaomi hub but the state is not updated to off after that. That means that in every script we should include an update to the switch status itself to turn it off otherwise domoticz will be triggering the script until the status is changed. Can we include a logic on the switch itself to set it to off everytime a new event is received from the hub? or, does it make sense to do that?
I remove this fonction, i think it's not usefull to set a switch to Off as we can't do it by our self (by clicking i mean).

You can set a returne to off by your self using : turn to off timer.
Domoticz stable 3.5877 for real & Domoticz beta for test
Rfxtrxe / RFLink / Milight / Yeelight / Tasmota / MQTT / BLE / Zigate
http://domo-attitude.fr
pikapt
Posts: 37
Joined: Wednesday 25 January 2017 20:54
Target OS: Linux
Domoticz version:
Contact:

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

Post by pikapt »

Yeah domoticz its actually reacting to changes, so even if status is currently at "click", scripts are only triggered if a "new click" is found so i'll just set to off in the scripts! Thanks!
pikapt
Posts: 37
Joined: Wednesday 25 January 2017 20:54
Target OS: Linux
Domoticz version:
Contact:

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

Post by pikapt »

if (result == false) {
//send the message again
_log.Log(LOG_STATUS, "XiaomiGateway: SendMessageToGateway failed on first attempt, will try again");
sleep_milliseconds(100);
result = SendMessageToGateway(message);
pretty cool! cheers corbin
User avatar
corbin
Posts: 463
Joined: Saturday 20 August 2016 22:57
Target OS: Windows
Domoticz version: Beta
Location: Brisbane, Australia
Contact:

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

Post by corbin »

pikapt wrote:Yeah domoticz its actually reacting to changes, so even if status is currently at "click", scripts are only triggered if a "new click" is found so i'll just set to off in the scripts! Thanks!
To clarify what deennoo said above, you can actually set it to turn off after x seconds in the Domoticz web GUI.
Question about the Xiaomi Gateway in Domoticz? Please check the Wiki first: https://www.domoticz.com/wiki/Xiaomi_Gateway_(Aqara)
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest