Hi,
I was wanting to ask if there was anyway I could transfer a value from my Shelly power monitors to a stored variable of some kind.
The issue is that the power to the Shellys is routinely cut at the end of the pump cycle. When that happens the Energy value becomes “unavailable” which I have defaulted to 0.
This means that I cannot display the value of the Accumulated Energy consumption once the device is off.
I was hoping to transfer the value to a persistant/permanent variable while the device is on. I considered an input_number helper but I cannot assign the entity vaule within the Markdown card.
MARKDOWN CARD OUTPUT (When devices ON)
Device----------------------Now--------------Life time
Ch1 -Main Filter 20 333 kWh
Ch2 In-- Floor 86 211 kWh
Ch3 Filter Pump 11 166 kWh
MARKDOWN CARD OUTPUT (When devices OFF)
Device---------------------Now--------------Life time
Ch1 -Main Filter 0 0 kWh <— I want these LifeTime values to remain when device is off.
Ch2 In-- Floor 0 0 kWh
Ch3 Filter Pump 0 0 kWh
MARKDOWN CARD CODE
‘’’
Ch1 -Main Filter {{ (states(‘sensor.minipm_ch1_mainfilter_power’)|float(0)|round(0)) }} {{ (states(‘sensor.minipm_ch1_mainfilter_energy’)|float(0) | round()) }} kWh
Ch2 In-- Floor {{ (states(‘sensor.in_floor_ch2_power’)|float(0)|round(0)) }} {{ (states(‘sensor.in_floor_ch2_energy’)|float(0) | round()) }} kWh
Ch3 FilterPump {{ (states(‘sensor.shellypmminig3_dcda0db515bc_power’)|float(0)) }} {{ (states(‘sensor.shellypmminig3_dcda0db515bc_energy’)|float(0) | round()) }} kWh
‘’’
## I tried to use this Ch1KWH variable, which does collect the value, but returns to the initial value “99” when the device is off"
‘’’
{% set Ch1KWH = 99 %}
{% if (states(‘sensor.minipm_ch1_mainfilter_energy’)|float(0)) > 0 %}
{% set Ch1KWH = (states(‘sensor.minipm_ch1_mainfilter_energy’)|float(0)) | round(0) %}
{% endif %}
‘’’
Or if I tried to do it outside the markdown card, could I do it in an automation (which runs when the device is on) to store the value? Still not sure where to assign the value to, where it can be accessed later.
Basically I’m looking for a place and way to store an entity value that I can display in a card on the UI.
I’d appreciate any advice or clues.
Mike