MontyRisk
(Monty Risk)
1
I am trying to add together 2 sensors that return in hours. The idea with the formula is correct, but I don’t know how to write it.
I get an error like this: TypeError: unsupported operand type(s) for +: ‘float’ and ‘str’
{{ (states('sensor.fan_1') | float *3600) + (states('sensor.fan_2') | float * 3600) | timestamp_custom('%H:%M', false) }}
I’m not entirely sure, but in my opinion you are running timestamp_custom
only on the second state
…
Try it like this:
{{ ((states('sensor.fan_1') | float * 3600) + (states('sensor.fan_2') | float * 3600)) | timestamp_custom('%H:%M', false) }}
Patrick is correct, remove the inner-most )
and (
… so that the function is applied after the two floats are summed:
{{ (states('sensor.fan_1') | float *3600 + states('sensor.fan_2') | float * 3600) | timestamp_custom('%H:%M', false) }}