openhab / openhab-addons

Add-ons for openHAB
https://www.openhab.org/
Eclipse Public License 2.0
1.88k stars 3.59k forks source link

[Somfy Tahoma] The state of sunshade is not synced when wind sensor opens it #17305

Open maisun opened 2 months ago

maisun commented 2 months ago

Hi, I'd like to report a bug with Somfy Tahoma Binding, I use it for the sunshade in my living room. Together with the sunshade I installed a wind sensor, which can open the shade in case it becomes windy. I think the wind sensor talks directly to the sunshade as I cannot find a way to add the wind sensor in Tahoma app. Anyways I made some automation rules to open/close sunshade based on weather conditions: for example when sunny close the sunshade, when cloudy open the sunshade, simple stuff. Today I noticed the following: 1) My automation detects it's sunny and close the sunshade 2) After a while the wind sensor detects wind and open the sunshade. 3) In OpenHAB it still thinks the sunshade is closed even after more than an hour 4) If I now ask OpenHAB to open the sunshade, it changes state from 100 -> 0 but no action is triggered. I have observed both in Tahoma app and HomeKit the sunshade is marked open when the wind sensor opens it. So for some reason. the binding doesn't seem to know the sunshade is already opened (triggered by wind sensor). This gives massive problem for automation as I don't know the state of sunshade anymore.

Expected Behavior

The state of sunshade in OpenHAB should always be synchronised with the actual state of the device.

Current Behavior

Currently the state is synchronised unless the wind sensor decides to open the sunshade, in which case the binding still thinks the blind is closed despite that it was open.

Possible Solution

Can't see any workaround

Steps to Reproduce (for Bugs)

1) My automation detects it's sunny and close the sunshade 2) After a while the wind sensor detects wind and open the sunshade. 3) In OpenHAB it still thinks the sunshade is closed even after more than an hour 4) If I now ask OpenHAB to open the sunshade, it changes state from 100 -> 0 but no action is triggered.

Context

In automation rules, I'd like to check the state of the blind and make decisions - for example when it's open, do this, when it's closed do that. If the state is not in sync I cannot run those automations reliably.

Your Environment

octa22 commented 16 hours ago

Hello, could you please provide me with the trace log from the wind sensor event that triggers the sunshade to open? Most probably it changes the state to some different one from "Open" and the binding does not know it yet. I can't reproduce it in my installation, because I do not have a wind sensor. thanks. Ondrej

maisun commented 16 hours ago

Hello, could you please provide me with the trace log from the wind sensor event that triggers the sunshade to open? Most probably it changes the state to some different one from "Open" and the binding does not know it yet. I can't reproduce it in my installation, because I do not have a wind sensor. thanks. Ondrej

Hi Ondrej,

Thank you for looking into it! The wind sensor is not connected to OpenHAB, in face I believe it uses some internal unpublished protocol to communicate with the blind. The issue here is when the blind is opened by wind sensor, the state of the blind is unchanged in OpenHAB. I don't know if it's because the trigger of action is not sent to OpenHAB, but in HomeKit and Somfy the state of the blind changes immediately when it's opened. Also to add: if I manually open the blind in Somfy app or HomeKit, the state is also changed in OpenHAB. So there must be some subtle difference when the blind changes state by the wind sensor

octa22 commented 16 hours ago

I understand, there is no need to have the sensor connected to Tahoma, I just need to see the correct state of the blind closure when this event occurs. Most probably it sends a different closure state instead of expected Open/Closed, for instance something like "Forced Open", that is ignored so far...

maisun commented 16 hours ago

I understand, there is no need to have the sensor connected to Tahoma, I just need to see the correct state of the blind closure when this event occurs. Most probably it sends a different closure state instead of expected Open/Closed, for instance something like "Forced Open", that is ignored so far...

OK, I'm not very strong technically, how can I find what value it sends? In my case it's the wind sensor that triggers "Open" (instead of "Close").

octa22 commented 15 hours ago

The simplest way might be 1) enable the trace log for the tahoma binding (ssh into OH2 console and use log:set trace org.openhab.binding.somfytahoma command) 2) pause the Tahoma bridge in the OH UI for several seconds (disable) 3) enable the bridge again

search for the JSON response of /enduser-mobile-web/1/enduserAPI/setup call in the log. It should contain the actual state of your Somfy devices.

octa22 commented 15 hours ago

Or you can 1) login into classic.tahomalink.com portal using your browser with developer tools enabled (F12) 2) provide me with the setup call JSON response in the Network tab

octa22 commented 15 hours ago

in both cases it is necessary to let the sensor trigger the event to open the blind, otherwise the blind will have the corresponding state (Open/Closed)