danobot / entity-controller

Home Assistant Entity and lighting controller for managing devices with timers, scripts, and sun-based time restrictions.
https://danobot.github.io/ec-docs/
GNU General Public License v3.0
294 stars 40 forks source link

Feature: Conditions or enable/disable option #306

Closed spudje closed 1 week ago

spudje commented 1 year ago

Wow, this looks like a really cool addon! I can think of many uses in my setup. However, while the time constraints seem very usefull, it feels a bit cumbersome to enter them for all EC instances. So either being able to only run when a more generic condition is met, or a way to enable/disable the EC via a service would be awesome. So I can e.g. enable/disable it when my Hass setup is in Home/Away or in Day/Night mode.

dominicusmento commented 1 year ago

you should create template binary sensors and achieve this by tweaking your configuration.. for example.. this one will calculate if (sun is up and illuminance >30) or light is already on it is used for another purpose by me but you should get an idea.. templates can be easily tested in HA developer tools you can then also use dummy switches (input_booleans) defined in your config just to trigger only one part of condition.. https://www.home-assistant.io/integrations/template/ https://www.home-assistant.io/integrations/input_boolean/

- platform: template
  sensors:
    hallway_blocker:
      friendly_name: "Hallway Light Blocker"
      value_template: >-
        {{ (states.sun.sun.attributes.elevation|float > 5 and state_attr('sensor.hallway_light_motion_sensor_1_illuminance_lux', 'illuminance')|int > 30) or is_state('light.hallway_light', 'on') }}