Added self-managed time control to a3pool.yaml #1
| @@ -17,6 +17,10 @@ This is a standard config for the a3pool. Nothing special by far with 2 temp sen | |||||||
| The temperature sensors have the `pool_temperature` and `solar_temperature` and will show report the pool temperature and solar temperature respectively every 10 seconds. | The temperature sensors have the `pool_temperature` and `solar_temperature` and will show report the pool temperature and solar temperature respectively every 10 seconds. | ||||||
|  |  | ||||||
| There is also one switch that is designed to turn the pump on and off. This works by giving an 500ms long impulse that should turn the pump on/off and sensing on a GPIO ping whenever the pump is currently on/off. This switch carries the name of `pump`. I know HOW CREATIVE... | There is also one switch that is designed to turn the pump on and off. This works by giving an 500ms long impulse that should turn the pump on/off and sensing on a GPIO ping whenever the pump is currently on/off. This switch carries the name of `pump`. I know HOW CREATIVE... | ||||||
|  |  | ||||||
|  | It also has the possibility of having it's own clock. | ||||||
|  | Simply adjust the time using the `start_h`, `start_m` as well as `end_h`, `end_m` and enable the `control` switch to ensure the automatic control in on. The button `sync_to_clock`is used to sync the system back to the clock without having to know/care about on/off times, simply press the button and it should switch to on/off if it should be on/off respectively. | ||||||
|  |  | ||||||
| **HOWEVER: If the pump is set to off or to the physical clock with physical switch in the garage this will not work!** It will still report it's state correclty however. | **HOWEVER: If the pump is set to off or to the physical clock with physical switch in the garage this will not work!** It will still report it's state correclty however. | ||||||
|  |  | ||||||
| There is an other switch that does not have any functionality yet but it's `automate_control` if anyone wants to know. | There is an other switch that does not have any functionality yet but it's `automate_control` if anyone wants to know. | ||||||
|   | |||||||
							
								
								
									
										99
									
								
								a3pool.yaml
									
									
									
									
									
								
							
							
						
						
									
										99
									
								
								a3pool.yaml
									
									
									
									
									
								
							| @@ -32,6 +32,81 @@ binary_sensor: | |||||||
|         pullup: true |         pullup: true | ||||||
|     id: pump_state |     id: pump_state | ||||||
|  |  | ||||||
|  | number: | ||||||
|  |   - platform: template | ||||||
|  |     name: "Start Hour" | ||||||
|  |     id: start_h | ||||||
|  |     optimistic: true | ||||||
|  |     min_value: 0 | ||||||
|  |     max_value: 23 | ||||||
|  |     restore_value: true | ||||||
|  |     initial_value: 8 | ||||||
|  |     mode: box | ||||||
|  |     step: 1 | ||||||
|  |   - platform: template | ||||||
|  |     name: "Start Minute" | ||||||
|  |     id: start_m | ||||||
|  |     optimistic: true | ||||||
|  |     min_value: 0 | ||||||
|  |     max_value: 59 | ||||||
|  |     initial_value: 0 | ||||||
|  |     restore_value: true | ||||||
|  |     mode: box | ||||||
|  |     step: 1 | ||||||
|  |   - platform: template | ||||||
|  |     name: "End Hour" | ||||||
|  |     id: end_h | ||||||
|  |     optimistic: true | ||||||
|  |     min_value: 0 | ||||||
|  |     max_value: 23 | ||||||
|  |     restore_value: true | ||||||
|  |     initial_value: 20 | ||||||
|  |     mode: box | ||||||
|  |     step: 1 | ||||||
|  |   - platform: template | ||||||
|  |     name: "End Minute" | ||||||
|  |     id: end_m | ||||||
|  |     optimistic: true | ||||||
|  |     min_value: 0 | ||||||
|  |     max_value: 59 | ||||||
|  |     restore_value: true | ||||||
|  |     initial_value: 0 | ||||||
|  |     mode: box | ||||||
|  |     step: 1 | ||||||
|  |  | ||||||
|  | button: | ||||||
|  |   - platform: template | ||||||
|  |     name: "Sync To Clock" | ||||||
|  |     on_press: | ||||||
|  |       then: | ||||||
|  |         - lambda: |- | ||||||
|  |             int startMins = (int) (id(start_h).state * 60) + id(start_m).state; | ||||||
|  |             int endMins = (int) (id(end_h).state * 60) + id(end_m).state; | ||||||
|  |             int nowMins = (id(a3poolTime).now().hour * 60) + id(a3poolTime).now().minute; | ||||||
|  |              | ||||||
|  |             if(!id(control).state){ | ||||||
|  |               // Make sure wierd error or whatever | ||||||
|  |               return; | ||||||
|  |             } | ||||||
|  |  | ||||||
|  |             if(startMins < endMins){ | ||||||
|  |               if(startMins < nowMins && nowMins < endMins){ | ||||||
|  |                 id(pump).turn_on(); | ||||||
|  |               } | ||||||
|  |               else{ | ||||||
|  |                 id(pump).turn_off(); | ||||||
|  |               } | ||||||
|  |             } | ||||||
|  |             else if(startMins > endMins){ | ||||||
|  |               if(endMins < nowMins && nowMins < startMins){ | ||||||
|  |                 id(pump).turn_off(); | ||||||
|  |               } | ||||||
|  |               else{ | ||||||
|  |                 id(pump).turn_on(); | ||||||
|  |               } | ||||||
|  |             } | ||||||
|  |  | ||||||
|  |  | ||||||
| switch: | switch: | ||||||
|   - platform: gpio |   - platform: gpio | ||||||
|     pin: 5 |     pin: 5 | ||||||
| @@ -41,12 +116,14 @@ switch: | |||||||
|     - switch.turn_off: relay |     - switch.turn_off: relay | ||||||
|   - platform: template |   - platform: template | ||||||
|     name: "Automate Control" |     name: "Automate Control" | ||||||
|  |     id: control | ||||||
|     optimistic: true |     optimistic: true | ||||||
|     restore_state: true |     restore_state: true | ||||||
|  |  | ||||||
|   - platform: template |   - platform: template | ||||||
|     optimistic: false |     optimistic: false | ||||||
|     name: pump |     name: pump | ||||||
|  |     id: pump | ||||||
|     lambda: |- |     lambda: |- | ||||||
|       if (id(pump_state).state) { |       if (id(pump_state).state) { | ||||||
|         return true; |         return true; | ||||||
| @@ -70,6 +147,28 @@ switch: | |||||||
|             - delay: 500ms |             - delay: 500ms | ||||||
|             - switch.turn_off: relay |             - switch.turn_off: relay | ||||||
|  |  | ||||||
|  | time: | ||||||
|  |   timezone: "Europe/Vienna" | ||||||
|  |   id: a3poolTime | ||||||
|  |   platform: sntp | ||||||
|  |   on_time: | ||||||
|  |     - seconds: 0 | ||||||
|  |       months: 4-10 | ||||||
|  |       then: | ||||||
|  |         - if:  | ||||||
|  |             condition: | ||||||
|  |               lambda: 'return id(a3poolTime).now().hour == (int) id(start_h).state && id(a3poolTime).now().minute == (int) id(start_m).state && id(control).state;' | ||||||
|  |             then: | ||||||
|  |               - switch.turn_on: pump | ||||||
|  |     - seconds: 0 | ||||||
|  |       months: 4-10 | ||||||
|  |       then: | ||||||
|  |         - if:  | ||||||
|  |             condition: | ||||||
|  |               lambda: 'return id(a3poolTime).now().hour == (int) id(end_h).state && id(a3poolTime).now().minute == (int) id(end_m).state && id(control).state;' | ||||||
|  |             then: | ||||||
|  |               - switch.turn_off: pump | ||||||
|  |  | ||||||
| dallas: | dallas: | ||||||
|   - pin: D4 |   - pin: D4 | ||||||
|     update_interval: 10s |     update_interval: 10s | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user