Pyscript is a new integration that allows you to write Python functions and scripts that can implement a wide range of automation, logic and triggers in a very simple manner. State variables are bound to Python variables, and services are callable as Python functions, so it’s easy and concise to implement logic.
Functions you write can be configured to be called as a service or run upon time, state-change or event triggers. Functions can also call any HASS service, fire events and set state variables. Functions can sleep or wait for additional changes in state variables or events, without slowing or affecting other operations. You can think of these functions as small apps that run in parallel, independently of each other, and they could be active for extended periods of time.
Pyscript is available as a HACS custom component. To install, go to HACS -> Integrations, click on “+” to search for Pyscript, and install. See the repository for the documentation.
I’d appreciate any feedback or suggestions to improve it.