if (!t.is_valid())
return;
- // Turn pump off if we no longer need heat (for 10 mins) after 5pm.
- if (t.hour >= 17 && !want_state && id(pool_pump).state &&
+ // Turn pump off if we no longer need heat (for 10 mins) between 5pm and 7pm.
+ if (t.hour >= 17 && t.hour < 19 && !want_state && id(pool_pump).state &&
+ now > id(pump_last_manual_change) + 600 &&
now > id(control_valve_last_change) + 600) {
ESP_LOGD("control_value", "Cold for ten minutes. Turning pump off for the night");
id(pool_pump).turn_off();
}
- // Turn pump off if it's warm enough, between 7am and 10am (when it comes on anyway).
- if (t.hour > 7 && t.hour < 10 && outtemp >= 20.0 && !id(pool_pump).state) {
+ // Turn pump on if it's warm enough, between 7:30am and 10am (when it comes on anyway).
+ if (((t.hour == 7 && t.minute >= 30) || t.hour > 8) &&
+ t.hour < 10 && outtemp >= 20.0 && !id(pool_pump).state) {
ESP_LOGD("control_value", "Roof temperature over 20°C. Turning pump ON and valve OFF.");
id(pool_pump).turn_on();
id(valve_output).turn_off();
id(control_valve_last_change) = now;
id(valve_output).toggle();
- # As soon as we know what the time is (and at 7am and 7pm), decide if the pump should be on.
+ # As soon as we know what the time is (and at 10am and 7pm), decide if the pump should be on.
- id: pump_default
parameters:
force: bool # Set it again even if it was already set since boot
restore_value: no
initial_value: '0'
+ - id: pump_last_manual_change
+ type: time_t
+ restore_value: no
+ initial_value: '0'
+
time:
- platform: sntp
id: sntp_time
break;
case 518: /* Pool pump switch */
+ id(pump_last_manual_change) = ::time(NULL);
if (nvalue)
id(pool_pump).turn_on();
else
on_value:
then:
lambda: |-
- id(tell_domo_svalue)->execute(509, std::to_string(x));
+ id(tell_domo_nvalue)->execute(509, (int)(x + 0.5));
- platform: ble_client
type: rssi