question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature Request: cleaner @state_trigger('True or ... ')

See original GitHub issue

This 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:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
craigbarrattcommented, Oct 16, 2020

Ok, that’s two votes for

@state_trigger(my_list_of_entities)

so let me look at doing that. I was also thinking about using a list of strings for multiple expressions, that are ored 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 ored together.

0reactions
dlashuacommented, Oct 17, 2020

I tested @state_trigger() and task.wait_until() with lists, strings, combinations of lists and strings, as well as the old “True or …” functionality. Everything worked as expected.

THANKS!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found