Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ESPHOME DAC 0-10 Valve control
#1
I would like to make a PID control of 2 3-way valves of the HVAC system. The valves have a 0-10V control and are powered by 24VAC.
I saw the example that controls an RGB led, but now ESPHOME has added the "valve" entity. Is it possible to have an example of how to control a 0-10V valve?
https://esphome.io/components/valve/index.html

Thanks
Reply
#2
just use your valve as a dimmer in ESPHome. so can change the speed.
Reply
#3
Hello,
I didn't like managing valves as if they were lights, I also had difficulty using the output on automations.
So I rewrote the code as "number" in %.
See if it can be useful to others.

Code:
esphome:
  name: miscelazione
  friendly_name: miscelazione

  on_boot:
    priority: -10
    then:
    - output.set_level:
        id: dac_valvola1
        level: 1.0  # 100%
    - output.set_level:
        id: dac_valvola2
        level: 0.7  # 70%


substitutions:
  name: miscelazione

# Actions to set initial DAC values on boot

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "xyxyxyxyyxy"

ota:
  platform: esphome
  password: "xyxyyxyxyxy4b"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Miscelazione Fallback Hotspot"
    password: "xyxyxyxyyxyx"
   

captive_portal:

# Web server for diagnostics
web_server:
  port: 80

# Sync time with Home Assistant
time:
  - platform: homeassistant
    id: homeassistant_time

sensor:
  - platform: uptime
    name: Miscelazione Uptime

  - platform: wifi_signal
    name: ${name} WiFi Signal
    update_interval: 60s
    device_class: signal_strength
    unit_of_measurement: dB

output:
  - platform: esp32_dac
    pin: GPIO25
    id: dac_valvola1

  - platform: esp32_dac
    pin: GPIO26
    id: dac_valvola2



# Define custom components to represent the valves
number:
  - platform: template
    name: "Valvola Miscelatrice 1"
    id: valvola1
    min_value: 0.0
    max_value: 100.0
    step: 1.0
    unit_of_measurement: '%'
    icon: "mdi:valve"
    optimistic: true
    set_action:
      then:
        - output.set_level:
            id: dac_valvola1
            level: !lambda "return x / 100.0;"
    initial_value: 100.0

  - platform: template
    name: "Valvola Miscelatrice 2"
    id: valvola2
    min_value: 0.0
    max_value: 100.0
    step: 1.0
    unit_of_measurement: '%'
    icon: "mdi:valve"
    optimistic: true
    set_action:
      then:
        - output.set_level:
            id: dac_valvola2
            level: !lambda "return x / 100.0;"
    initial_value: 70.0

switch:
  - platform: gpio
    pin: GPIO02
    name: "Pompa Piano 1"
    icon: "mdi:pump"
    id: relay1

  - platform: gpio
    pin: GPIO15
    name: "Pompa Piano 2"
    icon: "mdi:pump"
    id: relay2
Reply


Forum Jump:


Users browsing this thread: