Xiaomi Smart Home Suite (very cheap) compatibilty?

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

Moderator: leecollings

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: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.
Question about the Xiaomi Gateway in Domoticz? Please check the Wiki first: https://www.domoticz.com/wiki/Xiaomi_Gateway_(Aqara)
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 »

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
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 »

I've just updated github, should work for you now.
Question about the Xiaomi Gateway in Domoticz? Please check the Wiki first: https://www.domoticz.com/wiki/Xiaomi_Gateway_(Aqara)
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 »

thanks a lot mate! i'll give it a test tomorrow and will let you know! cheers!
Coldman
Posts: 61
Joined: Saturday 17 December 2016 11:51
Target OS: Linux
Domoticz version: Beta
Location: Moscow, Russia
Contact:

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

Post 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.
User avatar
galadril
Posts: 824
Joined: Monday 07 September 2015 10:32
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Contact:

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

Post by galadril »

Got the next exception after the latest update:
17:57:30.973 Error: MiHome hardware (13) thread seems to have ended unexpectedly
Solar panels of Ginlong, Omnik-Solar, Transenergy or Solarman?? Try my Android app:
https://play.google.com/store/apps/deta ... ongmonitor
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, @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?
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,
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
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 »

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
Domoticz stable 3.5877 for real & Domoticz beta for test
Rfxtrxe / RFLink / Milight / Yeelight / Tasmota / MQTT / BLE / Zigate
http://domo-attitude.fr
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 »

I've undone my change so should compile again. I'll try to get it going in Linux later.
Question about the Xiaomi Gateway in Domoticz? Please check the Wiki first: https://www.domoticz.com/wiki/Xiaomi_Gateway_(Aqara)
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 quick update, i'm now able to control gateway led as expected! thanks a lot mate!!
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: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..
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 »

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
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 »

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?
Question about the Xiaomi Gateway in Domoticz? Please check the Wiki first: https://www.domoticz.com/wiki/Xiaomi_Gateway_(Aqara)
pavelbor
Posts: 35
Joined: Sunday 18 December 2016 12:18
Target OS: Raspberry Pi / ODroid
Domoticz version: LastBeta
Location: Tallinn / Estonia
Contact:

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

Post 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?
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 »

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.
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 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.
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: 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 1885 times
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 »

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
Last edited by derrij on Friday 27 January 2017 15:57, edited 2 times in total.
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 »

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 !
Domoticz stable 3.5877 for real & Domoticz beta for test
Rfxtrxe / RFLink / Milight / Yeelight / Tasmota / MQTT / BLE / Zigate
http://domo-attitude.fr
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest