Xiaomi Cube rotate [Solved]
Moderator: leecollings
-
- Posts: 19
- Joined: Thursday 26 September 2019 21:03
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Xiaomi Cube rotate
Hello I have some logs from Xiaomi Cube like this:
2019-10-04 19:20:12.562 (Conbee) onMessage called
2019-10-04 19:20:12.562 (Conbee) ### WebSocket Data : {'state': {'buttonevent': 7000, 'gesture': 0, 'lastupdated': '2019-10-04T17:20:12'}, 'r': 'sensors', 'uniqueid': '00:15:8d:00:02:9b:f6:2a-02-0012', 'e': 'changed', 'id': '3', 't': 'event'}
2019-10-04 19:20:12.563 (Conbee) ### Update device (Cube) : {'sValue': '20', 'nValue': 20}
2019-10-04 19:20:12.918 (Conbee) onHeartbeat called
2019-10-04 19:20:12.918 (Conbee) ### Update device (Cube) : {'sValue': 'Off', 'nValue': 0}
2019-10-04 19:20:13.074 (Conbee) onMessage called
2019-10-04 19:20:13.074 (Conbee) ### WebSocket Data : {'state': {'buttonevent': -4782, 'gesture': 8, 'lastupdated': '2019-10-04T17:20:13'}, 'r': 'sensors', 'uniqueid': '00:15:8d:00:02:9b:f6:2a-03-000c', 'e': 'changed', 'id': '4', 't': 'event'}
2019-10-04 19:20:13.074 (Conbee) ### Update device (Conbee - lumi.sensor_cube.aqgl01 4) : {'sValue': '-4782', 'nValue': -4782}
2019-10-04 19:20:22.902 (Conbee) onHeartbeat called
2019-10-04 19:20:22.902 (Conbee) ### Update device (Conbee - lumi.sensor_cube.aqgl01 4) : {'sValue': 'Off', 'nValue': 0}
And variable:
local Cube_angle = 'Cube'
how to assign to variable angle from logs? I know that is nValue, or {'state': {'buttonevent': -4782. but have to aby idea how to her this.
It should be somethink like that :
(Cube_angle).stare.buttonevent ??
2019-10-04 19:20:12.562 (Conbee) onMessage called
2019-10-04 19:20:12.562 (Conbee) ### WebSocket Data : {'state': {'buttonevent': 7000, 'gesture': 0, 'lastupdated': '2019-10-04T17:20:12'}, 'r': 'sensors', 'uniqueid': '00:15:8d:00:02:9b:f6:2a-02-0012', 'e': 'changed', 'id': '3', 't': 'event'}
2019-10-04 19:20:12.563 (Conbee) ### Update device (Cube) : {'sValue': '20', 'nValue': 20}
2019-10-04 19:20:12.918 (Conbee) onHeartbeat called
2019-10-04 19:20:12.918 (Conbee) ### Update device (Cube) : {'sValue': 'Off', 'nValue': 0}
2019-10-04 19:20:13.074 (Conbee) onMessage called
2019-10-04 19:20:13.074 (Conbee) ### WebSocket Data : {'state': {'buttonevent': -4782, 'gesture': 8, 'lastupdated': '2019-10-04T17:20:13'}, 'r': 'sensors', 'uniqueid': '00:15:8d:00:02:9b:f6:2a-03-000c', 'e': 'changed', 'id': '4', 't': 'event'}
2019-10-04 19:20:13.074 (Conbee) ### Update device (Conbee - lumi.sensor_cube.aqgl01 4) : {'sValue': '-4782', 'nValue': -4782}
2019-10-04 19:20:22.902 (Conbee) onHeartbeat called
2019-10-04 19:20:22.902 (Conbee) ### Update device (Conbee - lumi.sensor_cube.aqgl01 4) : {'sValue': 'Off', 'nValue': 0}
And variable:
local Cube_angle = 'Cube'
how to assign to variable angle from logs? I know that is nValue, or {'state': {'buttonevent': -4782. but have to aby idea how to her this.
It should be somethink like that :
(Cube_angle).stare.buttonevent ??
-
- Posts: 815
- Joined: Wednesday 15 August 2018 14:38
- Target OS: -
- Domoticz version:
- Contact:
Re: Xiaomi Cube rotate
The cube have 2 device
"cube" for state (numeric/bool value), device id = 3
"Conbee - lumi.sensor_cube.aqgl01 4" for angle, device id = 4
So if you want to retreive angle value, try the second device.
To retreive value are you using LUA or Dzevent ? And you are right, just ask for nvalue.
"cube" for state (numeric/bool value), device id = 3
"Conbee - lumi.sensor_cube.aqgl01 4" for angle, device id = 4
So if you want to retreive angle value, try the second device.
To retreive value are you using LUA or Dzevent ? And you are right, just ask for nvalue.
Code: Select all
if devicechanged['deCONZ - Angle Cube Xioami'] then
print ( 'Debug : '..devicechanged['deCONZ - Angle Cube Xioami'] )
end
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Xiaomi Cube rotate
Assuming the names of your cube devices start with XCube you could use something like the below script to get the state(s)
Code: Select all
return {
on = { devices = { 'XCube*' } },
execute = function(dz, item )
dz.log(item.name .. " state: " .. item.state,dz.LOG_FORCE)
dz.log(item.name .. " nValue: ".. item.nValue,dz.LOG_FORCE)
end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
- Posts: 19
- Joined: Thursday 26 September 2019 21:03
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Xiaomi Cube rotate
So if my device in domoticz is cube_device
This should be :
Its correct ?
This should be :
Code: Select all
return {
on = { devices = { 'cube_device' } },
execute = function(domoticz, cube_device )
domoticz.log(cube_device.name .. " state: " .. cube_device.state,domoticz.LOG_FORCE)
domoticz.log(cube_device.name .. " nValue: ".. cube_device.nValue,domoticz.LOG_FORCE)
end
}
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Xiaomi Cube rotate
Yes, but if you use
Code: Select all
return {
on = { devices = { 'cube*' } },
execute = function(dz, item )
dz.log(item.name .. " state: " .. item.state,dz.LOG_FORCE)
dz.log(item.name .. " nValue: ".. item.nValue,dz.LOG_FORCE)
end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
- Posts: 815
- Joined: Wednesday 15 August 2018 14:38
- Target OS: -
- Domoticz version:
- Contact:
Re: Xiaomi Cube rotate
Ha yep, I m just seeing we are in dzEvent section ^^, so my question was stupid.
-
- Posts: 19
- Joined: Thursday 26 September 2019 21:03
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Xiaomi Cube rotate
I put this script and it doesnt return anything in domoticz log
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Xiaomi Cube rotate
If the device is defined in domoticz and the state or nValue is updated in a standard way the script should react to a movement of the cube.
Change cube* to * in the script to catch any device.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
- Posts: 19
- Joined: Thursday 26 September 2019 21:03
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Xiaomi Cube rotate
I put * instead device name and it seems like script is looking for nValue for all devices in utility tab, but I dont see any Cube device in Utility.. I have only cube im switch tab
-
- Posts: 815
- Joined: Wednesday 15 August 2018 14:38
- Target OS: -
- Domoticz version:
- Contact:
Re: Xiaomi Cube rotate
If all is ok you will have
1 device in swich tab (for state)
1 device in utility (for angle)
Take a look in setting/device, perhaps it is not activated yet. Device that are not activated don't trigger (Conbee - lumi.sensor_cube.aqgl01 4)
1 device in swich tab (for state)
1 device in utility (for angle)
Take a look in setting/device, perhaps it is not activated yet. Device that are not activated don't trigger (Conbee - lumi.sensor_cube.aqgl01 4)
-
- Posts: 19
- Joined: Thursday 26 September 2019 21:03
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Xiaomi Cube rotate [Solved]
Its works, thanks guys for help !
Who is online
Users browsing this forum: No registered users and 1 guest