Skip to content

Feature Request: state_check_now kwarg for state_trigger #65

Closed
@dlashua

Description

@dlashua

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions