Replies: 1 comment 2 replies
-
check the wiki. there are examples that should help. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
My aim is to use the numerical state of a couple of HA entities, use pyscript to do some mildly complicated geometrical calculations on these states using numpy etc and produce a numerical output as a state of some entity. I would then use this value to automate things inside HA. Writing this in jinja2 as a template sensor is in principle possible, but would produce horrible code I'd never debug.
Is such a thing possible? Or would i need to bring all my automations which would be triggered on the value of this sensor into the pyscript script and have that run on some time-trigger? Or am I completely misunderstanding how this works?
To be concrete, imagine that I wanted to take the current states of a bunch of temperature sensors within HA and find the average temperature as a functions in pyscript and have it output as a sensor. This average temp sensor would be a drop-in replacement for the various triggers I have defined in the automations already based on the individual sensors. In reality it's more complicated, but this would be a good starting point.
Beta Was this translation helpful? Give feedback.
All reactions