I was using a power monitoring smart plug to turn my dehumidifier on and off but decided to make it a bit smarter. I wanted full control of all the functions and feedback of all the states (including the FULL tank alert).
After a bit of poking about with a multimeter on the display board I found that the logic was 5V CMOS, which is excellent as this is compatible with 3.3V TTL that the ESP boards use.
The switches were a different matter. They worked on shorting segments of a resistive ladder. So five open collector output drivers were made up on Veroboard using GP BJTs.
There were just enough GPIOs on an ESP32 mini board (making sure not to use GPIOs that can interfere with the boot process).
Display board fitted back in the dehumidifier:
Plenty of room for the ESP:
Result:
Custom button card:
Initially I was using template text sensors in ESPHome but found I had to use an update interval of at least a second. I donât like spamming my network with this sort of traffic so I changed the binary sensor ids to names so they would show up in home assistant (states only sent on change) and made some template sensors in home assistant.
The switches were configured in ESPHome to turn themselves off as they are momentary switches.
ESPHome config:
esphome:
name: lounge-dehumidifier-conrol
platform: ESP32
board: mhetesp32minikit
wifi:
ssid: 'WAPLO'
password: !secret wifi_pwd
manual_ip:
static_ip: 10.1.1.195
gateway: 10.1.1.1
subnet: 255.255.255.0
api:
encryption:
key: !secret api_encryption_key
logger:
ota:
password: !secret esp_pwd
binary_sensor:
- platform: status
name: "Lounge Dehumidifier Control Status"
- platform: gpio
name: Lounge Dehumidifier Check
pin:
number: GPIO36
- platform: gpio
name: Lounge Dehumidifier Full
pin:
number: GPIO39
- platform: gpio
name: lounge_dehumidifier_auto_mode
pin:
number: GPIO35
- platform: gpio
name: lounge_dehumidifier_low_mode
pin:
number: GPIO33
- platform: gpio
name: lounge_dehumidifier_high_mode
pin:
number: GPIO34
- platform: gpio
name: lounge_dehumidifier_saving
pin:
number: GPIO32
mode: INPUT_PULLDOWN
- platform: gpio
name: lounge_dehumidifier_turbo
pin:
number: GPIO27
mode: INPUT_PULLDOWN
- platform: gpio
name: lounge_dehumidifier_up
pin:
number: GPIO26
mode: INPUT_PULLDOWN
- platform: gpio
name: lounge_dehumidifier_front
pin:
number: GPIO25
mode: INPUT_PULLDOWN
- platform: gpio
name: lounge_dehumidifier_wide
pin:
number: GPIO23
mode: INPUT_PULLDOWN
- platform: gpio
name: lounge_dehumidifier_2h
pin:
number: GPIO22
mode: INPUT_PULLDOWN
- platform: gpio
name: lounge_dehumidifier_4h
pin:
number: GPIO21
mode: INPUT_PULLDOWN
- platform: gpio
name: lounge_dehumidifier_8h
pin:
number: GPIO19
mode: INPUT_PULLDOWN
button:
- platform: output
name: 'Lounge Dehumidifier On/Off'
output: on_off
icon: "mdi:power"
duration: 500ms
- platform: output
name: 'Lounge Dehumidifier Dry Mode'
output: dry_mode
icon: "mdi:air-filter"
duration: 500ms
- platform: output
name: 'Lounge Dehumidifier Laundry Mode'
output: laundry_mode
icon: "mdi:tshirt-crew"
duration: 500ms
- platform: output
name: 'Lounge Dehumidifier Swing'
output: swing
icon: "mdi:arrow-top-right-bottom-left"
duration: 500ms
- platform: output
name: 'Lounge Dehumidifier Timer'
output: timer
icon: "mdi:timer-outline"
duration: 500ms
output:
- platform: gpio
pin: GPIO18
id: on_off
- platform: gpio
pin: GPIO17
id: dry_mode
- platform: gpio
pin: GPIO16
id: laundry_mode
- platform: gpio
pin: GPIO13
id: swing
- platform: gpio
pin: GPIO4
id: timer
sensor:
- platform: wifi_signal
name: "Lounge Dehumidifier Control WiFi Signal"
update_interval: 15s
filters:
- sliding_window_moving_average:
window_size: 15
send_every: 15
send_first_at: 1
icon: mdi:wifi
switch:
- platform: restart
name: "Lounge Dehumidifier Control Restart"
Home Assistant template sensors:
template:
- sensor:
- name: "Lounge Dehumidifier Dry Mode"
unique_id: faabb2ad-3b63-4258-b81c-47efa5abff5a
icon: "mdi:air-filter"
state: >
{% if is_state('binary_sensor.lounge_dehumidifier_auto_mode', 'on') %}
Auto
{% elif is_state('binary_sensor.lounge_dehumidifier_low_mode', 'on') %}
Low
{% elif is_state('binary_sensor.lounge_dehumidifier_high_mode', 'on') %}
High
{% else %}
Off
{% endif %}
- name: "Lounge Dehumidifier Laundry Mode"
unique_id: a12cd9ba-44c9-4134-9c2b-982b297ea3db
icon: "mdi:tshirt-crew"
state: >
{% if is_state('binary_sensor.lounge_dehumidifier_saving', 'on') %}
Saving
{% elif is_state('binary_sensor.lounge_dehumidifier_turbo', 'on') %}
Turbo
{% else %}
Off
{% endif %}
- name: "Lounge Dehumidifier Swing"
unique_id: b33687a9-ad54-4983-a2fe-989e12943db5
icon: "mdi:arrow-top-right-bottom-left"
state: >
{% if is_state('binary_sensor.lounge_dehumidifier_up', 'on') %}
Up
{% elif is_state('binary_sensor.lounge_dehumidifier_front', 'on') %}
Front
{% elif is_state('binary_sensor.lounge_dehumidifier_wide', 'on') %}
Wide
{% else %}
Off
{% endif %}
- name: "Lounge Dehumidifier Timer"
unique_id: 7d5e630f-59da-41ee-8e94-c46b19556e42
icon: "mdi:timer-outline"
state: >
{% if is_state('binary_sensor.lounge_dehumidifier_2h', 'on') %}
2 Hours
{% elif is_state('binary_sensor.lounge_dehumidifier_4h', 'on') %}
4 Hours
{% elif is_state('binary_sensor.lounge_dehumidifier_8h', 'on') %}
8 Hours
{% else %}
Off
{% endif %}
And a template switch:
- platform: template
switches:
lounge_dehumidifier_power:
friendly_name: Lounge Deumidifier
unique_id: c916928d-5009-458d-886c-68ffe5646471
value_template: >-
{{ not ( is_state('sensor.lounge_dehumidifier_dry_mode', 'Off') and
is_state('sensor.lounge_dehumidifier_laundry_mode', 'Off') and
is_state('binary_sensor.lounge_dehumidifier_full', 'off')) }}
turn_on:
- choose:
- conditions:
- condition: state
entity_id: switch.lounge_dehumidifier_power
state: 'off'
sequence:
- service: button.press
entity_id: button.lounge_dehumidifier_on_off
turn_off:
- choose:
- conditions:
- condition: state
entity_id: switch.lounge_dehumidifier_power
state: 'on'
sequence:
- service: button.press
entity_id: button.lounge_dehumidifier_on_off
availability_template: >-
{{ not ( is_state('sensor.lounge_dehumidifier_dry_mode', 'unavailable') or
is_state('sensor.lounge_dehumidifier_laundry_mode', 'unavailable') or
is_state('binary_sensor.lounge_dehumidifier_full', 'unavailable')) }}
icon_template: >
{% if is_state('switch.lounge_dehumidifier_power', 'on') %}
mdi:air-humidifier
{% else %}
mdi:air-humidifier-off
{% endif %}
Button Card:
entities:
- card_type: horizontal-stack
cards:
- entity: switch.lounge_dehumidifier_power
name: Power
template: switch_button
type: custom:button-card
- color_type: blank-card
type: custom:button-card
- color_type: blank-card
type: custom:button-card
- color_type: blank-card
type: custom:button-card
type: custom:hui-element
- card_type: horizontal-stack
cards:
- entity: sensor.lounge_dehumidifier_dry_mode
template: dehum_button
tap_action:
action: call-service
service: button.press
service_data:
entity_id: button.lounge_dehumidifier_dry_mode
type: custom:button-card
- entity: sensor.lounge_dehumidifier_laundry_mode
template: dehum_button
tap_action:
action: call-service
service: button.press
service_data:
entity_id: button.lounge_dehumidifier_laundry_mode
type: custom:button-card
- entity: sensor.lounge_dehumidifier_swing
template: dehum_button
tap_action:
action: call-service
service: button.press
service_data:
entity_id: button.lounge_dehumidifier_swing
type: custom:button-card
- entity: sensor.lounge_dehumidifier_timer
template: dehum_button
tap_action:
action: call-service
service: button.press
service_data:
entity_id: button.lounge_dehumidifier_timer
type: custom:button-card
type: custom:hui-element
show_header_toggle: false
title: Lounge Dehumidifier
type: entities
Button Card Template:
button_card_templates:
dehum_button:
aspect_ratio: 4/3
color_type: icon
hold_action:
action: more-info
haptic: selection
show_label: false
show_name: true
show_state: true
state:
- styles:
card:
- border: solid 1px var(--primary-color)
- box-shadow: none
icon:
- color: var(--button-card-light-color)
value: 'Off'
- icon: 'mdi:alert'
label: Lost
styles:
card:
- border: 'solid 1px #7f7f7f'
- box-shadow: none
icon:
- color: '#ff0000'
- opacity: 0.6
label:
- color: '#7f7f7f'
name:
- color: '#7f7f7f'
value: unavailable
styles:
card:
- border: solid 1px var(--paper-item-icon-active-color)
- box-shadow: 0px 0px 10px 3px var(--paper-item-icon-active-color)
- border-radius: 10px
- padding: 6px 6px 6px 6px
- margin: 0% 0% 0% 0%
- '--ha-card-background': 'rgba(0, 0, 0, 0)'
grid:
- grid-template-areas: '"i s s" "n n n"'
- grid-template-rows: 33% auto
- grid-template-columns: 33% auto
icon:
- color: var(--paper-item-icon-active-color)
- width: 28px
- padding: 0px 0px 0px 0px
name:
- justify-self: middle
- align-self: end
- font-size: 14px
- padding: 0px 0px 0px 0px
- color: var(--primary-text-color)
- white-space: normal
state:
- font-size: 12px
- justify-self: right
- padding: 0px 0px 0px 0px
- color: var(--secondary-text-color)
Wiring:
Function Colour GPIO
+5 Red VCC
Gnd Black GND
Check Brown 1 39
Full Brown 2 36
Auto Orange 1 35
High Orange 2 34
Low Orange 3 33
Saving Purple 1 32
Turbo Purple 2 27
Up White 1 26
Front White 2 25
Wide White 3 23
2H Yellow 1 22
4H Yellow 2 21
8H Yellow 3 19
On/Off Blue 0 18
Dry Mode Blue 1 17
Laundry Mode Blue 2 16
Swing Blue 3 13
Timer Blue 4 4
EDIT: Updated to use ESPHome Template buttons.