Skip to content

Feature request: Option for @state_trigger to only trigger once #89

Closed
@tchef69

Description

@tchef69

I have an automation which turns on/off some exterior lights with a lux-sensor as input.
But the automation gets triggered every time the lux value changes and is above 50.
I have not found an option to make it only trigger once, and then not trig again until after the trigger-statement has been false.

@state_trigger( "int(sensor.lux_outside_the_garage) > 50" )
def automate_exterior_lights_off_in_morning():
    if pyscript.ext_light_off_done == 'off' and input_boolean.exterior_lights_wanted_state == 'on':
        input_boolean.exterior_lights_wanted_state = 'off'
        pyscript.ext_light_off_done = 'on'

One option is of course to add an extra condition , like this:

@state_trigger( "int(sensor.lux_outside_the_garage) > 50 and int(sensor.lux_outside_the_garage.old) <= 50")

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