Helper Entity with negative value

Hi,

I recently build a second Photovoltaik for my house and added this to my existing System. Due to the external integration the value of the entity for the additional energy is shown negative in Home-assistant. My idea is to create a helper entity and just put a “minus” to this and add it to the existing one.

However I did not find any possibility to do this. Any idea how to create this?

Thanks S

Set up a Template sensor (under Helpers), with the template:

{{ -(states('sensor.YOUR_SENSOR')|float(0)) }}

Hi,

thank you very much. It worked and I could create the helper. Hoewever it’s not possible to add this to the Energy section. See screenshot. It simply does not appear here.

Any idea?

Thanks S

You probably need to set the state_class then. Set it to the same as the working sensor.

1 Like

Thanks a lot. I found this about state_class:

But how do I get and set this? I could not find in the docs.

Thanks for help and support.

S

Zustandsklasse. It’s in your first screenshot above.

Thank you very much - with the new state class in the helper entity I could now find and add it in the energy section. :slight_smile: Thank you.

Just for interest: Is it possible to also change the state of an existing entity? I could only find it in the helper entity i created but not in other entities that are already existing

Thanks S

I don’t think you can change state_class for existing entities, unless you defined them in YAML or the UI in the first place. You can change some things:

1 Like