Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: exclude from recorder #577

Open
leo-b opened this issue Jan 25, 2024 · 0 comments
Open

Feature Request: exclude from recorder #577

leo-b opened this issue Jan 25, 2024 · 0 comments

Comments

@leo-b
Copy link

leo-b commented Jan 25, 2024

Hi!

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')
def mydouble_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')
def mydouble_on_attr_change():
    # attribute data contains only auxiliary data
    # that souldn't be recorded
    try:
        data = [ d.copy() for d in sensor.mysensor.data ]
        for elem in data:
            elem['price'] *= 2
    except Exception as e:
        data = None
    pyscript.sensor_mydouble.data = data

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant