Hello,
I got the same problem as many people here which was forcing the update of a sensor.
For those that do not know why we would do this, it is a very valid scenario where you want to calculate your current power draw from the grid with only a sensor that is giving you an index in kWh (every 1 minute for example) and from this index you calculate the derivative to get the instant power draw.
So far so good, this works well.
But then you have solar panels and when the sun shines, you do not consume power from the grid anymore and then the annoying situation happens.
In this situation, because there is no update anymore on the consumption index, the derivative isn’t recalculated and sticks to its last value (for example 500W). That’s why I need an update of this index to have a derivative equal to 0.
Now that the situation is set, what I had working in 2024 was this :
- trigger:
# work around 'source' sensor for the derive integrations
- trigger: time_pattern
minutes: "/1"
- trigger: state
entity_id:
- sensor.zlinky_east
not_to:
- "unknown"
- "unavailable"
sensor:
- unique_id: conso_totale_maj_forcee
name: "Conso totale maj forcee"
availability: "{{ has_value('sensor.zlinky_east') }}"
state: "{{ states('sensor.zlinky_east') | float(3) }}"
attributes:
dummy: "{{ now().minute }}"
unit_of_measurement: kWh
device_class: energy
I saw this trick somewhere on the forum where you create a new sensor based on the original one where you force the update thanks to an update on its state every minute (and then you calculate the derivative on this new sensor).
Sadly this doesn’t seem to work anymore since some month. So what is now the new way of doing this, if there is any ?
Thanks in advance for any help you may provide !