From aea98f313548731421c175bd949dcd112084a65f Mon Sep 17 00:00:00 2001 From: Jan Grewe <jan@faked.org> Date: Wed, 25 May 2022 21:19:30 +0200 Subject: [PATCH] fan control logic (NFG, circular dependency) --- propbox.yaml | 69 +++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 57 insertions(+), 12 deletions(-) diff --git a/propbox.yaml b/propbox.yaml index aee0950..af763d6 100644 --- a/propbox.yaml +++ b/propbox.yaml @@ -22,6 +22,11 @@ substitutions: schedule_bloom_on: "0 * * * * *" schedule_bloom_off: "30 * * * * *" + temperature_fan_on: "27.0" + temperature_fan_off: "21.0" + humidity_fan_on: "60" + humidity_fan_off: "40" + # fix for 2022.5.0 external_components: - source: github://martgras/esphome@nvs-fix @@ -48,15 +53,55 @@ sensor: ### Specific Sensors - platform: pvvx_mithermometer - mac_address: $ble_sensor_mac - temperature: - name: "Temperature" - humidity: - name: "Humidity" + mac_address: ${ble_sensor_mac} battery_level: name: "Battery Level" battery_voltage: name: "Battery Voltage" + temperature: + id: "temperature" + name: "Temperature" + on_value_range: + - above: ${temperature_fan_on} + then: + - if: + condition: + - sensor.in_range: + id: "humidity" + above: ${humidity_fan_off} + then: + - switch.turn_on: propbox_fan + - below: ${temperature_fan_off} + then: + - if: + condition: + - sensor.in_range: + id: "humidity" + below: ${humidity_fan_on} + then: + - switch.turn_off: propbox_fan + humidity: + id: "humidity" + name: "Humidity" + on_value_range: + - above: ${humidity_fan_on} + then: + - if: + condition: + - sensor.in_range: + id: "temperature" + above: ${temperature_fan_off} + then: + - switch.turn_on: propbox_fan + - below: ${humidity_fan_off} + then: + - if: + condition: + - sensor.in_range: + id: "temperature" + below: ${temperature_fan_on} + then: + - switch.turn_off: propbox_fan text_sensor: !include include/text_sensors.yaml @@ -78,7 +123,7 @@ globals: select: - platform: template id: "select_schedule" - name: "Schedule" + name: "Light Schedule" options: - "Disabled" - "Grow" @@ -99,7 +144,7 @@ http_request: switch: - platform: template id: "propbox_light" - name: "Light" + name: "Light Status" lambda: |- if (id(state_light) == 1) { return true; @@ -126,7 +171,7 @@ switch: } - platform: template id: "propbox_fan" - name: "Fan" + name: "Fan Status" lambda: |- if (id(state_fan) == 1) { return true; @@ -158,28 +203,28 @@ time: timezone: "Europe/Berlin" update_interval: 1h on_time: - - cron: $schedule_grow_on + - cron: ${schedule_grow_on} then: - lambda: |- if (id(schedule) == 1) { id(propbox_light).turn_on(); id(state_light) = 1; } - - cron: $schedule_grow_off + - cron: ${schedule_grow_off} then: - lambda: |- if (id(schedule) == 1) { id(propbox_light).turn_off(); id(state_light) = 0; } - - cron: $schedule_bloom_on + - cron: ${schedule_bloom_on} then: - lambda: |- if (id(schedule) == 2) { id(propbox_light).turn_on(); id(state_light) = 1; } - - cron: $schedule_bloom_off + - cron: ${schedule_bloom_off} then: - lambda: |- if (id(schedule) == 2) { -- GitLab