Page 41 of 123
Re: Xiaomi Smart Home Suite (very cheap) compatibilty?
Posted: Friday 24 February 2017 12:43
by joebar
I also prefer lua and especially the dzVents framework in lua. So much more control..
the 'on' part controls at what circumstances the script runs, so in this case you can say it should react on the switch, but you can also say only on the switch between 10 and 15 hour and on mon, tue, fri what ever..
Code: Select all
return {
active = true,
on = 'Xiaomi Wireless switch' -- which switch?
},
execute = function (domotics,switch)
local light = 'Xiaomi RGB Gateway' -- which light?
if (switch.state == 'Click') then
light.toggleSwitch() -- toggle on/off every time
elseif (switch.state == 'Double Click') then
-- do something else
elseif (switch.state == 'Long Click') then
-- and again someting else
end
end -- end execute part
} -- end
Re: Xiaomi Smart Home Suite (very cheap) compatibilty?
Posted: Friday 24 February 2017 13:20
by levynger
Does any one knows how to trigger "alert" and "swing" with the cube?
Re: Xiaomi Smart Home Suite (very cheap) compatibilty?
Posted: Friday 24 February 2017 18:31
by murtadin
Hi all! I wonder if someone have sources backup v3.6441 or close to this beta? Thank you.
Re: Xiaomi Smart Home Suite (very cheap) compatibilty?
Posted: Saturday 25 February 2017 10:05
by Kwintessens
I am still getting these errors after adding the gateway and devices in Domoticz (running beta version: 3.6765 on synology):
XiaomiGateway: SendMessageToGateway failed on first attempt, will try again
2017-02-25 10:01:53.921 Error: XiaomiGateway: unable to write command - Invalid Key
Any help?
Re: Xiaomi Smart Home Suite (very cheap) compatibilty?
Posted: Saturday 25 February 2017 10:33
by jelleeelco
pikapt wrote: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
Hi Corbin,
Did you fix it by adding 286c it by making the sid variable? In having the same issue and my sid starts with 158d.
Thanks
Jelle
Re: Xiaomi Smart Home Suite (very cheap) compatibilty?
Posted: Saturday 25 February 2017 13:45
by ibniba
Levynger - Thanks for your input but unfortunately I'm still a bit lost.
I have the Xiaomi Gateway set to port 9898
In Devices this is what I have:
- 1.png (45.62 KiB) Viewed 2766 times
You will see that Xiaomi Gateway, Smart Plug, Sensor, Switch and Cube are all listed as 'off'.
And if I click on the light bulb on the left hand side of the screen for Xiaomi RGB Gateway for example to turn it on I get this:
- 3.png (11.3 KiB) Viewed 2766 times
So I guess I need to get these turned on but I don't know how.
In the Switches tab I have this:
- 2.png (92.99 KiB) Viewed 2766 times
Sorry if I don't explain myself very well but I'm struggling here to set it up right.
Re: Xiaomi Smart Home Suite (very cheap) compatibilty?
Posted: Saturday 25 February 2017 21:30
by corbin
@jelleeelco yes the prefix is variable now for the gateway, as I thought they all started with 'f0b4', but not all as discovered pikapt. All sensors/devices start with '158d' like yours - if this changes then I will need to update the code to handle.
Re: Xiaomi Smart Home Suite (very cheap) compatibilty?
Posted: Saturday 25 February 2017 21:34
by corbin
@Kwintessens
Can you post the exact key you have entered for the Gateway? (you can change it later if you are worried about security)
Also If you want to troubleshoot, please setup a test vm running Windows or Linux, and compile my github repo at
https://github.com/corbinmunce/domoticz
Re: Xiaomi Smart Home Suite (very cheap) compatibilty?
Posted: Sunday 26 February 2017 8:32
by jelleeelco
corbin wrote:@jelleeelco yes the prefix is variable now for the gateway, as I thought they all started with 'f0b4', but not all as discovered pikapt. All sensors/devices start with '158d' like yours - if this changes then I will need to update the code to handle.
Thanks Corbin. Then that cannot be the reason that my Domoticz is unable to send instructions to the xiaomi gateway. All statuses are updated correctly, but initiating the action from domoticz doesn't work. This is for the wired wall switch, but also the small round battery switch and the gateway light: if I press them physically they work and the action is visible in robotics, but when using the virtual switch in domoticz nothing happens.
I'll try to compile your version from Git. Never done that before; can I install it over my current beta? And if there are no differences (which is what I suspect since you mention the at one point all your code was in the normal beta), can I go back easily?
Many thanks for all your hard work!
Jelle
Re: Xiaomi Smart Home Suite (very cheap) compatibilty?
Posted: Sunday 26 February 2017 8:58
by corbin
The instructions on the wiki to compile are easy to follow:
http://www.domoticz.com/wiki/Linux
when you clone the repo, choose a different directory to install to, ie:
Code: Select all
git clone https://github.com/domoticz/domoticz.git domoticz-test
And stop your main domoticz install from running, if you are testing on the same machine.
Re: Xiaomi Smart Home Suite (very cheap) compatibilty?
Posted: Sunday 26 February 2017 13:28
by Kwintessens
corbin wrote:@Kwintessens
Can you post the exact key you have entered for the Gateway? (you can change it later if you are worried about security)
Also If you want to troubleshoot, please setup a test vm running Windows or Linux, and compile my github repo at
https://github.com/corbinmunce/domoticz
I've tried multiple times with the password from the app, as instructed:
- Screenshot_20170225-095705.png (203 KiB) Viewed 2654 times
Am I missing anything? I find it strange it updates/adds devices initially but stops working thereafter. In the meantime I will run a VM as soon as I have access to my notebook.
Re: Xiaomi Smart Home Suite (very cheap) compatibilty?
Posted: Sunday 26 February 2017 18:30
by Mooseknuckle
Hi,
I made icon files for the cube and the round selector switch. Grab them if you like.
Re: Xiaomi Smart Home Suite (very cheap) compatibilty?
Posted: Sunday 26 February 2017 19:54
by jelleeelco
corbin wrote:The instructions on the wiki to compile are easy to follow:
http://www.domoticz.com/wiki/Linux
when you clone the repo, choose a different directory to install to, ie:
Code: Select all
git clone https://github.com/domoticz/domoticz.git domoticz-test
And stop your main domoticz install from running, if you are testing on the same machine.
Hi Corbin,
I followed the instructions but get an error. First stopped domoticz. Then I created the directory domoticz-test and grabbed your git version (into the test directory). The first error is when i do the cmake from within the test directory; i get the message that i have to provide the source file. I then go to the home dir and type "cmake domoticz-test". That worked.
Then " make" and at the end i get the following error:
Code: Select all
[ 99%] Building CXX object CMakeFiles/domoticz.dir/tinyxpath/tinyxmlparser.cpp.o
[ 99%] Building CXX object CMakeFiles/domoticz.dir/tinyxpath/xpath_expression.cpp.o
[100%] Building CXX object CMakeFiles/domoticz.dir/tinyxpath/xpath_static.cpp.o
Linking CXX executable domoticz
/usr/bin/ld: cannot open output file domoticz: Is a directory
collect2: error: ld returned 1 exit status
CMakeFiles/domoticz.dir/build.make:4971: recipe for target 'domoticz' failed
make[2]: *** [domoticz] Error 1
CMakeFiles/Makefile2:64: recipe for target 'CMakeFiles/domoticz.dir/all' failed
make[1]: *** [CMakeFiles/domoticz.dir/all] Error 2
Makefile:136: recipe for target 'all' failed
make: *** [all] Error 2
pi@raspberrypi:~ $
Any clue??
Re: Xiaomi Smart Home Suite (very cheap) compatibilty?
Posted: Monday 27 February 2017 9:22
by corbin
@jelleeelco, you didn't specify if you installed the required libraries first, so just want to make sure you ran all these commands:
Code: Select all
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential nano cmake git libboost-dev libboost-thread-dev libboost-system-dev
sudo apt-get install libsqlite3-dev curl libcurl4-openssl-dev libssl-dev libusb-dev zlib1g-dev python3-dev
cd ~
git clone https://github.com/domoticz/domoticz.git domoticz
cd domoticz
cmake -DCMAKE_BUILD_TYPE=Release .
make
Re: Xiaomi Smart Home Suite (very cheap) compatibilty?
Posted: Monday 27 February 2017 9:32
by corbin
Kwintessens wrote:
Am I missing anything? I find it strange it updates/adds devices initially but stops working thereafter. In the meantime I will run a VM as soon as I have access to my notebook.
Sounds like the problem is fixed already in my repo, hope to have it updated in the main beta soon.
Re: Xiaomi Smart Home Suite (very cheap) compatibilty?
Posted: Monday 27 February 2017 13:41
by jelleeelco
corbin wrote:@jelleeelco, you didn't specify if you installed the required libraries first, so just want to make sure you ran all these commands:
Code: Select all
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential nano cmake git libboost-dev libboost-thread-dev libboost-system-dev
sudo apt-get install libsqlite3-dev curl libcurl4-openssl-dev libssl-dev libusb-dev zlib1g-dev python3-dev
cd ~
git clone https://github.com/domoticz/domoticz.git domoticz
cd domoticz
cmake -DCMAKE_BUILD_TYPE=Release .
make
Hi Corbin,
No, I did all that but I think it has to do with the boostfiles. Found something on the wiki....
BUT.....
I build a complete new system from scratch. Compiled your version and guess what...didn't work. Then I looked BETTER at the IP address of the Gateway and found that that was WRONG!!
So, if the IP address of the gateway is wrong in the settings, Domoticz will still get all the status updates. But it cannot control the gateway of course. So I put in my production SD card again and changed the IP address to the correct one: EVERYTHING WORKS!!
Many thanks for all your help!!
Rgds
Jelle
Re: Xiaomi Smart Home Suite (very cheap) compatibilty?
Posted: Monday 27 February 2017 16:39
by levynger
woody4165 wrote:deennoo wrote:Rotation value is a text device who appear once you rotate cube once.
Just wrote a small script, but since I'm not a coder, I'm sure it can be optimized...
In my case, I want that the dimming works only if the lamp is already On.
Code: Select all
commandArray = {}
-- Run only if the cube has been rotated clockwise or anti-clockwise
if devicechanged['Xiaomi Cube Switch'] == "clock_wise" or devicechanged['Xiaomi Cube Switch'] == "anti_clock_wise" then
-- Runs only if the light is already On
if (otherdevices['YeeLight Salone'] == "On" or otherdevices['YeeLight Salone'] == "Set Level") then
-- grab the actual dimming value
actual_dimming = tonumber(otherdevices_svalues['YeeLight Salone'])
--if the cube has been rotated clockwise and dimming is below 100
if ((otherdevices['Xiaomi Cube Switch'] == "clock_wise") and actual_dimming < 100) then
-- need to find only the integer value
actual_rotation = otherdevices_svalues['Xiaomi Cube Text']
virgola = string.find(actual_rotation, ",")
numero = string.sub(actual_rotation, 1, virgola-1)
-- Add the rotation value to the actual dimming, and if is greater than 100, set it to 100
new_dim_value = actual_dimming + tonumber(numero)
if new_dim_value > 100 then
new_dim_value = 100
end
comando = "Set Level "..new_dim_value
commandArray['YeeLight Salone']=comando
end
--if the cube has been rotated anti-clockwise and dimming is above 1
if (otherdevices['Xiaomi Cube Switch'] == "anti_clock_wise" and actual_dimming > 1) then
-- need to find only the integer value
actual_rotation = otherdevices_svalues['Xiaomi Cube Text']
virgola = string.find(actual_rotation, ",")
numero = string.sub(actual_rotation, 1, virgola-1)
-- Add the rotation value (in this case is a negative value), to the actual dimming, and if is smaller than 1, set it to 1
new_dim_value = actual_dimming + tonumber(numero)
if new_dim_value < 1 then
new_dim_value = 1
end
comando = "Set Level "..new_dim_value
commandArray['YeeLight Salone']=comando
end
end
end
return commandArray
It seems to work, if you have any suggestion, please share it!
thanks, recieved my cube, and used your script, modified it abit to allow turning on/off as well based on rotation is someone interfested in:
Code: Select all
-- Run only if the cube has been rotated clockwise or anti-clockwise
if devicechanged['Xiaomi Cube'] == "clock_wise" or devicechanged['Xiaomi Cube'] == "anti_clock_wise" then
-- Runs only if the light is already On
--if (otherdevices['CorridorLight'] == "On" or otherdevices['CorridorLight'] == "Set Level") then
-- grab the actual dimming value
actual_dimming = tonumber(otherdevices_svalues['CorridorLight'])
print("the Current YeeeLightSvalue: " .. actual_dimming)
--if the cube has been rotated clockwise and dimming is below 100
if ((otherdevices['Xiaomi Cube'] == "clock_wise") and actual_dimming < 100) then
-- need to find only the integer value
actual_rotation = otherdevices_svalues['Xiaomi Cube Text']
virgola = string.find(actual_rotation, ",")
numero = string.sub(actual_rotation, 1, virgola-1)
-- Add the rotation value to the actual dimming, and if is greater than 100, set it to 100
new_dim_value = actual_dimming + tonumber(numero)
if new_dim_value > 100 then
new_dim_value = 100
end
comando = "Set Level "..new_dim_value
commandArray['CorridorLight']=comando
end
--if the cube has been rotated anti-clockwise and dimming is above 1
if (otherdevices['Xiaomi Cube'] == "anti_clock_wise" and actual_dimming > 1) then
-- need to find only the integer value
print("a test print")
actual_rotation = otherdevices_svalues['Xiaomi Cube Text']
virgola = string.find(actual_rotation, ",")
numero = string.sub(actual_rotation, 1, virgola-1)
-- Add the rotation value (in this case is a negative value), to the actual dimming, and if is smaller than 1, set it to 1
new_dim_value = actual_dimming + tonumber(numero)
print("the new value to reduce to: " .. new_dim_value)
if new_dim_value <= 1 then
new_dim_value = 0
end
comando = "Set Level "..new_dim_value
commandArray['CorridorLight']=comando
end
--end
end
return commandArray
Re: Xiaomi Smart Home Suite (very cheap) compatibilty?
Posted: Wednesday 01 March 2017 9:32
by deennoo
Using 3.6807, i'm facing a issue :
Heartbeat doesn't only update status, it change statut device too :
Using a 230v double switch, one button is connected to a real bulb, no probleme with this, the second oneis use to drive a yeelight bt bedside lamp (will provid an how to to drive it later) via a script
Code: Select all
if 230 switch statut change (no matter on or off) and bed side lamp is off then turn on bed side lampe
elseif 230 switch statut change (no matter on or off) and bed side lamp is on then turn offbed side lampe
advantage to don't care about on or off switch state is that action act as a simple push on button
but heartbeat trigger script each time he "update" or check the device :
Code: Select all
2017-03-01 09:22:10.053 User: Admin initiated a switch command (2704/Chevet Nico/Off)
2017-03-01 09:22:10.053 {"cmd":"heartbeat","model":"ctrl_neutral2","sid":"158d000153b50f","short_id":18029,"data":"{\"channel_0\":\"off\",\"channel_1\":\"off\"}"}
2017-03-01 09:22:10.233 Executing script: /home/nico/domoticz/scripts/shell/yeelightbt/off.sh
it confirm by the log
- Capture.PNG (62.92 KiB) Viewed 2348 times
No way to just update device if heartbeat provid a different status from the last one ?
exemple : if heartbeat for ctrl_neutral2 channel_0 = Off and Channel 0 is already Off then do nothing, else if Channel 0 is On then update
Re: Xiaomi Smart Home Suite (very cheap) compatibilty?
Posted: Wednesday 01 March 2017 9:38
by corbin
Is anyone using the "no_motion" updates? I could just ignore any messages that are not the 2 minute of no motion update:
only other way I can think of to ensure "off" for the PIR is only sent once is to query the database for the current state each time a "no_motion" message is received.
Re: Xiaomi Smart Home Suite (very cheap) compatibilty?
Posted: Wednesday 01 March 2017 9:41
by corbin
jelleeelco wrote:
Many thanks for all your help!!
Rgds
Jelle
Glad you got it going! And good of you to admit your mistake