WTH, is there not a simple helper to perform basic addition, subtraction, multiplication and division - For example 0.300 kWh entity X 1000 to output 300w or anything else we want to perform very basic maths on.
I completely agree and was also looking for something similar w/o creating template sensors with (at leat for me) hard to understand syntax.
I come from EDOMI and I liked the logic builder with many features for math and comparisons…
I came here to create the exact same WTH. I am an aerospace engineer and used to being able to easily put in a function for something I want as you would in Basic, Fortran, C, any spreadsheet ever, and almost any computer language ever. How is this not a simple task? Why even create a computer language that can’t do math (joking)? I would gladly help someone who knows more about HA and YAML than me to test/debug such a helper. I am thinking the fundamental {+, -, , /, and a rudimentary algebraic equation such as (ax^^p + bx + c) or the like, and 1/X}. I have a simple program I like called “CURVXPT” (curve expert) which has dozens of functions to match real data to various smooth functions, but that would probably be too much to bite off for this kind of deal.
This is what I had to create to convert KW to W and also feed in payments for my SolarPV, not hard to do but seems like something that should be easy to do without templates
template:
- sensor:
- name: "Smart Meter Electricity Power Watts"
unit_of_measurement: "W"
device_class: power
unique_id: "smartmeterelectricitypowerwatts"
state: "{{ (states('sensor.smart_meter_electricity_power') | float * 1000) }}"
# sensors to track FiT payments daily and running total
- name: "Feed-in Tariff Today"
unit_of_measurement: "GBP"
icon: mdi:currency-gbp
unique_id: "feedintarriftoday"
state_class: total
device_class: monetary
state: "{{ (states('sensor.solarinverter_energy_today') | float * 25.06)/100 }}"
- name: "Feed-in Tariff Total"
unit_of_measurement: "GBP"
icon: mdi:currency-gbp
unique_id: "feedintarriftotal"
state_class: total
device_class: monetary
state: "{{ (states('sensor.solarinverter_energy_total') | float * 25.06)/100 }}"