Feature Request: cleaner @state_trigger('True or ... ')
See original GitHub issueThis syntax is a bit hacky looking and hard for new users to follow:
@state_trigger('True or binary_sensor.dark')
There’s no reason to make the above syntax NOT work, but think a convenience decorator for this use pattern might be beneficial. Something like this:
@state_change_trigger('binary_sensor.dark')
@state_change_trigger([
'binary_sensor.dark',
'binary_sensor.motion'
])
Though, naming things is hard. There’s probably something better than state_change_trigger
.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Feature Request: use state_trigger with a passed function #43
It would be cleaner if I could do this: class FollowMe: def __init__(self, config): pyscript.state_trigger(f'True or ...
Read more >Automation Trigger - Home Assistant
When any of the automation's triggers becomes true (trigger fires), Home Assistant will validate the conditions, if any, and call the action.
Read more >Feature Requests: What are they and how to manage them
Feature requests are a form of product feedback you may frequently encounter as a SaaS product manager. They typically come in the form...
Read more >Feature Request Template: How to Manage Suggestions at ...
Streamline and organize user feedback with this free feature request template. Available in Google Docs and Sheets (no email required).
Read more >Help forum and feature requests - Looker Studio Help
Request new features using the Looker Studio issue tracker. To "vote" on an existing feature request, click the "star" icon.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Ok, that’s two votes for
so let me look at doing that. I was also thinking about using a list of strings for multiple expressions, that are
or
ed together (ie, anyone being true will trigger the function).It would be possible to make both forms work. A single string argument state variable (ie, no expression and no list) could be detected and treated as trigger on any change. And a list of strings, each of which could be an expression or a state variable name meaning any change, would be logically
or
ed together.I tested
@state_trigger()
andtask.wait_until()
with lists, strings, combinations of lists and strings, as well as the old “True or …” functionality. Everything worked as expected.THANKS!