I’m trying to create a binary sensor based on power consumption. If the power consumption is bigger than 10W, then the binary sensor is on; otherwise, it is off.
If you want to switch devices based on it, you can also consider a threshold sensor. It has a hysteresis setting, which helps you to say: it must be somewhat over 10 to turn on, or somewhat below 10 to turn off. Having such a hysteresis helps prevent constant on/off switching when the value fluctuates around the limit. You can create one in the helpers section.