Closed RDols closed 1 year ago
Note, there are a few more 'True' with i think in wrong casing.
I don't think Because in python bolean are not fully lower case, It 's True and False
a = (5 == 5)
print(a)
Result
True
In deconz boolean are lower case, so they are lower in the json too, but when the python core use them the case is changing.
You can try a print (val)
to be sure.
Yup you are absolutly right. I assumed the string was directly from json. But actually it's string representation of the a python boolean.
But the reason i looking is because my ikea blinds don't give (correct) updates, see them in the websocket events. But it updates wrong. Still debugging, but i think is because the response has multiple values.
On the websocket i find this as position update:
{'e': 'changed', 'id': '18', 'r': 'lights', 'state': {'bri': 226, 'lift': 89, 'on': True, 'open': True, 'reachable': True}, 't': 'event', 'uniqueid': '00:0d:6f:ff:fe:aa:48:4b-01'}
The final kwarg is:
{'nValue': 1, 'sValue': 'Open'}
It appears ProcessAllState will handle the next values, in the this particular order: 'on' 'bri' 'open'
Looking at deconz api 'bri' is deprecated and 'lift' should be used. My suggeston would be to move the if 'bri' down in the if structure and also add a if 'lift'.
I'm still debugging, so maybe i missed something and could be wrong....
I'm testing the above commits....
But I don't understand the problem
The final kwarg is: {'nValue': 1, 'sValue': 'Open'}
And it s not good ? If lift = 89, it mean the VR is open, nope ?
If you look at if fully binary, yes. But I set it up as switch type "Blinds Percentage". Which give you a range for 0%-100% to read and set the blind. Open translates to 0% and Closed to 100%. Otherway 100% translates to closed and < 100% translates to open.
If i set my blinds to e.g. 50%, it says it's fully open instead of halfway.
The domoticz phython api says for reporting blinds: Closed: nValue = 1 and sValue = 100 partially opened: nValue = 2 and sValue = 1-99 Open: nValue = 0 and sValue = 0
The lift value of deconz: Supported range is 0–100 or special value "stop". lift is best understood as “percentage closed”. So for any lift value below 100 %, open is true. 0–99 — open is true 100 — open is false "stop" — Stops the lift action
I your example I would like to report to Domoticz it's opened 89% instead it's open. Then it is correctly displayed.
ATM the pthon code use
if command == 'bri':
#kwarg['nValue'] = 1
val = int(int(val) * 100 / 255 )
if model == 'Window covering device':
if val < 2:
kwarg['sValue'] = '0'
kwarg['nValue'] = 0
elif val > 99:
kwarg['sValue'] = '100'
kwarg['nValue'] = 1
else:
kwarg['sValue'] = str(val)
kwarg['nValue'] = 17
else:
kwarg['sValue'] = str(val)
So if lift = 89 (or bri = 226) you will have partially opened no ? With nValue = 17 and sValue = 89 In your exemple you have used 2 and me 17, I don't remember what is the difference.
Edit: I think I have found the problem, it s "open" used for other device Try to put "open" before "bri"
@RDols So it s still not better with that ?
@Smanar I missed you edit. but thats correct, it handles "open" after "bri" so it overwrites values found with "bri". In my commit 22493f1 is changed the order, and also added handling of "lift".
To be honnest, the nValue 17 i don't know what is does, according the manual it should be 2, so i changed it blindly. My deconz has "lift" so this handler will be overwritten anyway.
I don't remember, from my memory, it was from the icon displayed on the widget. I have used different value up to find a good one, and "2" was not the better, I was searching an icon with a semi-closed covering (or perhaps a "stop" icon) It's possible it have changed now, if you don't see difference with 17 or 2 ?
But the changes in my second commit 2e79be4 unfortianatly don't sove the problem
What is your second issue ? You can use only "lift" or "bri" in the request "on" and "open" are not mandatory. You set for exemple 90% and the covering stop before 90% after 1/2 s ? How are you setting the value ? If you enable log, you can see if it's from deconz or domoticz. Can come from the device too, because I realy don't have return with this kind of problem for covering.
Second issue is when i open the blind, it sometimes stops after short time. Most of the time it works. It's set from dzVents scripts, with just the open command. I'm not sure where it comes from. domoticz, dzVents scripts, plugin or deCONZ itself. Every time it sit down to dive into this it works, when just want to use it, it stops, typically an Heisenbug...
Having a different nValue should not give a different icon, but could influance the status text. I will check in code what it does. I didn't test what the difference values result to.
Setting nValue to 17 (gswitch_sStop) will display "Stop" or "Stopped" as status TEXT. Setting nValue to 2 (gswitch_sSetLevel) set the status text "Set Level: %d %%", or "Open" What is displayed is depending on the switch type.
This make some sense when using "Venetian Blinds" as switch type and using the default configuration of deCONZ. Then it will update not that often, and you can see the blinds have stopped somewhere halfway, instead
But I also think it's better to use "Blinds Percentage" type for (Ikea) blinds. You can actual see how far the blinds are closed. Together with the right settings withing deCONZ you can also see the blind opening/closing at the sensor status.
For future reference, how do i configure deCONZ and blinds so they update when moving:
If this doesn't work immediatly, disconnect the battery of the blind for 10 seconds. It took me a few attemps to get it working for all blinds....
Ha yes was for that, I don't remember all the story, but it was asked to have visualy the 3 states : open / close / stop. With this mode you have the 3 states, but not the level ? But seriously I can't say what is the better one ....
Second issue is when i open the blind, it sometimes stops after short time
Try with enabling log, you will be able to see all requests made by domoticz. But if you are using Dzevent few chance it was from domoticz, and can come from the device too.
@RDols Hello, somes news about your issue ? Do you want to make a PR to change the order for "open" ? or do you want I make it ?
For the nValue, idk what is better, long time ago, somes users have asked for "stop" icon.
Setting nValue to 2 (gswitch_sSetLevel) set the status text "Set Level: %d %%", or "Open"
there is not the slide bar to see the level status ?
@Smanar I finally had some time to sit down to find the problem with the blinds topping. Problem is not in the plugin, but in domoticz zwave. I have a ZRC90 switch, with a long press is open the curtains, but for some reason it sends this notification more than once, making the curtain stop.
For the change of order and nValue i will create a pull request. I strongly suggest for users to use the "Blinds Percentage" type for the curtains. Also tweak the settings according my comment above (https://github.com/Smanar/Domoticz-deCONZ/issues/112#issuecomment-951268071)
Thx, have put a comment about the branch. Most of covering support only on/off not the Percentage, and there is no way to detect if the device can support them using the actual JSON, I think it will be possible later, with the next deconz feature, the DDF file, we will have a config file by device, so will be possible to remove bri/lift if the device don't use them, and the plugin will be able to create a different widget.
Moved the PR to the beta branch. Will try if i can find a way to get the "stopped" back for these cases.
I think in fonctions.py line 448 the next line should be changed:
if val == 'True':
toif val == 'true':
as for a i known, boolean string are always fully lower case, at least in my deconz.
If you want i can change it and create an pull request, but will take a few days
Regards, Richard