Re: Xiaomi Smart Home Suite (very cheap) compatibilty?
Posted: Wednesday 08 February 2017 14:07
Rotation value is a text device who appear once you rotate cube once.
Open source Home Automation System
https://forum.domoticz.com/
Tried that on both machines (working and not working yet) - no debug messages at all in log.corbin wrote:murtadin wrote:@Corbin - tried today last beta from your git V3.6635 - i have got semi working build without setting ip manual in XiaomiGateway.cpp. Detected all zigbee devices - but still have error with invalid key, when trying to switch zigbee plug or gatweway light for example.
In XiaomiGateway.cpp i see #ifdef _DEBUG - how can i see output?see https://www.domoticz.com/wiki/Install.txt#InstallationCode: Select all
cmake -DCMAKE_BUILD_TYPE=Debug .
Code: Select all
./domoticz -www 8080 -sslwww 0 -wwwbind 192.168.111.201 -verbose 2 -log /var/log/domoticz.log -daemon
That just à matter of gateway Fw who are not as thé same level of the documented API.Jumper3126 wrote:I'm very interesting in a posibility to monitor power usage per plug. I understand that in principle this is possible with the xiaomi plugs, but this option has so far not been implemented into domoticz.
Is this just a matter of time, or could this in the end not be feasible at all?
Thanks
Hi deennoo,deennoo wrote:That just à matter of gateway Fw who are not as thé same level of the documented API.Jumper3126 wrote:I'm very interesting in a posibility to monitor power usage per plug. I understand that in principle this is possible with the xiaomi plugs, but this option has so far not been implemented into domoticz.
Is this just a matter of time, or could this in the end not be feasible at all?
Thanks
Corbin already add this aviability, and device will appear when gateway will send the information.
My 2 cents on the situation: the documentation provides info on how the data should be reported. The issue is, current data sent by gateway does not conform to the documentation. I sort of expected, the communication about turning on and off the socket does not contain the data as the value is not collected at that very moment and for some reason, gateway does not send the update when measurement is actually made. But this has been my assumption only and Android Mi Home app does get this information somehow.Jumper3126 wrote:Hi deennoo,deennoo wrote:That just à matter of gateway Fw who are not as thé same level of the documented API.Jumper3126 wrote:I'm very interesting in a posibility to monitor power usage per plug. I understand that in principle this is possible with the xiaomi plugs, but this option has so far not been implemented into domoticz.
Is this just a matter of time, or could this in the end not be feasible at all?
Thanks
Corbin already add this aviability, and device will appear when gateway will send the information.
Do I understand you correctly that currently you already can get the power usage into Domoticz from these plugs (http://www.gearbest.com/living-applianc ... 44666.html)?
I have created a small Lua script that does exactly what you've described.mKotek wrote:I have just posted an issue I am facing with Xiaomi Wireless Switch (the round one) here. It would be great if you could comment and provide ideas on how to solve the click issue I am facing.
Just wrote a small script, but since I'm not a coder, I'm sure it can be optimized...deennoo wrote:Rotation value is a text device who appear once you rotate cube once.
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
Sorry that must be Windows only, try addingmurtadin wrote: In XiaomiGateway.cpp i see #ifdef _DEBUG - how can i see output?
Code: Select all
#define _DEBUG
Yes it works - now i see some debug messages in logs:corbin wrote:Sorry that must be Windows only, try addingmurtadin wrote: In XiaomiGateway.cpp i see #ifdef _DEBUG - how can i see output?after the includes to XiaomiGateway.cppCode: Select all
#define _DEBUG
Code: Select all
2017-02-10 12:52:55.588 XiaomiGateway: Using 192.168.111.254 for local IP address.
2017-02-10 12:52:55.588 XiaomiGateway: BINDING UDP TO SPECIFIC LOCAL IP 192.168.111.254
2017-02-10 12:52:55.588 EventSystem: reset all device statuses...
2017-02-10 12:52:55.589 EventSystem: Started
2017-02-10 12:52:55.643 XiaomiGateway: RGB Gateway Detected
Code: Select all
2017-02-10 12:54:19.519 User: Admin initiated a switch command (24/console.living/On)
2017-02-10 12:54:19.519 XiaomiGateway: GetGatewayKey Password - w4nxoquhmew5rpid
2017-02-10 12:54:19.519 XiaomiGateway: GetGatewayKey Token -
2017-02-10 12:54:19.519 XiaomiGateway: GetGatewayKey key - BF814FE7C3205F68F7C3556705AC2092
2017-02-10 12:54:19.670 XiaomiGateway: request {"cmd":"write","model":"plug","sid":"158d000117a188","short_id":9844,"data":"{\"channel_0\":\"on\",\"key\":\"BF814FE7C3205F68F7C3556705AC2092\"}" }
2017-02-10 12:54:19.670 Error: XiaomiGateway: unable to write command - Invalid Key
2017-02-10 12:54:19.670 XiaomiGateway: response {"cmd":"write_ack","sid":"158d000117a188","data":"{\"error\":\"Invalid key\"}"}
2017-02-10 12:54:19.670 XiaomiGateway: SendMessageToGateway failed on first attempt, will try again
2017-02-10 12:54:19.770 XiaomiGateway: GetGatewayKey Password - w4nxoquhmew5rpid
2017-02-10 12:54:19.770 XiaomiGateway: GetGatewayKey Token -
2017-02-10 12:54:19.770 XiaomiGateway: GetGatewayKey key - BF814FE7C3205F68F7C3556705AC2092
2017-02-10 12:54:19.920 XiaomiGateway: request {"cmd":"write","model":"plug","sid":"158d000117a188","short_id":9844,"data":"{\"channel_0\":\"on\",\"key\":\"BF814FE7C3205F68F7C3556705AC2092\"}" }
2017-02-10 12:54:19.920 Error: XiaomiGateway: unable to write command - Invalid Key
2017-02-10 12:54:19.920 XiaomiGateway: response {"cmd":"write_ack","sid":"158d000117a188","data":"{\"error\":\"Invalid key\"}"}
Code: Select all
2017-02-10 21:03:56.951 {"cmd":"heartbeat","model":"switch","sid":"158d000104ed67","short_id":22560,"data":"{}"}
2017-02-10 21:05:03.719 {"cmd":"heartbeat","model":"plug","sid":"158d00010e080c","short_id":58729,"data":"{\"status\":\"off\",\"inuse\":\"0\"}"}
2017-02-10 21:05:22.353 {"cmd":"heartbeat","model":"plug","sid":"158d00011070b4","short_id":62158,"data":"{\"status\":\"off\",\"inuse\":\"1\"}"}
2017-02-10 21:08:16.435 {"cmd":"heartbeat","model":"motion","sid":"158d0000fd32c2","short_id":1950,"data":"{\"status\":\"no_motion\"}"}
no heartbeat messages at all. will try a little experiment later - disable all network interfaces except one.corbin wrote:are you receiving any heartbeat messages at all?, eg:
Code: Select all
2017-02-10 21:03:56.951 {"cmd":"heartbeat","model":"switch","sid":"158d000104ed67","short_id":22560,"data":"{}"} 2017-02-10 21:05:03.719 {"cmd":"heartbeat","model":"plug","sid":"158d00010e080c","short_id":58729,"data":"{\"status\":\"off\",\"inuse\":\"0\"}"} 2017-02-10 21:05:22.353 {"cmd":"heartbeat","model":"plug","sid":"158d00011070b4","short_id":62158,"data":"{\"status\":\"off\",\"inuse\":\"1\"}"} 2017-02-10 21:08:16.435 {"cmd":"heartbeat","model":"motion","sid":"158d0000fd32c2","short_id":1950,"data":"{\"status\":\"no_motion\"}"}
looks like yours, as already says i will share once stable will be release, i don't want to create probleme for those who doesn't follow all beta.woody4165 wrote:
It seems to work, if you have any suggestion, please share it!
Thanks for the explanation. So for now it remains unclear if these feature can be installed in Domoticz. However, as it works via the app, these plugs are still very economical alternatives for the plugwise plugsmKotek wrote:My 2 cents on the situation: the documentation provides info on how the data should be reported. The issue is, current data sent by gateway does not conform to the documentation. I sort of expected, the communication about turning on and off the socket does not contain the data as the value is not collected at that very moment and for some reason, gateway does not send the update when measurement is actually made. But this has been my assumption only and Android Mi Home app does get this information somehow.Jumper3126 wrote:Hi deennoo,deennoo wrote: That just à matter of gateway Fw who are not as thé same level of the documented API.
Corbin already add this aviability, and device will appear when gateway will send the information.
Do I understand you correctly that currently you already can get the power usage into Domoticz from these plugs (http://www.gearbest.com/living-applianc ... 44666.html)?
The whole integration is already defined to report power consumption as far as I understand. When only gateway will start pushing this information out as described in the documentation, we shall see it in Domoticz. But it is not clear, why gateway is not sending data as describet so it may be the bug or a featureJumper3126 wrote:Thanks for the explanation. So for now it remains unclear if these feature can be installed in Domoticz. However, as it works via the app, these plugs are still very economical alternatives for the plugwise plugsmKotek wrote:My 2 cents on the situation: the documentation provides info on how the data should be reported. The issue is, current data sent by gateway does not conform to the documentation. I sort of expected, the communication about turning on and off the socket does not contain the data as the value is not collected at that very moment and for some reason, gateway does not send the update when measurement is actually made. But this has been my assumption only and Android Mi Home app does get this information somehow.Jumper3126 wrote:
Hi deennoo,
Do I understand you correctly that currently you already can get the power usage into Domoticz from these plugs (http://www.gearbest.com/living-applianc ... 44666.html)?
Before you ask such questions, please take some time to read the whole thread. Just 4 pages back, there was a link give to the site that has tackled the cameras (if you mean Xiaofeng ones) to make them available on the network: see this post and good luck. I am still waiting for mine.Derik wrote:I do have the cube camera from Xiaomi.
Very nice camera great resolution.
Only 1 thing i cannot see the camera in my lan [ just the IP, not a ui ] , only visible in the Xiaomi app.
Perhaps some have this camera in Domoticz working, like a normal IP camera.
I ask Xiaomi, only no answer...