Page 23 of 123

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

Posted: Friday 20 January 2017 1:37
by murtadin
corbin wrote:
murtadin wrote: 2017-01-19 12:35:21.364 GetGatewayKey: m_token is
yes this is the problem, try outputting the token values seen below, and also set 'showmessage = true;' to output the heartbeat message received from the gateway. Perhaps a packet sniffer as well to see what message is being sent from the gateway.

Code: Select all

void XiaomiGateway::UpdateToken(const std::string & value)
{
	boost::lock_guard<boost::mutex> lock(m_mutex);
	m_token = value;
}

Code: Select all

else if (cmd == "heartbeat") {
	//update the token and gateway ip address.	
	m_XiaomiGateway->UpdateToken(root["token"].asString());
	m_gatewayip = root["ip"].asString();
	showmessage = true;
	}

installed tonight gentoo VM with genkernel. And it works. God damned. I think problem is some missng kernel options in my kernel on my server OS, or may be some dependencies whisch are unclear. Linked shared libraries are 100% tha same as on my target server OS.
Spoiler: show

Code: Select all

localhost domoticz # ./domoticz -www 8080 -sslwww 0 -verbose 2 -log /var/log/domoticz.log
2017-01-20 02:24:23.372  Domoticz V3.6389 (c)2012-2017 GizMoCuz
2017-01-20 02:24:23.372  Build Hash: 62434a5, Date: 2017-01-19 15:01:46
2017-01-20 02:24:23.373  Startup Path: /usr/local/domoticz/
2017-01-20 02:24:23.489  PluginSystem: Started, Python version '3.4.5'.
2017-01-20 02:24:23.491  Active notification Subsystems: http (1/12)
2017-01-20 02:24:23.492  WebServer(HTTP) started on address: :: with port 8080
2017-01-20 02:24:23.492  Proxymanager started.
2017-01-20 02:24:23.492  Starting shared server on: :::6144
2017-01-20 02:24:23.493  RxQueue: queue worker started...
2017-01-20 02:24:23.493  TCPServer: shared server started...
2017-01-20 02:24:25.494  EventSystem: reset all events...
2017-01-20 02:24:25.494  EventSystem: reset all device statuses...
2017-01-20 02:24:25.495  EventSystem: Started
2017-01-20 02:24:25.945  PluginSystem: Entering work loop.
2017-01-20 02:24:46.504  Incoming connection from: 192.168.111.100
2017-01-20 02:25:31.907  XiaomiGateway: Worker started...
2017-01-20 02:25:32.406  XiaomiGateway: Temperature - nodeid: 158d00010d6009
subtype       = TEMP5 - LaCrosse TX2, TX3, TX4, TX17
Sequence nbr  = 0
ID            = 24585
Temperature   = 10.3 C
Signal level  = 12
Battery       = OK
2017-01-20 02:25:32.406  (gw.local) Temp (Xiaomi Temperature)
2017-01-20 02:25:32.408  {"cmd":"read_ack","model":"sensor_ht","sid":"158d00010d6009","short_id":32976,"data":"{\"temperature\":\"1034\",\"humidity\":\"3221\"}"}
2017-01-20 02:25:32.409  XiaomiGateway: New Device Found (010d05fc)
2017-01-20 02:25:32.409  (gw.local) Light/Switch (Unknown)
2017-01-20 02:25:32.410  {"cmd":"read_ack","model":"switch","sid":"158d00010d05fc","short_id":51447,"data":"{}"}
2017-01-20 02:25:32.410  XiaomiGateway: New Device Found (01185a90)
2017-01-20 02:25:32.410  (gw.local) Light/Switch (Unknown)
2017-01-20 02:25:32.411  {"cmd":"read_ack","model":"magnet","sid":"158d0001185a90","short_id":25529,"data":"{\"status\":\"close\"}"}
2017-01-20 02:25:32.411  XiaomiGateway: New Device Found (00f9981c)
2017-01-20 02:25:32.411  (gw.local) Light/Switch (Unknown)
2017-01-20 02:25:32.412  {"cmd":"read_ack","model":"switch","sid":"158d0000f9981c","short_id":33720,"data":"{}"}
2017-01-20 02:25:32.412  XiaomiGateway: Temperature - nodeid: 158d00010e13b9
subtype       = TEMP5 - LaCrosse TX2, TX3, TX4, TX17
Sequence nbr  = 0
ID            = 5049
Temperature   = 19.3 C
Signal level  = 12
Battery       = OK
2017-01-20 02:25:32.412  (gw.local) Temp (Xiaomi Temperature)
2017-01-20 02:25:32.414  {"cmd":"read_ack","model":"sensor_ht","sid":"158d00010e13b9","short_id":61847,"data":"{\"temperature\":\"1930\",\"humidity\":\"4751\"}"}
2017-01-20 02:25:32.414  XiaomiGateway: Temperature - nodeid: 158d00010e43ae
subtype       = TEMP5 - LaCrosse TX2, TX3, TX4, TX17
Sequence nbr  = 0
ID            = 17326
Temperature   = 21.7 C
Signal level  = 12
Battery       = OK
2017-01-20 02:25:32.414  (gw.local) Temp (Xiaomi Temperature)
2017-01-20 02:25:32.416  {"cmd":"read_ack","model":"sensor_ht","sid":"158d00010e43ae","short_id":42517,"data":"{\"temperature\":\"2167\",\"humidity\":\"4434\"}"}
2017-01-20 02:25:32.416  XiaomiGateway: New Device Found (00f9975d)
2017-01-20 02:25:32.416  (gw.local) Light/Switch (Unknown)
2017-01-20 02:25:32.417  {"cmd":"read_ack","model":"switch","sid":"158d0000f9975d","short_id":47788,"data":"{}"}
2017-01-20 02:25:32.417  XiaomiGateway: New Device Found (010b2537)
2017-01-20 02:25:32.417  (gw.local) Light/Switch (Unknown)
2017-01-20 02:25:32.418  {"cmd":"read_ack","model":"motion","sid":"158d00010b2537","short_id":51903,"data":"{\"status\":\"no_motion\"}"}
2017-01-20 02:25:32.418  XiaomiGateway: New Device Found (0101a69d)
2017-01-20 02:25:32.418  (gw.local) Light/Switch (Unknown)
2017-01-20 02:25:32.419  {"cmd":"read_ack","model":"cube","sid":"158d000101a69d","short_id":4193,"data":"{}"}
2017-01-20 02:25:32.419  XiaomiGateway: New Device Found (010252f2)
2017-01-20 02:25:32.419  (gw.local) Light/Switch (Unknown)
2017-01-20 02:25:32.420  {"cmd":"read_ack","model":"cube","sid":"158d00010252f2","short_id":12412,"data":"{}"}
2017-01-20 02:25:32.420  XiaomiGateway: Temperature - nodeid: 158d00010f2e13
subtype       = TEMP5 - LaCrosse TX2, TX3, TX4, TX17
Sequence nbr  = 0
ID            = 11795
Temperature   = 21.7 C
Signal level  = 12
Battery       = OK
2017-01-20 02:25:32.420  (gw.local) Temp (Xiaomi Temperature)
2017-01-20 02:25:32.421  {"cmd":"read_ack","model":"sensor_ht","sid":"158d00010f2e13","short_id":11821,"data":"{\"temperature\":\"2165\",\"humidity\":\"4388\"}"}
2017-01-20 02:25:32.421  XiaomiGateway: Temperature - nodeid: 158d000110d1f4
2017-01-20 02:25:32.421  {"cmd":"read_ack","model":"sensor_ht","sid":"158d000110d1f4","short_id":23145,"data":"{\"temperature\":\"1935\",\"humidity\":\"4875\"}"}
2017-01-20 02:25:32.422  XiaomiGateway: New Device Found (0103dd45)
subtype       = TEMP5 - LaCrosse TX2, TX3, TX4, TX17
Sequence nbr  = 0
ID            = 53748
Temperature   = 19.4 C
Signal level  = 12
Battery       = OK
2017-01-20 02:25:32.421  (gw.local) Temp (Xiaomi Temperature)
2017-01-20 02:25:32.422  (gw.local) Light/Switch (Unknown)
2017-01-20 02:25:32.423  {"cmd":"read_ack","model":"motion","sid":"158d000103dd45","short_id":56908,"data":"{\"status\":\"no_motion\"}"}
2017-01-20 02:25:32.423  XiaomiGateway: New Device Found (010274e4)
2017-01-20 02:25:32.423  (gw.local) Light/Switch (Unknown)
2017-01-20 02:25:32.424  {"cmd":"read_ack","model":"magnet","sid":"158d00010274e4","short_id":7922,"data":"{\"status\":\"close\"}"}
2017-01-20 02:25:32.424  XiaomiGateway: New Device Found (01185845)
2017-01-20 02:25:32.424  (gw.local) Light/Switch (Unknown)
2017-01-20 02:25:32.425  {"cmd":"read_ack","model":"magnet","sid":"158d0001185845","short_id":12047,"data":"{\"status\":\"open\"}"}
2017-01-20 02:25:32.425  XiaomiGateway: New Device Found (0106fa0f)
2017-01-20 02:25:32.425  (gw.local) Light/Switch (Unknown)
2017-01-20 02:25:32.426  {"cmd":"read_ack","model":"magnet","sid":"158d000106fa0f","short_id":60213,"data":"{\"status\":\"open\"}"}
2017-01-20 02:25:32.426  XiaomiGateway: New Device Found (01186a27)
2017-01-20 02:25:32.426  (gw.local) Light/Switch (Unknown)
2017-01-20 02:25:32.427  {"cmd":"read_ack","model":"magnet","sid":"158d0001186a27","short_id":48997,"data":"{\"status\":\"open\"}"}
2017-01-20 02:25:32.427  XiaomiGateway: New Device Found (0117a188)
2017-01-20 02:25:32.427  (gw.local) Light/Switch (Unknown)
2017-01-20 02:25:32.428  {"cmd":"read_ack","model":"plug","sid":"158d000117a188","short_id":9663,"data":"{\"status\":\"on\",\"inuse\":\"1\"}"}
2017-01-20 02:28:23.884  XiaomiGateway: Temperature - nodeid: 158d00010d6009
2017-01-20 02:28:23.884  {"cmd":"report","model":"sensor_ht","sid":"158d00010d6009","short_id":32976,"data":"{\"temperature\":\"1038\"}"}
subtype       = TEMP5 - LaCrosse TX2, TX3, TX4, TX17
Sequence nbr  = 0
ID            = 24585
Temperature   = 10.4 C
Signal level  = 12
Battery       = OK
2017-01-20 02:28:23.884  (gw.local) Temp (Xiaomi Temperature)
2017-01-20 02:28:23.893  XiaomiGateway: Humidity - nodeid: 158d00010d6009
2017-01-20 02:28:23.893  {"cmd":"report","model":"sensor_ht","sid":"158d00010d6009","short_id":32976,"data":"{\"humidity\":\"3748\"}"}
subtype       = HUM1 - LaCrosse TX3
Sequence nbr  = 0
ID            = 24585
Humidity      = 37 %
Status        = Comfortable
Signal level  = 12
Battery       = OK
2017-01-20 02:28:23.894  (gw.local) Humidity (Xiaomi Humidity)

Code: Select all

localhost domoticz # ldd domoticz
        linux-vdso.so.1 (0x00007ffc3cd6e000)
        libssl.so.1.0.0 => /usr/lib64/libssl.so.1.0.0 (0x00007f7cbf1ca000)
        libcrypto.so.1.0.0 => /usr/lib64/libcrypto.so.1.0.0 (0x00007f7cbeddd000)
        librt.so.1 => /lib64/librt.so.1 (0x00007f7cbebd5000)
        libz.so.1 => /lib64/libz.so.1 (0x00007f7cbe9be000)
        libcurl.so.4 => /usr/lib64/libcurl.so.4 (0x00007f7cbe758000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f7cbe53c000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007f7cbe338000)
        libm.so.6 => /lib64/libm.so.6 (0x00007f7cbe033000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f7cbdc9a000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f7cbf433000)

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

Posted: Friday 20 January 2017 5:43
by corbin
murtadin wrote: installed tonight gentoo VM with genkernel. And it works. God damned. I think problem is some missng kernel options in my kernel on my server OS, or may be some dependencies whisch are unclear. Linked shared libraries are 100% tha same as on my target server OS.
Glad you got it working!

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

Posted: Friday 20 January 2017 8:51
by lamouette
Hello there,

First of all, thanks for the job. It works like a charm ! :ugeek: :D

My only fear is to loose everything due to a Xiaomi firmware update :lol:

I am facing to an "issue". I cannot save the color of the RGB. It is still blue.
Am I doing something wrong or is it to be considered as normal at this stage?

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

Posted: Friday 20 January 2017 8:58
by corbin
lamouette wrote: I am facing to an "issue". I cannot save the color of the RGB. It is still blue.
Am I doing something wrong or is it to be considered as normal at this stage?
I see the same behavior and think it is due to the colour state not being saved. Have you got other RGB lights that do save the colour?

Also I have just added brightness control to the gateway RGB, and have noticed that if I used the right hand slider, brightness is always sent through at 78%. Has anyone else noticed this?
gateway_slider.PNG
gateway_slider.PNG (97.68 KiB) Viewed 2061 times
My update with brightness control is at https://github.com/corbinmunce/domoticz

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

Posted: Friday 20 January 2017 9:07
by lamouette
This is my first RGB device, and yes, that's correct, the color state is not being saved.
I didn't test the brightness.

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

Posted: Friday 20 January 2017 11:02
by corbin
I'm getting the same behavior with Yeelight RGB, so guess this is normal, just hadn't notice before.

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

Posted: Friday 20 January 2017 12:26
by deennoo
On my side just compil your dev @corbin

looks like playing with brightness slide make it send 100% to the gateway, when it is on 50% in Domoticz

Just adding gateway on 2 groups
Capture.PNG
Capture.PNG (75.4 KiB) Viewed 2011 times
one red and one green and color asking is remember by domoticz

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

Posted: Friday 20 January 2017 12:35
by corbin
I haven't code the response yet, but think it should control to the correct value... which it isn't doing for me or you, so thanks for feedback - I know to keep trying to fix

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

Posted: Friday 20 January 2017 16:58
by MouCo
I've made some tests with one of the gateways i own.
Some minor issues, but everything appear to work ok.
Meanwhile i've activated network mode on the other 2 gateways... and everything started to act weird.

Has anyone tried out a multi xiaomi gateway solution?
What is the correct way to make it work?

When i had only one gateway with network mode activated... only the devices from that gateway appeared on domoticz.
and all of them worked ok.... smart zigbee plugs on and of, temp sensor values, door sensor opened and closed, presence detected or not...

As soon as i enabled network mode in the other 2 gateways... devices from those gateways appeared at domoticz even without adding those gateways to domoticz... it appears that the only gateway i added forwards the others to domoticz..

The problem was.... the devices all stoped to work has expected.... zigbee smart plugs ceased to activate on command, etc.etc..

any sugestions... :)

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

Posted: Friday 20 January 2017 17:02
by deennoo
As write sooner on this topic and on the wiki : only one session able to use 9898 udp port mean only 1 gateway for the moment.

Remember that it's a beta dev.

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

Posted: Friday 20 January 2017 17:07
by MouCo
and i have only one gateway added to domoticz.

one of the problems is that the devices from the other gateways appear on domoticz even without adding those gateways to domoticz.... a affecting the way the devices of the gateway connected to domoticz work.

All i've done was enable network mode on those gateways... and they are available on my local network... where i have domoticz running and all my stuff..

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

Posted: Friday 20 January 2017 17:16
by deennoo
Ok gateway made a kind of mesh network !

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

Posted: Friday 20 January 2017 17:21
by MouCo
a lousy mesh... :D
nothing works now... not even the devices connected to the "Main" gateway (the one connected to domoticz)

:)

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

Posted: Friday 20 January 2017 17:22
by MouCo
i'll test a little more during the weekend... and post the results.. :)

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

Posted: Friday 20 January 2017 21:09
by murtadin
corbin wrote:
murtadin wrote: 2017-01-19 12:35:21.364 GetGatewayKey: m_token is
yes this is the problem, try outputting the token values seen below, and also set 'showmessage = true;' to output the heartbeat message received from the gateway. Perhaps a packet sniffer as well to see what message is being sent from the gateway.

Code: Select all

void XiaomiGateway::UpdateToken(const std::string & value)
{
	boost::lock_guard<boost::mutex> lock(m_mutex);
	m_token = value;
}

Code: Select all

else if (cmd == "heartbeat") {
	//update the token and gateway ip address.	
	m_XiaomiGateway->UpdateToken(root["token"].asString());
	m_gatewayip = root["ip"].asString();
	showmessage = true;
	}

Dear Corbin - May be will be better to create a new topic in my case to find the problem? Not to make a mess in this topc.

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

Posted: Friday 20 January 2017 22:43
by mKotek
I have received the package today and connected my Smart Gateway and sensors successfully.
I would like to thank Corbin for the great work so far on the integration and all the others for supporting and adding value to the project. Great stuff and I have another set of sensors being in transit as I write this.

Almost everything is working fine, except, my Temp + Humidity sensor gets detected and created as temp only, even though I can see the humidity reported:

Code: Select all

2017-01-20 22:30:35.963 {"cmd":"read_ack","model":"sensor_ht","sid":"158d00010b75a8","short_id":36127,"data":"{\"temperature\":\"2019\",\"humidity\":\"3659\"}"}
Seems like the wrong type of the device has been selected?

Also, I think the power consumption reporting happens only a while after the power on command is executed - maybe that is why no data is received at first?

I am using official Beta 3.6371, so this might be the reason for lack of humidity data? How can I change that, except for manually adjusting the sensor type in Domoticz db?

Also, since I have majority of sensors, I am happy to help by testing, should anything be available for tests.

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

Posted: Friday 20 January 2017 22:55
by Mat2Vence
Good job guys! I have just seen the RGB has been added!
Is there any plan to ass the alarm/sounds feature?

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

Posted: Saturday 21 January 2017 6:16
by corbin
deennoo wrote:On my side just compil your dev @corbin

looks like playing with brightness slide make it send 100% to the gateway, when it is on 50% in Domoticz
I've fixed up the brightness control, its working correctly for me, except for when I change the colour the brightness still goes to 78%. https://github.com/corbinmunce/domoticz

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

Posted: Saturday 21 January 2017 6:18
by corbin
Mat2Vence wrote:Good job guys! I have just seen the RGB has been added!
Is there any plan to ass the alarm/sounds feature?
Thanks, the sound control will be added if it becomes available - like the RGB which wasn't available initially.

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

Posted: Saturday 21 January 2017 6:27
by corbin
MouCo wrote:
any sugestions... :)
Don't use multiple gateways :)

But seriously, are you using multiple because you can, or is there an actual need?