Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A real life example #3

Open
sanderlv opened this issue Apr 19, 2023 · 0 comments
Open

A real life example #3

sanderlv opened this issue Apr 19, 2023 · 0 comments

Comments

@sanderlv
Copy link

Hi, thank you so much for creating this piece of hardware! It is now so handy to overcome the "issues" I had with the original print. the fact the fan would always auto turn on to 100% >65% hum was annoying and hard to change. I had "arne mauer" his print to arrange thing outside via HA but this did not always work as intended.
Now with this ESP board I can from within ESPhome create automations and turn on "auto" (or off :-)).

I have to change some internals on sensors to get a "fast" reaction on automations. By default in the SHT20 file this was set to 30000. I changed that to 5000 (5 seconds). then I created new sensors for HA with a throttle to 60s.

The result:
image
image

I may not be able to quickly react if questions are asked. Don;t be mad then 👍
disclaimer: This is my setup. Feel free to use or copy. But do no blame me for anything going wrong. It's your responsibility.

the change in SHT20:

  // the temperature 5s-30s. So lets poll at 4s, or half the response time.
  SHT20() : PollingComponent(5000) { }
  //was origineel 30000

the YAML:

esphome:
  name: esp32-duco-01
  platform: ESP32
  board: esp32dev
  libraries:
    - Wire
    - u-fire/uFire SHT20@^1.1.1
  includes: 
    - custom_components/duco/sht20.h

substitutions:
  esp_name: esp32-duco-01

wifi:
  ssid: "IOT"
  password: !secret IOT_wifi_key
  use_address: 192.168.6.85
  domain: !secret domain
  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "${esp_name} Fallback Hotspot"
    password: !secret Fallback_Hotspot

captive_portal:

# Enable logging
logger:
  level: DEBUG

# Enable Home Assistant API
api:

ota:

web_server:
  port: 80

time:
  - platform: homeassistant
    id: homeassistant_time

#esp32_ble_tracker:
#bluetooth_proxy:

# ! Warning ! the original Duco sensor can only be connected on sensor connector 1!

#
uart:
#UART For Sensor 1
# - rx_pin: GPIO13
#   tx_pin: GPIO12
#   baud_rate: 9600
#   id: uart_sensor_1
#UART For Sensor 2
 - rx_pin: GPIO25
   tx_pin: GPIO26
   baud_rate: 9600
   id: uart_sensor_2

i2c:
#I2C For Sensor 1
- id: i2c_sensor_1
  sda: GPIO19
  scl: GPIO18
  scan: false
  frequency: 400kHz
#I2C For Sensor 2
- id: i2c_sensor_2
  sda: GPIO16
  scl: GPIO4
  scan: false
  frequency: 400kHz

# Status led
status_led:
  pin:
    number: GPIO33

#PWM output for controlling the motor.
output:
  - platform: ledc
    pin: GPIO15
    inverted: true
    id: open_air_mini

fan:
  - platform: speed
    output: open_air_mini
    name: "${esp_name} - Fan"
    id: ducofan

sensor: 
  - <<: !include includes/include-wifi-signal.yaml
  - <<: !include includes/include-uptime-config.yaml
  
  - platform: pulse_counter
    pin: GPIO14
    unit_of_measurement: 'RPM'
    name: '${esp_name} - RPM'

  # SENSOR CONNECTOR 1 - original Duco sensor connected on sensor connector 1!
  - platform: custom
    lambda: |-
      auto sht20 = new SHT20();
      App.register_component(sht20);
      return {sht20->temperature_sensor, sht20->humidity_sensor, sht20->vpd_sensor, sht20->dew_point_sensor};
    sensors:
      - name: T
        internal: True
        id: sensor_temperature
        accuracy_decimals: 2
      - name: H
        id: sensor_humidity
        accuracy_decimals: 2
        internal: True
        on_value_range:
          - below: 65
            then:
              - if:
                  condition:
                    switch.is_on: ducoauto
                  then:
                    - fan.turn_on: 
                        id: ducofan
                        speed: 10
          - above: 65
            below: 70
            then:
              - if:
                  condition:
                    switch.is_on: ducoauto
                  then:
                    - fan.turn_on: 
                        id: ducofan
                        speed: 20
          - above: 70
            below: 75
            then:
              - if:
                  condition:
                    switch.is_on: ducoauto
                  then:
                    - fan.turn_on: 
                        id: ducofan
                        speed: 40
          - above: 75
            below: 80
            then:
              - if:
                  condition:
                    switch.is_on: ducoauto
                  then:
                    - fan.turn_on: 
                        id: ducofan
                        speed: 60
          - above: 80
            below: 85
            then:
              - if:
                  condition:
                    switch.is_on: ducoauto
                  then:
                    - fan.turn_on: 
                        id: ducofan
                        speed: 75
          - above: 85
            then:
              - if:
                  condition:
                    switch.is_on: ducoauto
                  then:
                    - fan.turn_on: 
                        id: ducofan
                        speed: 100
      - name: VPD
        id: sensor_vpd
        accuracy_decimals: 2
        internal: True
      - name: DP
        id: sensor_dew_point
        accuracy_decimals: 2
        internal: True

  # SENSOR CONNECTOR 2 - Combination of Senseair S8 & SHT-31 in one Sensor
  - platform: sht3xd
    i2c_id: i2c_sensor_2
    temperature:
      name: "${esp_name} - Sensor 2 - Temperature"
    humidity:
      name: "${esp_name} - Sensor 2 - Humidity"
      icon: mdi:water-percent
    address: 0x44
    update_interval: 30s
  - platform: senseair
    uart_id: uart_sensor_2
      #add sensor UART bus here
    co2:
      name: "${esp_name} - Sensor 2 - CO2"
    update_interval: 30s

  - platform: template
    name: "${esp_name} - Fan Speed"
    lambda: return id(ducofan).speed;
    update_interval: 3s
    unit_of_measurement: "%"
    accuracy_decimals: 0
    icon: mdi:fan

  - platform: copy
    name: "${esp_name} - Sensor 1 - Temperature"
    unit_of_measurement: °C
    accuracy_decimals: 2
    source_id: sensor_temperature
    filters:
      - throttle: 60s
  - platform: copy      
    name: "${esp_name} - Sensor 1 - Humidity"
    unit_of_measurement: "%"
    accuracy_decimals: 2
    icon: mdi:water-percent
    source_id: sensor_humidity
    filters:
      - throttle: 60s
  - platform: copy  
    name: "${esp_name} - Sensor 1 - Vapour-pressure deficit"
    unit_of_measurement: "kPa"
    accuracy_decimals: 2
    icon: mdi:air-humidifier
    source_id: sensor_vpd
    filters:
      - throttle: 60s
  - platform: copy
    name: "${esp_name} - Sensor 1 - Dew point"
    unit_of_measurement: °C
    accuracy_decimals: 2
    icon: mdi:water-thermometer-outline
    source_id: sensor_dew_point
    filters:
      - throttle: 60s

text_sensor:
  - <<: !include includes/include-uptime-human.yaml
  - <<: !include includes/include-esphome-version.yaml
  - <<: !include includes/include-wifi-info.yaml

switch:
  - <<: !include includes/include-generic-restart-switch.yaml

  - platform: template
    name: "${esp_name} - Automatisch"
    id: ducoauto
    optimistic : True
    restore_state: yes
    restore_mode: RESTORE_DEFAULT_ON
    icon: mdi:fan-auto

#https://github.com/Flamingo-tech/Open-AIR/tree/main/Open%20Air%20Mini/Software
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant