Ok, it should be something very stupid, but I just can’t fix it.
I have two sensors collecting data via MQTT
- platform: mqtt
name: correnteluzaquario
unit_of_measurement: "A"
state_topic: "tele/aquarium-light/SENSOR"
value_template: "{{value_json['ENERGY']['Current'] }}"
force_update: true
hidden: true
- platform: mqtt
name: correnteaquecedor
unit_of_measurement: "A"
state_topic: "tele/aquarium-heater/SENSOR"
value_template: "{{value_json['ENERGY']['Current'] }}"
force_update: true
hidden: true
Now, I’d like to create a new sensor with the sum of these two sensors. I have tried:
- platform: template
name: aquariocorrente
unit_of_measurement: "A"
with the following alternatives for value_template
:
value_template: "{{ (states('sensor.correnteaquecedor') | float) + (states('sensor.correnteluzaquario') | float) }}"
value_template: "{{ states.sensor.correnteaquecedor + states.sensor.correnteluzaquario }}"
value_template: "{{ states.sensor.correnteaquecedor.state + states.sensor.correnteluzaquario.state }}"
value_template: "{{ sensor.correnteaquecedor.state + sensor.correnteluzaquario.state }}"
value_template: "{{ sensor.correnteaquecedor + sensor.correnteluzaquario }}"
All of them come with the following error when I ask for configuration check:
Invalid config for [sensor.template]: required key not provided @ data['sensors']. Got None. (See ?, line ?). Please check the docs at https://home-assistant.io/components/sensor.template/
Could someone please, help me to spot where I’m wrong?