Skip to content

state_trigger firing although value and old_value are the same. #73

Closed
@kmorris81

Description

@kmorris81

This state_trigger keeps tripping even though the actual state doesn't appear to have changed. I will be at home and regularly/randomly get notifications on my phone from this function:

@state_trigger("device_tracker.my_iphone == 'home'")
def someone_arrived(**kwargs):
    log.info(f"Someone arrived, disarming system: {kwargs}")
    alarm_control_panel.alarm_disarm(entity_id="alarm_control_panel.ha_alarm")
    notify.mobile_app_my_iphone(title="Status", message="Someone arrived, disarming system.")

The logging above provides this output:

INFO (MainThread) [custom_components.pyscript.file.example.someone_arrived] Someone arrived, disarming system: {'trigger_type': 'state', 'var_name': 'device_tracker.my_iphone', 'value': 'home', 'old_value': 'home', 'context': Context(user_id=None, parent_id=None, id='xxxxxxxxxxxxxxxxxx')}

As you can see, both value and old_value are home; so I'm not sure exactly why this is happening.

My interim-fix is to manually check value and old_value inside the function and return if they are equal.

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