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

state_trigger stop working after update to 2024.10 #639

Closed
cjlapao opened this issue Oct 4, 2024 · 3 comments
Closed

state_trigger stop working after update to 2024.10 #639

cjlapao opened this issue Oct 4, 2024 · 3 comments

Comments

@cjlapao
Copy link

cjlapao commented Oct 4, 2024

I have a few scripts with the state trigger that stopped working once I updated to 2024.10.

These were working before. the time_trigger does work as expected.

example of the state_trigger

@state_trigger("light.hallway_light_1.*")
def test1(**args):
  log.info(f"light changed {args}")

@state_trigger("binary_sensor.hallway_motion_sensor_occupancy")
def motion_state_changed(**args):
    log.info("something is present")
    context = args["context"]
    if hallway.enable_debug():
        log.debug(
            f"[{hallway.name()}] Presence sensor binary_sensor.hallway_motion_sensor_occupancy was triggered with state {args['value']} from {context.parent_id}"
        )
    ceiling_light_flow()
@ALERTua
Copy link
Contributor

ALERTua commented Oct 4, 2024

I haven't used @state_trigger("light.hallway_light_1.*") with the asterisk, it does not work for me now, but I don't know whether it worked before.
@state_trigger("binary_sensor.hallway_motion_sensor_occupancy") works OK for me while I'm on 2024.10.0
None of my triggers failed after the update to 2024.10.0

@cjlapao
Copy link
Author

cjlapao commented Oct 4, 2024

@ALERTua Thanks for checking.

Something is wrong with my pyscript then, tried also for the light without the *, tried adding test state changes to buttons and all of them are not working.

I cannot see any error.

I have tried to remove/reinstall pyscript
Reboted the home assistant
And still have the same issue

@cjlapao
Copy link
Author

cjlapao commented Oct 5, 2024

Found the issue.

So for other people that might struggle with this. I had a trigger that was part of a factory, these had some init to get the entity state. on start these entities might not be available so the state.getattr() or state.get() returns none. I was not checking this and the pyscript would not load the trigger.

All sorted out

@cjlapao cjlapao closed this as completed Oct 5, 2024
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

2 participants