diff --git a/propbox.yaml b/propbox.yaml index db2c1daf87ec31b71941aad5e3be903bcaafbd35..1159af97a713a81ec39e8371ac3698f41cf39286 100644 --- a/propbox.yaml +++ b/propbox.yaml @@ -159,52 +159,46 @@ time: - lambda: |- if (id(schedule).state == "Grow") { id(propbox_light).turn_on(); - id(propbox_light).publish_state(true); } - cron: ${schedule_grow_off} then: - lambda: |- if (id(schedule).state == "Grow") { id(propbox_light).turn_off(); - id(propbox_light).publish_state(false); } - cron: ${schedule_bloom_on} then: - lambda: |- if (id(schedule).state == "Bloom") { id(propbox_light).turn_on(); - id(propbox_light).publish_state(true); } - cron: ${schedule_bloom_off} then: - lambda: |- if (id(schedule).state == "Bloom") { id(propbox_light).turn_off(); - id(propbox_light).publish_state(false); } script: - id: fan_control then: - lambda: |- - // switch fan on when temperature/humidity is above the limit, unless humidity/temperature is below the limit + // switch fan on when temperature/humidity is above max, unless humidity/temperature is below min if ( !id(propbox_fan).state && (id(temperature).state >= atoi(id(temperature_max).state.c_str()) && id(humidity).state >= atoi(id(humidity_min).state.c_str())) || (id(humidity).state >= atoi(id(humidity_max).state.c_str()) && id(temperature).state >= atoi(id(temperature_min).state.c_str())) ) { id(propbox_fan).turn_on(); - id(propbox_fan).publish_state(true); } - // switch fan off when temperature and humidity are below the limits minus hysteresis + // switch fan off when temperature and humidity are below max minus hysteresis else if ( id(propbox_fan).state && id(temperature).state <= atoi(id(temperature_max).state.c_str()) - atoi(id(temperature_hysteresis).state.c_str()) && id(humidity).state <= atoi(id(humidity_max).state.c_str()) - atoi(id(humidity_hysteresis).state.c_str()) ) { id(propbox_fan).turn_off(); - id(propbox_fan).publish_state(false); } - id: propbox_light_state then: