I have a question.
I currently have a Wemo plug. Currently I’m using the switch to turn on a dedicated pool pump attached to a solar dome heater. I’m using my Home app on my iOS device setting a automation for my switch to turn on every 30 mins run for 1 min then shut off. Basically I’m just trying to move the heated water in the heater into the pool then shutoff and let the sun do its thing. after 30mins unload the warm water and start over again.
Now I’m wondering if there’s a way to set a automation to do this same thing but only do it if its sunny out?
I’m just not sure how to go about it, any suggestions?
sensor:
- platform: yr
monitored_conditions:
- symbol
automation:
- Alias: Kick start pump cycle
trigger:
- platform: state
entity_id: sensor.yr_symbol
to: '1'
- event: homeassistant
event_type: start
action:
- service: script.start_pump
script:
start_pump:
- condition: state
entity_id: sensor.yr_symbol
state: '1'
- service: switch.turn_on
entity_id: switch.pump
- delay: '00:01:00'
- service: switch.turn_off
entity_id: switch.pump
- service: script.pump_wait
pump_wait:
- delay: '00:30:00'
- service: script.start_pump
Using the symbol condition of the yr sensor (i.e., sensor.yr_symbol), you can determine if it is sunny by this entity’s state being a one (i.e., 1.) The automation triggers when this entity becomes 1, and it starts the first script. (It also triggers when HA starts in case it’s sunny then.) The script checks to make sure that it’s sunny. If so it turns on the pump, waits a minute, then turns it off. It then starts the second script, which waits 30 minutes and starts the cycle again by starting the first script. This keeps going until it’s no longer sunny.
Or you could do it more like what you’re probably already doing:
sensor:
- platform: yr
monitored_conditions:
- symbol
automation:
- alias: Pump
trigger:
platform: time
minutes: '/30'
seconds: 0
condition:
condition: state
entity_id: sensor.yr_symbol
state: '1'
action:
- service: switch.turn_on
entity_id: switch.pump
- delay: '00:01:00'
- service: switch.turn_off
entity_id: switch.pump
You could even tweak it a bit to only start the cycle after it’s been sunny for a minimum amount of time, and possible only continue if it stays sunny continuously.
Of course, a temperature sensor in the heater might even be better.
1 Like
thank you very much! ill play around with it! I plan on building a bigger solar heater but I wanted to get this up and running first. I appreciate your time and explanation!
would this be correct?
- id: pump
alias: Pump
trigger:
- platform: time
minutes: '/30'
seconds: 0
condition:
condition: state
entity_id: sensor.yr_symbol
state: '1'
action:
- service: courtney_box_fan_.turn_on
entity_id: switch.pump
- delay: '00:01:00'
- service: courtney_box_fan_.turn_off
entity_id: switch.pump
pay no attention to the switch name, i used my daughters fan switch to test it out.
switch.courtney_box_fan_
Close, but no. There are a few issues. The indentation is wrong in some places. YAML is extremely sensitive to indentation so you have to be careful. You’re using the wrong service in the action. It’s switch.turn_on
and switch.turn_off
. And the entity_id’s should be switch.courtney_box_fan_
. So:
automation:
- id: pump
alias: Pump
trigger:
- platform: time
minutes: '/30'
seconds: 0
condition:
condition: state
entity_id: sensor.yr_symbol
state: '1'
action:
- service: switch.turn_on
entity_id: switch.courtney_box_fan_
- delay: '00:01:00'
- service: switch.turn_off
entity_id: switch.courtney_box_fan_
1 Like
your awesome, thanks so very much!
im still trying to learn all of this
1 Like
You might want to also add a condition for time of day. Being “sunny” with the sun down is probably not good enough for turning the pump on! So maybe two conditions like this:
condition:
- condition: state
entity_id: sensor.yr_symbol
# A value of 1 means sunny
state: '1'
- condition: state
entity_id: sun.sun
state: above_horizon
By default multiple conditions all have to be true. Of course, you could use other criteria, like the sun’s elevation has to be above a certain angle, or it has to be so much after sunrise and so much before sunset, etc.
1 Like
- id: pump
alias: Pump
trigger:
- platform: time
minutes: '/30'
seconds: 0
condition:
- condition: state
entity_id: sensor.yr_symbol
# A value of 1 means sunny
state: '1'
- condition: state
entity_id: sun.sun
state: above_horizon'
action:
- service: switch.turn_on
entity_id: switch.courtney_box_fan_
- delay: '00:01:00'
- service: switch.turn_off
entity_id: switch.courtney_box_fan_
just so i know i did it properly…
Ooh, so close! Remove the quote at the end of state: above_horizon'
. Or, add a quote at the beginning: state: 'above_horizon'
. Either way will work.
1 Like
This is going to be awesome when I get a bigger heater built. Thanks very much. I can’t wait to see how it works!
1 Like
Just another FYI… I figured out what the various values for sensor.yr_symbol mean. I was thinking of using this information for something else. But since we’re “on the topic”, and I have this info, I figured I’d share. (This is just my interpretation based on what the symbols look like for each of these numbers.)
1 - sunny
2 - mostly sunny
3 - mostly cloudy
4 - cloudy
5 - rain with some sun (aka light rain?)
6 - thunderstorm with some sun (aka light thunderstorm?)
7 - sleet with some sun (aka light sleet?)
8 - snow with some sun (aka light snow?)
9 - rain
10 - heavy rain
11 - thunderstorm
12 - sleet
13 - snow
14 - snow thunderstorm
15 - cloudy, like 4
1 Like
So do the numbers change during the day based on what is in the forecast? So if I wanted to use 1&2 I could do the switch would only turn on if the sun was present but wouldn’t if it got cloudy or started to rain but start again if the sun comes back out?
Thanks for sharing this information with me, the pump did turn on this morning properly so this automation is perfect! I owe you one!
I believe this sensor indicates the current condition (as opposed to a forecast of future conditions.) So if the current condition changes, then this sensor’s state/number will change accordingly (well, as determined by the YR service.)
Sorry, I’m not following your question. Do you mean if you made the conditions that the sun has to be above the horizon, and sensor.yr_symbol has to be 1 or 2? Yes, in that case, the conditions would become false if it got cloudy, or rained, etc., but would become true again when it got sunny or mostly sunny.
Depending on how exactly you want it to work, your configuration may need some changes. E.g., if you just trigger every 30 minutes, it’s possible the condition could change so it’s only sunny or mostly sunny between the 30 minute sample points, in which case it would never run. Not likely, but possible. Just something to think about. This is where my first suggestion (of using an automation with two scripts), although a bit more complicated, might actually work better.
1 Like
Yes exactly, thanks for the explanation!
I’ll have to look at the configuration tonight after work and see if I can figure it out using both. This is really cool!
1 Like
FYI, if you want to use 1 & 2, then you can change the trigger/condition from state to numeric_state with below: 3
. E.g.,
- condition: numeric_state
entity_id: sensor.yr_symbol
below: 3
1 Like
@pnbruckner - Tonight I finally got everything together.
I installed a New PVC return for my pool, it goes into a 3 way.
-
is my normal return, obviously clean chlorinated water goes back into my pool.
-
is a fun for the kids fountain, with a shutoff ball valve so it doesn’t always have to run.
-
I placed a reducer going into 1/2" irrigation line, from there I placed a electric irrigation valve that is plugged into my automated (Thanks to you) Wemo switch. Now hopefully I can be home at some point tomorrow to see how it all works. Unfortunately in pest I’m control and its busy season but im sure ill be home at some point to see it run!
I can’t wait to research a few options to make this work even better, so far its supposed to turn on when the sun is up and the number is at 1 or 2, then off it goes. I removed the 30 rest and on for 1 minute because i now have 500’ mounted on my roof so plenty of warm water comes out at a slower flow rate.
I saw on here that there is a supported waterproof thermometer, I’m thinking maybe next summer ill get 2 one for the pool temperature and one for the solar water temperature and have it only run if the solar water is warmer the the pool water with the above conditions too. That would probably make it even better!
Do you have any suggestions that you can think of to make it more efficient?
Either way you were my inspiration for all of this thank you for being so helpful and willing to help me!
1 Like
The only thing I can think of right now that might help is I noticed the other day that my sensor.yr_symbol had a value of like 40 or something for a short time. So it looks like there are other possible values than the ones I listed above. So you might want to keep a look out for that. I.e., there may be other values than 1 & 2 that correspond to sunny or mostly sunny. Other than that, sounds great!
1 Like
If I take out the time part & delay part of the automation above it will run correctly right?
(Sun above the horizon and on 1&2)
Well, no. The time part is the only trigger in your automation, so it’s the only thing that gives the automation a chance to run. Basically, the trigger part decides when the automation actions can run, and the condition part decides if the automation actions will run (when a trigger event occurs.) So, without a trigger, nothing will happen no matter what the conditions say.
So, if you’re wanting to turn on the switch when the sun is above the horizon and it’s sunny or mostly sunny, and turn it off when the sun goes down or it’s not sunny or mostly sunny, then you need something like this:
- id: pump_on
alias: Pump on
trigger:
- platform: state
entity_id: sun.sun
to: above_horizon
- platform: numeric_state
entity_id: sensor.yr_symbol
below: 3
condition:
- condition: state
entity_id: sun.sun
state: above_horizon
- condition: numeric_state
entity_id: sensor.yr_symbol
below: 3
action:
- service: switch.turn_on
entity_id: switch.courtney_box_fan_
- id: pump_off
alias: Pump of
trigger:
- platform: state
entity_id: sun.sun
to: below_horizon
- platform: numeric_state
entity_id: sensor.yr_symbol
above: 2
action:
- service: switch.turn_off
entity_id: switch.courtney_box_fan_
Thank You again buddy! It is appreciated!
1 Like