Hello all
I am in the process of creating helpers for a lot of my Entities.
The basic idea is that I have a stable entity (the helper) for some kind of data, regardless if the data the helper gets the data from changes in the future.
For example:
I have a zigbee template sensor in the garden shed. This is an entity that is added via mqtt. Now it is very probable that I will replace that sensor with another one within the next 1-2 years. This would lead to a data loss of the old data when I use a new sensor. So I will create a helper “temperature-shed” and for now, use the entity from mqtt to fill its value and when I replace the sensor, just adjust the “temperatur-shed” helper to the new sensor entity.
Same goes for a lot of other things like energy monitoring, where the devices change often.
So my question is: What helper type should I use?
Template which is not as easy to create but provides a lot of freedom
Group helper which is easy to use (just select the single entity I need)
Min/Max helper
Any other?
Many thanks for your tips regarding this. My goal is to have a set of stable sensors which can keep all data even when I replace the hardware that provides the value.
But let’s say I would use “sensor.temperature-shed” as entitiy-id for the current sensor. If I then add a new one, it needs to be named differently as the other id is already used. could I just rename the old one and then also rename the new one? Does this keep the history and statistics data?
It keeps the history connected to the entity id.
If you change the entity id, then it is. New sensor with a new history.
If you change it back, then it is the old sensor again and it continues the history.
Thanks for the link. Seems like this topic is a rabbit hole. There are up/downsides for different approates or the “alias” idea. I personally think the most flexible approach would be to use template helpers. This would allow to cover pretty much every scenario. Even for example a scenario where a new “device” would not expose the temperature as an entity but as an attribute and such things.
What you want to do is a lot more work, but I won’t/can’t stop you from doing that.
What’s suggested is quite simple: Use entity IDs, not device IDs. Name entities appropriately (this is your stable entity now). When you replace a device, remove the old entities and rename the new ones to the old names.