You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using pyscript for an equivalent of 'state based template entities'.
state.persist('pyscript.sensor_mydouble')
# "template sensor that doubles the original value"@state_trigger('sensor.mysensor')defmydouble_on_value_change():
pyscript.sensor_mydouble=2*sensor.mysensor
I also need to take some temporary attributes from the original entity that are only used for calculations:
@state_trigger('sensor.mysensor.data')defmydouble_on_attr_change():
# attribute data contains only auxiliary data# that souldn't be recordedtry:
data= [ d.copy() fordinsensor.mysensor.data ]
forelemindata:
elem['price'] *=2exceptExceptionase:
data=Nonepyscript.sensor_mydouble.data=data
Hi!
I am using pyscript for an equivalent of 'state based template entities'.
I also need to take some temporary attributes from the original entity that are only used for calculations:
Those attributes shouldn't be archived in recorder history:
https://developers.home-assistant.io/docs/core/entity/#excluding-state-attributes-from-recorder-history
It would be nice if pyscript would support that.
Cheers,
--leo
The text was updated successfully, but these errors were encountered: