Hello!
I’ve got sensor results from a Victron Solar charger (via USB serial) over two sensors in HA.
sensor.ve_direct_1 = Solar Wattage
sensor.ve_direct_2 = Solar Voltage
I’d like to divide wattage by voltage in a template sensor to give current reading.
Anyone know the formula in HA?
Cheers.
"{{ (float(states('sensor.ve_direct_1')) / float(states('sensor.ve_direct_2'))) | round(0) }}"
Change round(0)
to whatever number of decimal places you want.
Edit: Missed a uh… key part of the template…
Ok because its dark and I’ve no watts coming in.
Ive substituted the sensors with two that positive numeric values.
But its saying “unknown” on the template sensor in states
Think I may be missing something…
Any ideas?
leisure_amps:
friendly_name: "Leisure Amps"
unit_of_measurement: 'Amps'
value_template: "{{ (float('sensor.leisure_battery_level') / float('sensor.low_water_level')) | round(2) }}"
tom_l
October 24, 2019, 9:37pm
4
Try it like this:
value_template: "{{ (states('sensor.leisure_battery_level')|float / states('sensor.low_water_level')|float ) | round(2) }}"
1 Like
Ugh, forgot the states part lol… thanks Tom.
Not sure how I managed that.
1 Like
Thats the badger!
Thank you guys. Much appreciated.
Looking forward to sunrise!
1 Like