Hello there,
I need to measure a differential voltage from an ADC reading through ESPHOME.
The two single voltage potentials are read by means of 2 adc channel
which are:
sensor.clim_AD2_1
sensor.clim_AD2_2
I would obtain an entity with the difference of this two value in order to get the difference potential
The helper " Combine the state of several sensors" offer just the “add” math operation
So I found this topic with similar issue
https://community.home-assistant.io/t/math-operations-with-a-sensor-value/421054/3
captive_portal:
template:
- sensor:
- name: "clim"
unit_of_measurement: "V"
state: >
{% set clim = states('sensor.clim_AD2_2') | float - states('sensor.clim_AD2_1') | float %}
{{ clim }}
But it still doesn’t work…I get this error
Failed config
template: [source /config/esphome/clim.yaml:122]
Component template cannot be loaded via YAML (no CONFIG_SCHEMA).
- sensor:
- name: clim
unit_of_measurement: V
state: |-
{% set clim = states('sensor.clim_AD2_2') | float - states('sensor.clim_AD2_1') | float %} {{ clim }}
Surely it is a dummy syntax or config mistake
Somebody has any suggestions?