Hi all. new to this. have been going back and forth from search’s trying to fix this so sorry if it has been covered before.
I have 2 template sensors I am trying to get working. the first is a subtraction between 2 sensors.
self_consumption:
value_template: '{{ (states.sensor.energy_generation | float ) - (states.sensor.grid_sold_energy_day | float)}}'
friendly_name: "self_consumption"
unit_of_measurement: "kWh"
and the problem is it returns 0 and in the template tool I get “This template does not listen for any events and will not update automatically.” This is probably easy but I am a little fried from trying to work it out.
the second is a multiplication of a sensor and a value.
dryer_consumed_kW:
value_template: "{{ states('sensor.dryer_electric_consumed_w') | float * 0.001 }}"
friendly_name: "dryer_consumed_kW"
unit_of_measurement: "kW"
this seems to be ok in the template builder but when doing a configuration check I get a big error.
Invalid config for [sensor.template]: invalid slug dryer_consumed_kW (try dryer_consumed_kw) for dictionary value @ data[‘sensors’]. Got OrderedDict([(‘power_consumption’, OrderedDict([(‘value_template’, “{% if is_state_attr(‘sensor.pvoutput’, ‘power_consumption’, ‘NaN’) %}0{% else %}{{ state_attr(‘sensor.pvoutput’, ‘power_consumption’) }}{% endif %}”), (‘friendly_name’, ‘Using’), (‘unit_of_measurement’, ‘Watt’)])), (‘energy_consumption’, OrderedDict([(‘value_template’, ‘{{ “%0.1f”|format(state_attr(“sensor.pvoutput”, “energy_consumption”)|float/1000) }}’), (‘friendly_name’, ‘Used’), (‘unit_of_measurement’, ‘kWh’)])), ('power_… (See ?, line ?).
Anyway hope you guys can point me in the right direction.