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 on DOMAIN.name.attr gets old_value from name not attr #641

Closed
dy-nz opened this issue Oct 9, 2024 · 2 comments
Closed

state trigger on DOMAIN.name.attr gets old_value from name not attr #641

dy-nz opened this issue Oct 9, 2024 · 2 comments

Comments

@dy-nz
Copy link

dy-nz commented Oct 9, 2024

Hi.
Love pyscript - best thing that happened to HA.
But I have bumped into a small but problematic bug.

@state_trigger("media_player.chromecast.app_name")
def test(trigger_type=None, var_name=None, value=None, old_value=None):
etc, etc...

The state_trigger correctly triggers, but old_value is set to the old value of media_player.chromecast (example "off") when it should be set to the old value of media_player.chromecast.app_name (example "Spotify")

Thanks,
David

@craigbarratt
Copy link
Member

Please try old_value.app_name inside the function. The value and old_value are always set to the variable value (including attributes), even if you trigger off an attribute.

@dy-nz
Copy link
Author

dy-nz commented Oct 10, 2024

Thanks.

@dy-nz dy-nz closed this as completed Oct 10, 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