Thanks for your reaction. This is one of the things I tried to fix the problem. I only forgot to set it back to the original. I did that now and it is still not working.
Looking at your template code it seems right, mine looks like below:
- use_blueprint:
path: marcelhoogantink/correct_envoy_livetime_production_energy.yaml
input:
# entity-id of original sensor to be corrected
envoy_entity: sensor.envoy_122302045041_lifetime_energy_production
# uptime in seconds
uptime: sensor.ha_uptime
# uom for target
uom: Wh
# friendly name of the new sensor for correction
name: Envoy 122302045041 lifetime energy production corrected
# unique_id of the new sensor for correction
unique_id: envoy_122302045041_lifetime_energy_production_corrected
- use_blueprint:
path: catsmanac/adjust_envoy_livetime_production_energy.yaml
input:
# entity-id of original sensor to be corrected
envoy_entity: sensor.envoy_122302045041_lifetime_energy_production
# uptime in seconds
uptime: sensor.ha_uptime
# uom for target
uom: Wh
# friendly name of the new sensor for correction
name: Envoy 122302045041 lifetime energy production adjusted
# unique_id of the new sensor for correction
unique_id: envoy_122302045041_lifetime_energy_production_adjusted
Are there errors in the home-assistant.log file and if so which?
If you search for this disallowedextrapropwarning I see in your editor, then you get some references to changed template formats. Check these out if there's any format issues with your configuration.yaml and template.yaml.
I found online that the "Home Assistant Config Helper" extension is not working properly and generating this error without a good reason. The advise was to disable it. So I did that.
I also saw that you are using Wh in your last example and in the blueprint instructions (and in my template) MWh was used. I changed mine to Wh.
After this the templates where working. So I re-enabled "Home Assistant Config Helper" and is still worked. Then I changed the uom to MWh again and now the template value changed from 7898495 to 7898495000000. So I think this is the thing that might be what caused the original issue.
Did some more testing and it seems like it is not specifically changing the uom input that "kickstarts" the template. Changing any of the other inputs also works. So I created a new template, which started off with the unknown state again. Then I changed the "envoy_entity" to a random sensor and the template got a value, after changing it back to the envoy lifetime sensor it worked.
I did also find out that the "uom" is not working like it should, changing that in the yaml editor or in the UI will result in weird values that are a 1000 or a 10000000 off from what it should be. For example changing 9.000.000 Wh to kWh will result in 9.000.000 kWh and when I changed it back to Wh it went to 9.000.000.000 Wh. Probably not touching it is the best thing to do for now
The UOM is used to scale the value of the source sensor to what is specified in UOM. It uses the UOM of the original entity and scales it to kWh. It then scales that value to the target UOM. The method only recognizes Wh, kWh and MWh in the process.
Results might be off when changing after initial start.
When newly created it will be in state unknown, until the source entity changes value, as that is the trigger for it to calculate.