I’m trying to derive a custom sensor from two other sensors using templates or lambda, but I’m hitting a brick wall. This is the yaml containing the two sensors and the custom sensor I was trying to derive, Can someone please help me check what I was doing wrong. Thanks in advance.
sensor:
- platform: pipsolar
pipsolar_id: inverter0
# QPIRI
# QPIGS
grid_voltage:
name: "${name} pv_voltage"
id: pvvoltage
unit_of_measurement: "V"
grid_frequency:
name: "${name} battery_voltage"
id: batteryvoltage
unit_of_measurement: "V"
ac_output_voltage:
name: "${name} pv_current"
id: pvcurrent
unit_of_measurement: "A"
- platform: template
name: "${name} pv_power"
id: pv_power
filters:
- lambda: return id(pvcurrent).raw_state) * id(batteryvoltage).raw_state);
update_interval: 10s