Hello and welcome to the forum. Could you please edit your post and format your pasted config by following these instructions: https://community.home-assistant.io/t/how-to-help-us-help-you-or-how-to-ask-a-good-question/114371#oneone-format-it-properly-16
You have specified a sensor device class of power
, which requires a numeric state yet your template is supplying yes 1
or No
. Which are not numeric.
Remove the device_class
line.