I have a ceiling fan that I’ve managed to control by learning the 433 codes into a Broadlink RM Pro so now I can turn it on and off which is great but of course, there is no feedback.
What I’m intending to do is supply power to the fan through a Shelly PM1 so I can monitor the power used and determine whether the fan is on or off. I can then build a template switch but I need help with the templating script for the sensor. The intention is that if the power is <1 it’s assumed off and >1 it’s assumed on.
switch:
- platform: template
switches:
ceiling_fan_2:
value_template: "{{what to put in here?}}"
turn_on:
service: switch.turn_on
data:
entity_id: switch.master_bedroom_fan_2
turn_off:
service: switch.turn_off
data:
entity_id: switch.master_bedroom_fan_2
The sensor I currently have for one of my Shelly’s that reports power is this:
Change the 666 value to a value smaller than when the fan is on. e.g if the fan draws 100W when on a good value might be 75. The closer to the ‘on’ power the faster the response but also the greater the likelihood of a false reading.
Now you’ve created a problem! Like @tom_l, I did not know you could do that either. Let the fun begin. I found a thread here so I’ll ask @subzero79 for some feedback.
I mean, it’s not really that big of a difference. But, if your fan has different speeds and you’re able to detect those with power consumption, you’ll be able to know if your fan is on high, medium, low, or off. Which is nice.
The UI for a fan looks almost the same as a switch. In the main list, it’s just a toggle like a switch. When you go to the more-info panel, you’ll also get a dropdown to set the speed.
The other advantage to using a “fan” instead of a “switch” is Google/Alexa integration will know automatically that it’s a fan as opposed to you having to override the switch to a fan in the Google/Alexa config.
So… if you don’t use Google/Alexa or don’t have multiple speeds on your fan, there’s basically no payoff to switch it to a fan.template.
I posted the set speed script sort of example on the other thread.
As for the current state I use nodered to process the values and push them to the input_number, but you can do the same I guess with a template.
This does not. Comes up with “can not read a block mapping entry; a multiline key may not be an implicit key” and searching the forum for that exact phrase yields not results.