zigbeefordomoticz / Domoticz-Zigbee

Zigbee plugin for Domoticz. Allow to connect various zigbee controllers like Zigate but also Texas Instrument CC2531, CC13x2, CC26x2 ; Silicon-Labs; deConz based chipset to be connected to Domoticz
GNU General Public License v3.0
99 stars 43 forks source link

Recover Domoticz angle of rotation of the Cube from Xiaomi. #329

Closed nicog2 closed 5 years ago

nicog2 commented 5 years ago

Hello,

Would it be possible to remake under domoticz the value of the angle made. With for example a positive angle if the rotation is clockwise, and negative if anti-clockwise. This value can go up in a second device (ID). In order to control, for example, the volume, a variable lamp ...

thanks in advance

pipiche38 commented 5 years ago

Today's widget provides Clock wise and Anti-Clock wise information as well as Flip 90 or 180 and some other possible actions from the Cube.

Creating a Second widget when pairing a Cube is of course possible. This second widget would be a Text widget ( not a switch ) and will be available on the Utility section (not in the switch section ).

In order to make it more useful, we could eventually push all Cube events to this Text widget and of course when receiving angle pushing the clock+anti-clock angle ( with + or - )

Now, the main question is can an update to a Text Widget trigger LUA/dzEvent ?

nicog2 commented 5 years ago

when i connect the cube to the xiaomi gateway, i have to widget on domoticz, one in switch with the action (rotation, shake,...) and another Text widdget in Utility section with the angle of rotation. With this case, when an event from cube in switch, you can read the angle if necessary. cubeutility cubeswitch

pipiche38 commented 5 years ago

If you switch to beta ( 959df90 ), you should be able to see in the Logs the XCube rotation angle. Could you kindly check ?

ben33880 commented 5 years ago

yes i see rotation :

2019-01-29 19:30:58.171 (Zigate) ReadCluster - ClusterId=000c - Magic Cube angle: -51.40000534057617 2019-01-29 19:30:58.171 (Zigate) Update v2 Values 90:'90:' (Xiaomi Cube Lumiere) 2019-01-29 19:30:58.975 (Zigate) ReadCluster - ClusterId=000c - Magic Cube angle: -9.149998664855957 2019-01-29 19:31:02.633 (Zigate) Update v2 Values 40:'40:' (Xiaomi Cube Lumiere)

pipiche38 commented 5 years ago

Sound good. Does it match the Cube rotation ?

I’ll work on creating a Text Widget for each Cube . You’ll have to remove the existing device and re-pair it in order to get the new widgets.

I’ll let you know when available for test on beta.

Kind regards Patrick

On 29 Jan 2019, at 19:33, ben33880 notifications@github.com wrote:

yes i see rotation :

2019-01-29 19:30:58.171 (Zigate) ReadCluster - ClusterId=000c - Magic Cube angle: -51.40000534057617 2019-01-29 19:30:58.171 (Zigate) Update v2 Values 90:'90:' (Xiaomi Cube Lumiere) 2019-01-29 19:30:58.975 (Zigate) ReadCluster - ClusterId=000c - Magic Cube angle: -9.149998664855957 2019-01-29 19:31:02.633 (Zigate) Update v2 Values 40:'40:' (Xiaomi Cube Lumiere)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/sasu-drooz/Domoticz-Zigate/issues/329#issuecomment-458654304, or mute the thread https://github.com/notifications/unsubscribe-auth/AH6FWhN6CNbtASa6hJrXw6hK_5CTsZ_hks5vIJP4gaJpZM4aUqLg.

ben33880 commented 5 years ago

cant say if it match correctly but positive and negative is ok !!! it seems correct for angle.

ben33880 commented 5 years ago

I do not know if it's related to the changes made for the rotation but the flip_90 only works once. you have to make another move for the flip_90 to work again

pipiche38 commented 5 years ago

That is correct. The Cube is not sending a new message after a flip, and I beleive this is true for all. If you do clock rotation, and then you do it once more ... the 2nd one is not seen.

From the LOg I do not see any message from the device itself. It seems the behaviour of the Xcube.

ben33880 commented 5 years ago

with xiaomi gateway, you can flip many times.

pipiche38 commented 5 years ago

could you reach me on keybase.io ?

Smanar commented 5 years ago

Nope, it's not true for all, on my installation it's same. For exemple, if I use the cube to set a speaker volume, I make a clockwise rotation, if the sound is not hight enought, I make a second clockwise rotation more faster. No need to make a "blank" move to enable the rotation again. So I can confirm too, it's possible.

pipiche38 commented 5 years ago

@smanar long time ;-)

Indeed you are right. But then the 2nd , 3rd time you just get the rotation level

If I do 1 flip 90 i see it. If I continue and do one more I don’t see it ! However if after a flip 90 , I do a flip 180 I see it.

On 2 Feb 2019, at 22:29, Smanar notifications@github.com wrote:

Nope it's not true for all, on my installation it's same. For exemple, if I use the cube to set a speaker volume, I make a clockwise rotation, if the sound is not hight enought, I make a second clockwise rotation more faster. No need to make a "blank" move to enable the rotation again.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/sasu-drooz/Domoticz-Zigate/issues/329#issuecomment-460000706, or mute the thread https://github.com/notifications/unsubscribe-auth/AH6FWnf8WKiZaUM8j2EzlJxS17QmucBIks5vJgNQgaJpZM4aUqLg.

pipiche38 commented 5 years ago

@ben33880 please use latest beta version from that morning .

ben33880 commented 5 years ago

we can now flip many times !!!!

pipiche38 commented 5 years ago

Will work on the text widget to get the rotation angle .

Smanar commented 5 years ago

Lol, Hello. I m still here, I m still following this project. I think there is a mistake on my side with rotation and flip. But on all case flip or rotation, you need to trigger notification, and perhaps use the same ResetDevice() fonction than the motion sensor (with smaller temporisation).

pipiche38 commented 5 years ago

The issue was on the fact that we try to avoid Updating domoticz when the value doesn’t change …. ;-)

On 3 Feb 2019, at 11:50, Smanar notifications@github.com wrote:

Lol, Hello. I m still here, I m still following this project. I think there is a mistake on my side with rotation and flip. But on all case flip or rotation, you need to trigger notification, and perhaps use the same ResetDevice() fonction than the motion sensor.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/sasu-drooz/Domoticz-Zigate/issues/329#issuecomment-460041322, or mute the thread https://github.com/notifications/unsubscribe-auth/AH6FWuOAoFHAi2KNr3DMwj9nR_BPUN0Aks5vJr8QgaJpZM4aUqLg.

Smanar commented 5 years ago

Yep, I have just see the corrective > ForceUpdate_ = True

pipiche38 commented 5 years ago

@ben33880 If you can do an update of beta branch. Delete the existing Domoticz widget related to Xcube and repair it you should then see 2 widgets created for the device. The classic one and a text widget (can be found in Utility/Mesures)

For now, Rotation angle are reported to the Text widget .

ben33880 commented 5 years ago

text widget is ok. nice

pipiche38 commented 5 years ago

What do you have in the log

pipiche38 commented 5 years ago

@nicog2 could you confirm that it works as expected ? Please use latest beta branch

pipiche38 commented 5 years ago

Is this still happening?

Envoyé de mon iPhone

Le 3 févr. 2019 à 17:54, ben33880 notifications@github.com a écrit :

i update, i saw new device text and selector. but if i use cube, I can not use other zigbee devices anymore (hue, tradfri). the cube no longer communicates either

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

ben33880 commented 5 years ago

2019-02-04 19:44:02.510 (zig) Update v2 Values 20:'20:' (Cube Lumières) 2019-02-04 19:45:24.319 (zig) Update v2 Values 0:'-65:' (Cube Lumières Angle) 2019-02-04 19:45:24.321 (zig) Update v2 Values 90:'90:' (Cube Lumières)

'Cube Lumières Angle' is the text widget

pipiche38 commented 5 years ago

Can we close the issue ?

ben33880 commented 5 years ago

it works for me !!!

nicog2 commented 5 years ago

I have not the time for testing. But if it works for ben33880, i think it work for me.