nfarina / homebridge-dummy

Dummy switches for Homebridge: https://github.com/nfarina/homebridge
277 stars 83 forks source link

Feature request : Auto switch On / Off #92

Open Barichon21 opened 3 weeks ago

Barichon21 commented 3 weeks ago

Hello,

Firstable thanks for the amazing job. This plugin to unlock a lot of use-case without the need to use Home Assistant. As you are probably aware, Homekit has a very weird interpretation of "triggers".

The issue:

For example an automation will only work if the trigger is crossed (i.e IF humidity sensor is > 60 % Then switch on dehumidifier). In that case if for any reason the automations is started when humidity is above 60 degree then it will never be evaluated.

To overcome this issue you need to manually force humidifier so that 60% value is crossed. That's how it works... Weird implementation and huge impact on automation usability.

The solution

Thanks to your dummy plugin, we can force the automation to run so that even if the humidity is above 60% when automation si activated, current humidity is evaluated.

This is done thanks to with :

  1. A On / Off dummy-switch. Using this, it will allow any activated automation to be evaluated every time the dummy-switch state changes.
  2. and an automation that put dummy-switch back On if state is Off.

So we get:

IF dummy-switch is "On" (auto-off after 1 sec) AND humidity is above 60% THEN turn dehumidifier On. HomeKit automation detects state is Off and put it back to On.

It works very well !

However, since automation does not self-evaluate, the very first run will not work. As a consequence, the dummy switch state is not evaluated, so automation does not start.

The feature request

Regards,

Romain