Generic_thermostat for Humidity

https://pastebin.com/6R49H1hz

@123
This is a very nice solution. I plan on taking what you have done here and use it for a video where I’m taking a Sonoff SV and building a humidifier control. IE I’m going to flip the ON and OFF command so the device powers when the humidity is low and make new names, but your elegant code will remain.
I’ll credit you and put a link to it here in this post.
Thanks for supporting the more programming-addled among us!

1 Like

https://youtu.be/2bRu4H6qo84
Here is the link to my YouTube video where I use this automation to sucessfully make my Humidistat solution to work!

Could you please share again your automations? Many thanks

Here you go: Ubuntu Pastebin

Card is updated too:

card_mod:
  class: top-level-card
entities:
  - entity: switch.lounge_dehumidifier
    state_color: true
  - entity: script.lounge_dehumidifier_emptied
    state_color: true
  - animation:
      state: 'off'
    columns: '1'
    direction: right
    entities:
      - entity: sensor.lounge_dehumidifier_power
        max: '800'
        min: '0'
        name: Power
        severity:
          - color: '#039BE5'
            from: '0'
            to: '299.9'
          - color: '#0da035'
            from: '300'
            to: '899.9'
          - color: '#e0b400'
            from: '900'
            to: '1799.9'
          - color: '#e45e65'
            from: '1800'
            to: '2400'
    entity_row: true
    height: 28px
    positions:
      icon: inside
      indicator: inside
      minmax: 'off'
      name: inside
      title: 'off'
      value: inside
    type: 'custom:bar-card'
    value_style:
      color: var(--primary-text-color)
      text-shadow: none
  - card_type: 'custom:fold-entity-row'
    entities:
      - entity: automation.lounge_dehumidifier_direct_automation
        state_color: true
      - entity: automation.lounge_dehumidifier_re_enable
        state_color: true
      - entity: input_number.lounge_dehumidifier_condensation_set
      - entity: input_number.lounge_dehumidifier_outside_temp_set
    head:
      label: Direct Automation
      type: section
    padding: 0
    type: 'custom:hui-element'
  - card_type: 'custom:fold-entity-row'
    entities:
      - entity: automation.lounge_dehumidifier_forecast_automation
        state_color: true
      - entity: input_datetime.lounge_dehumidifier_run_time
      - entity: input_number.lounge_dehumidifier_rh_set
      - entity: input_number.lounge_dehumidifier_forecast_temp_set
    head:
      label: Forecast Automation
      type: section
    padding: 0
    type: 'custom:hui-element'
  - card_type: 'custom:fold-entity-row'
    entities:
      - entity: input_boolean.lounge_dehumidifier_mute_for_movie
        state_color: true
      - entity: input_number.lounge_dehumidifier_run_time
    head:
      label: Common Configuration
      type: section
    padding: 0
    type: 'custom:hui-element'
show_header_toggle: false
title: Lounge Dehumidifier
type: entities

It won’t be this way for long. I plan to put an ESP32 in the dehumidifier for direct control and monitoring soon.

Hi i run ESPhome (not tasmota) and i use a relay to switch on and off the humidifier(not dehumidifier). My automation script is not working, can you help me with that? The humidifier needs to turn on when the dht11 sensor reads 45% or lower, and turn off if it reaches more then 52% humidity. For sanity check i need to paste this to the automation.yaml or create a new custom component and a new humidifier.yaml file?
The script:

- id: '*************'
  alias: Humidifier on
  description: ''
  trigger:
  - platform: time_pattern
    minutes: 5
  condition:
  - condition: numeric_state
    entity_id: sensor.humidity
    above: '45'
  - condition: time
    weekday:
    - mon
    - tue
    - wed
    - thu
    - fri
    after: '10:00'
    before: '20:00'
  - condition: state
    entity_id: switch.relay_humidifier
    state: 'off'
  action:
  - type: turn_on
    device_id: *************
    entity_id: switch.relay_humidifier
    domain: switch
  mode: single
- id: '*************'
  alias: Humidifier off
  description: ''
  trigger:
  - platform: time_pattern
    minutes: 5
  condition:
  - condition: numeric_state
    entity_id: sensor.humidity
    above: '52'
  - condition: time
    after: '10:00'
    weekday:
    - mon
    - tue
    - wed
    - thu
    - fri
    before: '20:00'
  - condition: state
    entity_id: switch.relay_humidifier
    state: 'on'
  action:
  - type: turn_off
    device_id: ********************
    entity_id: switch.relay_humidifier
    domain: switch
  mode: single

It turns on and off every 5 minutes… i tested it with 10sec intervals because i didn’t have the time to sit and watch it that long. It works between the two values great but outside of the two value things are different.