Numeric Virtual Sensor

Hello, just that, I need to create a numerical virtual sensor that adds the powers that I am measuring in Home Assistant to show it on the panel.

Can someone help me where I can find a guide code. It is wanted but I do not find anything.

Thanks for answering, from what I have seen I must use Template. But HA could not recognize the code. Should Template be integrated? or this’ by default in HA.

This is an error that HA tells me:

Invalid config for [sensor.template]: [sensor] is an invalid option for [sensor.template]. Check: sensor.template-> sensor. (See?, Line?).

and this is code (the idea is that I assign the sonnof sensor value to a Virtual Sensor. Going forward I double add other sensors to my Virtual Sensor.

- platform: template
  sensor:
    power_total: 
      friendly_name: "Total Watt"
      state: >-
        {% set  power_total = states('sensor.sonoff_cocina_power') | int %}
```

You have a mix of the legacy and new format.

I recommend you use the new format.

template:
  - sensor:
      - name: "Total Watt"
        unit_of_measurement: "W"
        icon: "mdi:gauge"
        state: >
          {% set  power_total = states('sensor.sonoff_cocina_power') | float %}
          {{ power_total }}
1 Like

28 / 5000

Resultados de traducción

Thanks, it worked right away