stephan192 / hoermann_door

Control Hörmann doors directly via MQTT
MIT License
109 stars 16 forks source link

Toggle lights #4

Closed snoekieboe closed 3 years ago

snoekieboe commented 3 years ago

Hi Stephan, First of all thanks for all your nice work. I've managed to get my hand on a PCB made according to your design and it is working like charm.

I've noticed the presence of a toggle light option in the Pic16 code and was wondering if it is already possible to use this feature through MQTT... could not verify this to be true whilst looking through the esp8266 code.

Thanks in advance !

stephan192 commented 3 years ago

Hi snoekieboe, as i analyzed the bus i found out that one bit toggles the light, so i implemented it in the pic16 software to document it. But i didn't find a meaningful usecase for this feature so i didn't add it to the esp software.

If you need it you can easily activate it by adding the following lines after line 241 to esp8266.ino

if (message == "TOGGLE_LIGHT")
{
  door.trigger_action(hoermann_action_toggle_light);
}

And publish a message with payload TOGGLE_LIGHT to your SET_TOPIC.

snoekieboe commented 3 years ago

Thnx Stephan! I will add the code and see if it works. Keep you posted!

stephan192 commented 3 years ago

I've added the feature but do not recommed to use it due to a missing feedback.

i5Js commented 3 years ago

It's working; sending the payload(on/off) "LIGHT" turn on and off the light, but in HA, I don't know how to do correctly a switch like "Venting". I think It's because the value is always LIGHT.

stephan192 commented 3 years ago

You must configure your switch to work in optimistic mode (don't define a state_topic) and that's exactly the thing why i don't recommend using toogle light.

stephan192 commented 3 years ago

The complete solution would be:

  1. Verify which bit of the broadcast status message is the light relais
  2. Add an interface function to hoermann.cpp
  3. Convert the cover position topic to a json message to be able to add more than one value
  4. Adjust the configuration.yaml or additionally add MQTT Discovery

But i will not do this, at least in short term. Feel free to make a pull request.