Open dermotos opened 3 months ago
I made a PR for this #626 Hope you find it useful
Great request, i'm also not an IT expert, so relying on examples.... e.g. how to convert this automation to pyscript ? alias: KuisRobot kuisen bij weg van Huis description: "" triggers:
@SnokxStefan I too learn best from examples and hope to contribute some to the documentation now that I'm understanding how things work. When porting from YAML to Python, you'll have to re-think some approaches as there's not always a way to port 1:1, and of course there's multiple ways to do things. A good foundational knowledge of Python is also very helpful. Happy coding!
@state_trigger("device_tracker.smartphone")
def your_function_name(old_value=None):
if old_value == "home":
vacuum.start(entity_id="456", type="clean", mode="single")
I'm loving Pyscript for my automations in HA. For any developer, it's the way to write home automations as far as I'm concerned, espicially compared to the HA UI, of the yaml automation approach.
However, I find the documentation very lacking. It really needs some example code. Take the
@state_active
decorator. From the couple of short paragraphs describing this, I can't really figure out how I use it, or why I would use it over a@state_trigger
.Are there any plans to improve the documentation and add some example code to things like this?