Page 29 of 123

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

Posted: Thursday 26 January 2017 1:20
by corbin
pikapt wrote:Hi corbin,

So I'm back with good and bad news. Good news is that zigbee switch is working, bad news is that gateway switch still doesn't.
Any idea on how to make some debug over it? Is it working for everyone else?

Cheers
do you know the sid of your gateway? if it doesn't start with "f0b4" that could be the cause.

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

Posted: Thursday 26 January 2017 1:43
by pikapt
cool, we're getting somewhere!
2017-01-26 00:42:15.357 {"cmd":"report","model":"gateway","sid":"286c0785ad14","short_id":0,"data":"{\"rgb\":1236926719}"}
2017-01-26 00:42:23.330 {"cmd":"report","model":"gateway","sid":"286c0785ad14","short_id":0,"data":"{\"rgb\":0}"}

just got this from the logfile, sid starts with 286c

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

Posted: Thursday 26 January 2017 1:54
by corbin
I've just updated github, should work for you now.

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

Posted: Thursday 26 January 2017 2:02
by pikapt
thanks a lot mate! i'll give it a test tomorrow and will let you know! cheers!

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

Posted: Thursday 26 January 2017 11:38
by Coldman
corbin wrote:I've just updated github, should work for you now.
Great job, zigbee sockets are working and reaction speed is much faster than in the native app!
Thanks.

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

Posted: Thursday 26 January 2017 17:58
by galadril
Got the next exception after the latest update:
17:57:30.973 Error: MiHome hardware (13) thread seems to have ended unexpectedly

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

Posted: Thursday 26 January 2017 18:28
by levynger
corbin wrote:
levynger wrote:@corbin, @deennoo found a problem for the ctrl_neutral1 - it wont be triggered as the message is hardcoded for ctrl_neural2 only..
Can you check my latest github update hasn't broken the new switch commands you added?

I'm not sure how best to solve the ctrl_neutral/1ctrl_neutral2 problem. I faced something similar with the gateway colour and brightness, where I didn't want to query the database each time for the values needed - ended up using local variables. This approach for the switches would need to store the switch type/name for each switch, and would need an array or similar.
i will check later on today on my ubuntu and update..

regardin the ctrl# device, though perhaps to add to the ID of the device something like hex identification for "ctrl2" and "ctrl1"
before sending command from the UI and before comaring it in the Reciever proc , remove it.. this way i can determine which ctrl and assign the correct command to it, and avoiding extra sql queries on each command transmitted.. sounds ok? or i am missing something?

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

Posted: Thursday 26 January 2017 21:16
by levynger
@corbin,
updated git, unable to compile..

Code: Select all

 23%] Building CXX object CMakeFiles/domoticz.dir/main/mainworker.cpp.o
/home/levynger/domoticzgit/main/mainworker.cpp: In member function ‘void MainWorker::decode_LimitlessLights(int, _eHardwareTypes, const tRBUF*, MainWorker::_tRxMessageProcessingResult&)’:
/home/levynger/domoticzgit/main/mainworker.cpp:5492:98: error: ‘to_string’ is not a member of ‘std’
  uint64_t DevRowIdx = m_sql.UpdateValue(HwdID, ID.c_str(), Unit, devType, subType, 12, -1, cmnd, std::to_string(value).c_str(), procResult.DeviceN
                                                                                                  ^
/home/levynger/domoticzgit/main/mainworker.cpp:5492:98: note: suggested alternatives:
In file included from /usr/include/boost/exception_ptr.hpp:9:0,
                 from /usr/include/boost/thread/exceptional_ptr.hpp:10,
                 from /usr/include/boost/thread/future.hpp:23,
                 from /usr/include/boost/thread.hpp:24,
                 from /home/levynger/domoticzgit/main/stdafx.h:57:
/usr/include/boost/exception/detail/exception_ptr.hpp:492:5: note:   ‘boost::to_string’
     to_string( exception_ptr const & p )
     ^
In file included from /usr/include/boost/exception/to_string_stub.hpp:15:0,
                 from /usr/include/boost/exception/info.hpp:16,
                 from /usr/include/boost/exception/detail/exception_ptr.hpp:20,
                 from /usr/include/boost/exception_ptr.hpp:9,
                 from /usr/include/boost/thread/exceptional_ptr.hpp:10,
                 from /usr/include/boost/thread/future.hpp:23,
                 from /usr/include/boost/thread.hpp:24,
                 from /home/levynger/domoticzgit/main/stdafx.h:57:
/usr/include/boost/exception/to_string.hpp:72:5: note:   ‘boost::to_string’
     to_string( std::pair<T,U> const & x )
     ^
CMakeFiles/domoticz.dir/build.make:254: recipe for target 'CMakeFiles/domoticz.dir/main/mainworker.cpp.o' failed
make[2]: *** [CMakeFiles/domoticz.dir/main/mainworker.cpp.o] Error 1
CMakeFiles/Makefile2:103: recipe for target 'CMakeFiles/domoticz.dir/all' failed
make[1]: *** [CMakeFiles/domoticz.dir/all] Error 2
Makefile:149: recipe for target 'all' failed
make: *** [all] Error 2

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

Posted: Thursday 26 January 2017 22:16
by deennoo
levynger wrote:@corbin,
updated git, unable to compile..

Code: Select all

 23%] Building CXX object CMakeFiles/domoticz.dir/main/mainworker.cpp.o
/home/levynger/domoticzgit/main/mainworker.cpp: In member function ‘void MainWorker::decode_LimitlessLights(int, _eHardwareTypes, const tRBUF*, MainWorker::_tRxMessageProcessingResult&)’:
/home/levynger/domoticzgit/main/mainworker.cpp:5492:98: error: ‘to_string’ is not a member of ‘std’
  uint64_t DevRowIdx = m_sql.UpdateValue(HwdID, ID.c_str(), Unit, devType, subType, 12, -1, cmnd, std::to_string(value).c_str(), procResult.DeviceN
                                                                                                  ^
/home/levynger/domoticzgit/main/mainworker.cpp:5492:98: note: suggested alternatives:
In file included from /usr/include/boost/exception_ptr.hpp:9:0,
                 from /usr/include/boost/thread/exceptional_ptr.hpp:10,
                 from /usr/include/boost/thread/future.hpp:23,
                 from /usr/include/boost/thread.hpp:24,
                 from /home/levynger/domoticzgit/main/stdafx.h:57:
/usr/include/boost/exception/detail/exception_ptr.hpp:492:5: note:   ‘boost::to_string’
     to_string( exception_ptr const & p )
     ^
In file included from /usr/include/boost/exception/to_string_stub.hpp:15:0,
                 from /usr/include/boost/exception/info.hpp:16,
                 from /usr/include/boost/exception/detail/exception_ptr.hpp:20,
                 from /usr/include/boost/exception_ptr.hpp:9,
                 from /usr/include/boost/thread/exceptional_ptr.hpp:10,
                 from /usr/include/boost/thread/future.hpp:23,
                 from /usr/include/boost/thread.hpp:24,
                 from /home/levynger/domoticzgit/main/stdafx.h:57:
/usr/include/boost/exception/to_string.hpp:72:5: note:   ‘boost::to_string’
     to_string( std::pair<T,U> const & x )
     ^
CMakeFiles/domoticz.dir/build.make:254: recipe for target 'CMakeFiles/domoticz.dir/main/mainworker.cpp.o' failed
make[2]: *** [CMakeFiles/domoticz.dir/main/mainworker.cpp.o] Error 1
CMakeFiles/Makefile2:103: recipe for target 'CMakeFiles/domoticz.dir/all' failed
make[1]: *** [CMakeFiles/domoticz.dir/all] Error 2
Makefile:149: recipe for target 'all' failed
make: *** [all] Error 2
same for me

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

Posted: Thursday 26 January 2017 22:46
by corbin
I've undone my change so should compile again. I'll try to get it going in Linux later.

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

Posted: Thursday 26 January 2017 23:30
by pikapt
@corbin quick update, i'm now able to control gateway led as expected! thanks a lot mate!!

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

Posted: Friday 27 January 2017 6:32
by levynger
corbin wrote:I've undone my change so should compile again. I'll try to get it going in Linux later.
Works fine! thanks.
Dual switch also seems to be fine..

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

Posted: Friday 27 January 2017 7:58
by derrij
Hi. Can't get Xiaomi gateway working on Xiaomi router 3

Code: Select all

root@XiaoQiang:~# /data/opt/domoticz/domoticz
2017-01-27 08:28:29.489  Domoticz V3.5876 (c)2012-2016 GizMoCuz
2017-01-27 08:28:29.489  Build Hash: b97777b, Date: 2016-11-09 13:33:42
2017-01-27 08:28:29.490  Startup Path: /data/opt/domoticz/
2017-01-27 08:28:29.795  Active notification Subsystems: http (1/12)
2017-01-27 08:28:29.802  WebServer(HTTP) started on address: :: with port 8080
2017-01-27 08:28:29.828  Error: WebServer(SSL) startup failed on address 0.0.0.0 with port: 443: use_certificate_chain_file: asio.ssl error
2017-01-27 08:28:29.828  Error: WebServer(SSL) check privileges for opening ports below 1024
2017-01-27 08:28:29.830  Proxymanager started.
2017-01-27 08:28:29.844  Starting shared server on: :::6144
2017-01-27 08:28:29.846  TCPServer: shared server started...
2017-01-27 08:28:29.847  RxQueue: queue worker started...
2017-01-27 08:28:31.886  EventSystem: reset all events...
2017-01-27 08:28:31.889  EventSystem: reset all device statuses...
2017-01-27 08:28:31.891  EventSystem: Started
2017-01-27 08:28:31.892  XiaomiGateway: Worker started...

Code: Select all

tcp        0      0 127.0.0.1:9898          0.0.0.0:*               LISTEN       0 52 18163/rule_mgr
udp        0      0 0.0.0.0:9898            0.0.0.0:*                            0 43 19727/domoticz
The same thing on Windows 10 64-bit.
log stops on

Code: Select all

XiaomiGateway: Worker started...
and nothing happened when
Imagehttp://ge.tt/4hmk8Xi2



On Raspberry Pi all working fine.
Do i need do some firewall setting on window or router?
How can i debug it?

Code: Select all

pi@raspberrypi:~/domoticz $ ./domoticz
2017-01-27 06:47:17.384  Domoticz V3.6395 (c)2012-2017 GizMoCuz
2017-01-27 06:47:17.387  Build Hash: b0d58fc, Date: 2017-01-20 14:52:28
2017-01-27 06:47:17.394  System: Raspberry Pi
2017-01-27 06:47:17.398  Startup Path: /home/pi/domoticz/
2017-01-27 06:47:17.680  PluginSystem: Failed dynamic library load, install the latest libpython3.x library that is available for your platfo                rm.
2017-01-27 06:47:17.734  Active notification Subsystems: http (1/12)
2017-01-27 06:47:17.782  WebServer(HTTP) started on address: :: with port 8080
2017-01-27 06:47:17.875  Error: WebServer(SSL) startup failed on address 0.0.0.0 with port: 443: bind: Permission denied
2017-01-27 06:47:17.877  Error: WebServer(SSL) check privileges for opening ports below 1024
2017-01-27 06:47:17.882  Proxymanager started.
2017-01-27 06:47:17.896  Starting shared server on: :::6144
2017-01-27 06:47:17.909  TCPServer: shared server started...
2017-01-27 06:47:17.911  RxQueue: queue worker started...
2017-01-27 06:47:19.916  EventSystem: reset all events...
2017-01-27 06:47:19.923  XiaomiGateway: Worker started...
2017-01-27 06:47:19.929  EventSystem: reset all device statuses...
2017-01-27 06:47:19.945  EventSystem: Started
2017-01-27 06:47:20.551  XiaomiGateway: Temperature - nodeid: 158d000116a89d
2017-01-27 06:47:20.566  {"cmd":"read_ack","model":"sensor_ht","sid":"158d000116a89d","short_id":32014,"data":"{\"temperature\":\"2223\",\"hu                midity\":\"3140\"}"}
2017-01-27 06:47:20.559  (mi) Temp (Xiaomi Temperature)
2017-01-27 06:47:20.597  (mi) Light/Switch (Xiaomi Wireless Switch)
2017-01-27 06:47:20.617  {"cmd":"read_ack","model":"switch","sid":"158d00010a88c3","short_id":17332,"data":"{}"}
2017-01-27 06:47:20.624  (mi) Light/Switch (Xiaomi Motion Sensor)
2017-01-27 06:47:20.643  {"cmd":"read_ack","model":"motion","sid":"158d0000fd3061","short_id":44775,"data":"{\"status\":\"no_motion\"}"}
2017-01-27 06:47:20.650  (mi) Light/Switch (Xiaomi Door Sensor)
2017-01-27 06:47:20.669  {"cmd":"read_ack","model":"magnet","sid":"158d00012afd6c","short_id":47575,"data":"{\"status\":\"open\"}"}
2017-01-27 06:47:20.676  (mi) Light/Switch (Xiaomi Smart Plug)
2017-01-27 06:47:20.694  {"cmd":"read_ack","model":"plug","sid":"158d00013fc03f","short_id":10117,"data":"{\"status\":\"on\",\"inuse\":\"1\"}                "}
2017-01-27 06:47:20.701  (mi) Light/Switch (Xiaomi Cube)
2017-01-27 06:47:20.719  {"cmd":"read_ack","model":"cube","sid":"158d000110637d","short_id":26883,"data":"{}"}

Code: Select all

pi@raspberrypi:~ $ netstat -tulpn | grep :9898
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
udp        0      0 0.0.0.0:9898            0.0.0.0:*                           989/domoticz

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

Posted: Friday 27 January 2017 9:15
by corbin
I had Hyper-V enabled on my Windows machine, which was breaking Yeelights and Xiaomi Gateway. Maybe you have something installed that modifies your network adapter?

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

Posted: Friday 27 January 2017 9:32
by pavelbor
Hello,

Domoticz beta version: 3.6500. Still can not control power sockets :(
Log also does not show "full" Gateway messages. When it will be fixed?

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

Posted: Friday 27 January 2017 9:40
by corbin
if you want it working right now, use https://github.com/corbinmunce/domoticz

I'll do a new pull request in the next couple of days, just doing some more testing currently as I don't want to break the main repository code again.

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

Posted: Friday 27 January 2017 9:43
by corbin
levynger wrote: i will check later on today on my ubuntu and update..

regardin the ctrl# device, though perhaps to add to the ID of the device something like hex identification for "ctrl2" and "ctrl1"
before sending command from the UI and before comaring it in the Reciever proc , remove it.. this way i can determine which ctrl and assign the correct command to it, and avoiding extra sql queries on each command transmitted.. sounds ok? or i am missing something?
I don't think this will work as the id is passed in externally in the WriteToHardware function.

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

Posted: Friday 27 January 2017 10:13
by levynger
corbin wrote:
levynger wrote: i will check later on today on my ubuntu and update..

regardin the ctrl# device, though perhaps to add to the ID of the device something like hex identification for "ctrl2" and "ctrl1"
before sending command from the UI and before comaring it in the Reciever proc , remove it.. this way i can determine which ctrl and assign the correct command to it, and avoiding extra sql queries on each command transmitted.. sounds ok? or i am missing something?
I don't think this will work as the id is passed in externally in the WriteToHardware function.
I though removing it before sending to HW again..
i eventually added array as you suggested to store all IDs belong to the ctrl2 (for multiple ctrl2 devices as home), and added an optional paremeter to InsertUpdateSwitch to identify the ctrl2 device from the UDP reciever.

also tried now to change its type to On/Off, and it it twice with Unit field.. however seems that domoticz wont allow to use same ID for the same Type..
the same one is being updated..
so i guess will remain with Selector for the Aqara..


work in progress.. takes time.. at least to my c++ skills.. :D


UPDATE: found how to make 2 on/off type for the same HW.. had to change the xcmd.unitnumber before providing it to mainworker!
Capture.PNG
Capture.PNG (97.2 KiB) Viewed 1888 times

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

Posted: Friday 27 January 2017 14:32
by derrij
i have got this

Code: Select all

017-01-27 15:21:50.541  XiaomiGateway: Worker started...
2017-01-27 15:21:50.544  start_receive
2017-01-27 15:22:51.143  sec_counter 60
2017-01-27 15:23:51.743  sec_counter 120
....
2017-01-27 15:30:55.943  sec_counter 540
2017-01-27 15:31:56.543  sec_counter 600
trying to run Domoricz Xiaomi Gateway on Xiaomi router 3.
how can i debug?

add

when i start domoticz on router
output on router

Code: Select all

root@XiaoQiang:~# tcpdump -n -i br-lan | grep '9898'
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on br-lan, link-type EN10MB (Ethernet), capture size 65535 bytes
16:50:45.909007 IP 192.168.1.11.4321 > 224.0.0.50.9898: UDP, length 135
16:50:55.881381 IP 192.168.1.11.4321 > 224.0.0.50.9898: UDP, length 135
16:51:05.853986 IP 192.168.1.11.4321 > 224.0.0.50.9898: UDP, length 135
when i start domoticz on raspberry pi (ip 192.168.1.190)
output on router

Code: Select all

root@XiaoQiang:~# tcpdump -n -i br-lan | grep '9898'
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on br-lan, link-type EN10MB (Ethernet), capture size 65535 bytes
16:50:45.909007 IP 192.168.1.11.4321 > 224.0.0.50.9898: UDP, length 135
16:50:52.122336 IP 192.168.1.190.9898 > 224.0.0.50.4321: UDP, length 15
16:50:55.881381 IP 192.168.1.11.4321 > 224.0.0.50.9898: UDP, length 135
16:51:05.853986 IP 192.168.1.11.4321 > 224.0.0.50.9898: UDP, length 135

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

Posted: Friday 27 January 2017 14:59
by deennoo
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!Capture.PNG
Guys ! Corbin and you are the mens of Xiaomi In Domoticz Dev !

got a small teaser for you :

http://domo-attitude.fr/cube-xiaomi-teaser/

Xiaomi Cube + Yeelight : Rotative dimmer !