Thanks again - all the extr brackets added, and all the int changes to float (not I understand what the int was doing - luckily most of my sensors that had it are whole numbers… but I will change all them too - I may be missing out on fractions of watts here and there…
Also note that this expression, and thus your automation or wherever you are using it, will fail and error out if the sensor goes unavailable. This because the state string “unavailable” cannot be cast to a float.
It is good practice to either add a default value, something like float(0) and precautions if this makes the result unexpected, or an additional has_value() check.
This would return none / null if the sensor is unavailable, rather than error out: