Ability to store a sensor value but have history be a line graph

so I have tried using the number template in the helper section to calculate the cost of an appliance… this does work great the problem is it gives a field that can be edited. I really don’t want the possibility of editing it by moving the slider by accident or by clicking in the edit field and changing the number. so then I looked at the sensor template. it allows me to change with the value is and it’s not easily editable the problem is it’s now changed from a line graph showing the history to being a sensor history which just tells you the different states at different times. I want to use the graphing integration to show history over time and I can’t do that if it’s a sensor value. is there a way to use the sensor and get a line graph as the history or should I be using a different style of template to get what I’m looking for. I just want to know the cost so basically storing a number and not editable by the user interface you would have to use the developer section to edit it…

Some cards allow the use of the simple-entity type to display input entities in a non-editable fashion.


Regarding the sensor: to get a graph assign a unit of measurement… you can also assign the value monetary for the device class.

Thanks @Didgeridrew this led me to the answer… I changed the “state class” to “measurement” on the sensor template and this is what I was looking for!

Thanks for help pointing me in the right direction!

now second question is there a way to keep long-term history for this template sensor?

also just looking there is no monetary value for device class? and if you meant State class the only thing I have is a total measurement and total increasing

Yes, assigning a unit of measurement and measurement as the state class, which it seems you have now done.

No, I meant device classmonetary is still listed in the docs, but maybe it was left out of the options for helpers…? :man_shrugging: