galagaking / espaxa

ESP Module for controlling AXA Remote2.0
Creative Commons Zero v1.0 Universal
20 stars 8 forks source link

Home Assistant Open / Close state #2

Closed WouterKr closed 3 years ago

WouterKr commented 3 years ago

Hi,

Great solution and based on this I made two modules which are working nicely, thank you!

One thing I noticed is that the state changes even when the window is not opened or closed. I think it is because only the closed state is set when it is returned from the Axa and all other states are supposed to be open. When the state is used as a trigger this will result in a unwanted trigger. I do not know whether the changes I made are the correct ones but they seem to work.

I added:

  `#define AXA_OPEN 210   // 210 Unlocked`

and:

 `if (axa_status==AXA_OPEN)                                                                                  
  {
    axa_window->publish_state(COVER_OPEN);  // Only 210 will return OPEN
  }`

What I see now is that the state only changes when the window is really closed or opened.

galagaking commented 3 years ago

Hi, Thank you for your feedback! The code is written to give a state update every 30 (30000 millis) seconds. Even when you use the remote control, this will work. The mentioned behaviour I can not reproduce in my setup (as seen in my ESP LOG file):

[21:23:45][D][sensor:092]: 'Axa Window': Sending state 1.00000  with 0 decimals of accuracy
[21:24:15][D][espaxa:056]: 210 UnLocked-> 210
[21:24:15][D][sensor:092]: 'Axa Window': Sending state 1.00000  with 0 decimals of accuracy
[21:24:45][D][espaxa:056]: 210 UnLocked-> 210
[21:24:45][D][sensor:092]: 'Axa Window': Sending state 1.00000  with 0 decimals of accuracy
[21:25:15][D][espaxa:056]: 210 UnLocked-> 210
[21:25:16][D][sensor:092]: 'Axa Window': Sending state 1.00000  with 0 decimals of accuracy

It is possible to change the code so only a 'change in state' would be transmitted, but as I use no triggers on this state, this would not add functionality for me. But may be it can be useful for others.

WouterKr commented 3 years ago

Hi,

the 30 seconds state transmit is working like in your log and is working fiine. I do not have a log that long but it seems there are more (other) states transmitted then 210 when the window is closed looking at the state changes on the device in HA when the window is closed:

 ` else
  {
    axa_window->publish_state(COVER_OPEN);  // if not AXA_CLOSED the window is supposed to be open
  }`

If that is the case then the state of the window is changed to open even if it is closed. Transmitting only a state change reduces the amount of transmits but not the state itself.

But like you said, if you do not use the state for a trigger (using this to turn off the radiator I my case) this is a none issue ;-)

galagaking commented 3 years ago

Hi, I have looked at the logging for a longer period. Occasionally a '502 Command not implemented' error is sent by the AXA (some communication glitch). In that case a state change would be published if the window was open. So indeed an error. I have commited a new version with your suggestion (with credits :-) ). Cheers!

WouterKr commented 3 years ago

Thanks for the new version; still working really nice.