Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: state_check_now kwarg for state_trigger #65

Closed
dlashua opened this issue Oct 30, 2020 · 0 comments
Closed

Feature Request: state_check_now kwarg for state_trigger #65

dlashua opened this issue Oct 30, 2020 · 0 comments

Comments

@dlashua
Copy link
Contributor

dlashua commented Oct 30, 2020

I use this pattern often:

@state_trigger((
    "float(sensor.master_temperature) <= float(climate.hvac_up.temperature)"
    " and input_select.master_mode == 'sleep'"
))
def turn_on_heater():
    log.info('Turning on Heater')
    switch.turn_on(entity_id="switch.master_heater")

The issue is, I'd also like that same check to be performed at startup (i.e. when the trigger is registered). I can't just use @time_trigger('startup') because the conditions in the state_trigger won't be checked. I can't just change @state_trigger to @state_active because then it'll ONLY trigger at startup. So, instead, to accomplish what I want, I have to have a state_trigger, a time_trigger, and a state_active.

Adding state_check_now to @state_trigger would allow me to keep the code short and reduce redundancy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant