So I just got the MCP4725 DAC wired up and getting a lot better results with that vs the inbuilt DAC on my esp32 pretty much have all the DAC voltages locked in now. Restarted the esp32 a couple of times and the DAC voltages appear to work fine vs yesterday were I thought I had th DAC voltages locked in would upload the new esp code and they it would behave differently and I would get a different measured voltage on the keywire.
So definitely think I will stick with the mcp4725.
@brentk in my playing around I may have found out what unk4 is for the in the LCD code it appears to trigger when timmer is flashing on the LCD display I have no idea how I trriggered that but
@lordvorta@brentk -seems that we are taking turns in progressing this
Thank you for the update @lordvorta - I have that DAC too so I will test soon (time permitting).
Could you share your YAML code (with your latest values i it)? Might speed up my testing if I have a starting point that is more similar to my config.
Also did you use the Atom M5 MCP4725 DAC? Can you please share a pic of how you wired it up to the Atom M5?
I actually havenāt done much testing with using the ESP32 built in DAC - got it working then didnāt play with the button commands much. When I tried it again the other day - I found some of the button command werenāt working properly.
Most of the testing I did was with the 4725 DAC - so definitely looks like that is the way to go. I think Iāll probably go back to that.
@Mnm no worries see below the MCP4725 DAC values I used. I am only using a 3.3v input on the MCP4725 so my input max is a bit different to what brentk used when he was using the MCP4725.
There a couple of buttons that I havenāt bothered getting working yet which are the timer and timer up and timer down. Not sure I will bother with getting them working as I canāt see me using them.
I didnāt use an atom m5 I ended up using a DIGISHUO ESP-WROOM-32 that I already had and I am using one of the inbuilt ADC pins on ESP-WROOM-32 for the reading of the data on the keypad power wire.
The MCP4725 is purely used for the voltage to control the transceiver.
I will try and share some photos of the wiring at bit later.
#Setup i2c bus to controll MCP4725
#https://esphome.io/components/i2c#i2c
i2c:
sda: 21
scl: 22
scan: true
#MCP4725 output to Send Voltages for key presses
#https://esphome.io/components/output/mcp4725
output:
- platform: mcp4725
id: dac_output
address: 0x60
# Define a number input component to output mV to the DAC
number:
- platform: template
name: "DAC Output miliVolts"
min_value: 0
max_value: 3300 # Adjust this value according to the DAC's range
step: 1 # Adjust the step size as needed
restore_value: true
optimistic: true
on_value:
then:
lambda: |-
id(dac_output).set_level((x / 3300.0));
button:
- platform: restart
name: Restart
- platform: template
name: "Power"
#Keypad Voltage 0.0 V
on_press:
- logger.log: Power Button Pressed
- lambda: |-
id(dac_output).set_level((3300.0 / 3300.0));
- delay: 800ms
- lambda: |-
id(dac_output).set_level((0.0 / 3300.0));
- platform: template
name: "Fan"
#Keypad Voltage 3.220 V
on_press:
- logger.log: Fan Button Pressed
- lambda: |-
id(dac_output).set_level((690.0 / 3300.0));
- delay: 800ms
- lambda: |-
id(dac_output).set_level((0.0 / 3300.0));
- platform: template
name: "Temp Up"
#Keypad Voltage 1.509 V
on_press:
- logger.log: Temp Up Button Pressed
- lambda: |-
id(dac_output).set_level((779.2/ 3300.0));
- delay: 800ms
- lambda: |-
id(dac_output).set_level((0.0 / 3300.0));
- platform: template
name: "Temp Down"
#Keypad Voltage 2.872 V
on_press:
- logger.log: Temp Down Button Pressed
- lambda: |-
id(dac_output).set_level((713.0/ 3300.0));
- delay: 800ms
- lambda: |-
id(dac_output).set_level((0.0 / 3300.0));
- platform: template
name: "Mode"
#Keypad Voltage 0.452 V
on_press:
- logger.log: Mode Button Pressed
- lambda: |-
id(dac_output).set_level((835.0/ 3300.0));
- delay: 800ms
- lambda: |-
id(dac_output).set_level((0.0 / 3300.0));
- platform: template
name: "Timer"
#Keypad Voltage 0.452 V - Not working yet
on_press:
- logger.log: Timer Button Pressed
- lambda: |-
id(dac_output).set_level((833.0/ 3300.0));
- delay: 800ms
- lambda: |-
id(dac_output).set_level((0.0 / 3300.0));
- platform: template
name: "Timer Up"
#Keypad Voltage 2.234 V - Not working yet
on_press:
- logger.log: Timer Up Button Pressed
- lambda: |-
id(dac_output).set_level((778.0/ 3300.0));
- delay: 800ms
- lambda: |-
id(dac_output).set_level((0.0 / 3300.0));
- platform: template
name: "Timer Down"
#Keypad Voltage 2.530 V - Not working yet
on_press:
- logger.log: Timer Down Button Pressed
- lambda: |-
id(dac_output).set_level((763.0/ 3300.0));
- delay: 800ms
- lambda: |-
id(dac_output).set_level((0.0 / 3300.0));
- platform: template
name: "Zone Down Staris"
#Keypad Voltage 3.650 V
icon: mdi:stairs-down
on_press:
- logger.log: Zone Down Staris Button Pressed
- lambda: |-
id(dac_output).set_level((670.0/ 3300.0));
- delay: 800ms
- lambda: |-
id(dac_output).set_level((0.0 / 3300.0));
- platform: template
name: "Zone Up Staris"
#Keypad Voltage 4.237 V
icon: mdi:stairs-up
on_press:
- logger.log: Zone Up Staris Button Pressed
- lambda: |-
id(dac_output).set_level((630.0/ 3300.0));
- delay: 800ms
- lambda: |-
id(dac_output).set_level((0.0 / 3300.0));
The DAC also has a + and - connection port (the orange connector in the picture)
I am not sure if that is optional, or if I have to use it, where to connect it to.
@brentk could you please let me know how you connected you Atom and DAC together? (assuming you used the same hardware as me).
From the diagram I shared here - You would connect your DAC+ to the header pin 4 (labelled 4:DAC - Atom G25) and DAC- to header pin 3 (labelled 3:0V - Atom GND)
So I have started to have a bit of a play around using the following climate template platform.
With idea to get to look at getting a climate entity created in home assistant that can be used for different automations.
Had a bit of quick play around tonight and have managed to get the climate entity created and it reflects the current mode and current action of cooling, heating,idle etcā¦
This is my current configuration.yaml for the climate entity. Hoping that I can get it so that updating the climate entity will allow for mode changes from cool to heat etcā¦ And also allow for temperature changes to be set via the climate entity and then reflected through to the wall panel.
climate:
- platform: climate_template
name: Actron Aircon
unique_id: actron_aircon
modes:
- "auto"
- "heat"
- "cool"
- "off"
min_temp: 16
max_temp: 30
# get current temp.
current_temperature_template: "{{ states('lumi_lumi_sensor_ht_temperature') }}"
# get target temp
target_temperature_template: "{{ states('sensor.actron_keypad_setpoint_temperature') }}"
# get current humidity.
current_humidity_template: "{{ states('sensor.lumi_lumi_sensor_ht_humidity') }}"
# get current mode
hvac_mode_template: >
{% if is_state('binary_sensor.actron_keypad_heat','on') %}
heat
{% elif is_state('binary_sensor.actron_keypad_cool','on') %}
cool
{% elif is_state('binary_sensor.actron_keypad_auto','on') %}
auto
{% else %}
off
{% endif %}
# get current action
hvac_action_template: >
{% if is_state('binary_sensor.actron_keypad_heat','on') and is_state('binary_sensor.actron_keypad_run','on') %}
heating
{% elif is_state('binary_sensor.actron_keypad_cool','on') and is_state('binary_sensor.actron_keypad_run','on') %}
cooling
{% elif is_state('binary_sensor.actron_keypad_run','off') %}
idle
{% endif %}}
This looks good. I had considered trying to create a climate entity in esphome - but didnāt get a chance to explore further. (havenāt spent much time on this since I initially got mine working with the bare basics)
Iāve been following along here and on whirlpool for a while and finally have time over the christmas break to get into to. Just wondering what the latest is on the parts I need? Some of the discussion suggests the ESP onboard DAC wasnāt as good as an external but I canāt see a scehmatic for this setup so wondering if external is the way to go and if so how to wire that up?
I was also looking at some of the code and wondering of the unknowns on the keypad could be related to ESP mode? I couldnt see anything in there to detect that mode
So I have finally got a pretty functional climate entity now. Can turn the aircon on off and set the temperature via the climate entity and it will update the wall panel to the correct temperatue, mode, fan speed etcā¦
It has taken a little bit of mucking around to get it working and I am sure there are some better ways to get this going but hey it works!
My working configurations are below if any one else wanted to try them out.
Needs this template climate installed via HACS
configuration.yaml
number:
aircon_climate_temp:
name: "Aircon Temp"
min: 16
max: 32
step: 0.5
mode: slider
unit_of_measurement: "Ā°C"
icon: mdi:thermometer
climate:
- platform: climate_template
name: Actron Aircon
unique_id: actron_aircon
# Supported HVAC Modes
modes:
- "auto"
- "heat"
- "cool"
- "off"
min_temp: 16
max_temp: 32
# List of Supported Fan Modes
fan_modes:
- "low"
- "medium"
- "high"
- "low continuos"
- "medium continuos"
- "high continuos"
- "off"
# Get Device Status
#availability_template:
# Get Current Temp
# External Temp Sensor
current_temperature_template: "{{ states('sensor.lumi_lumi_sensor_ht_temperature') }}"
# Get Target Temp
target_temperature_template: "{{ states('input_number.aircon_climate_temp') }}"
# Get Current Humidity
current_humidity_template: "{{ states('sensor.lumi_lumi_sensor_ht_humidity') }}"
# Get Current HVAC Mode
hvac_mode_template: >
{% if is_state('binary_sensor.actron_keypad_heat','on') and is_state('binary_sensor.actron_keypad_auto','off')%}
heat
{% elif is_state('binary_sensor.actron_keypad_cool','on') and is_state('binary_sensor.actron_keypad_auto','off')%}
cool
{% elif is_state('binary_sensor.actron_keypad_auto','on') %}
auto
{% else %}
off
{% endif %}
# Get Current HVAC Action
hvac_action_template: >
{% if is_state('binary_sensor.actron_keypad_heat','on') and is_state('binary_sensor.actron_keypad_run','on') %}
heating
{% elif is_state('binary_sensor.actron_keypad_cool','on') and is_state('binary_sensor.actron_keypad_run','on') %}
cooling
{% elif is_state('binary_sensor.actron_keypad_run','off') %}
idle
{% endif %}
# Get Current Fan Mode
fan_mode_template: >
{% if is_state('binary_sensor.actron_keypad_fan_low','on') and is_state('binary_sensor.actron_keypad_fan_continuos','off')%}
low
{% elif is_state('binary_sensor.actron_keypad_fan_mid','on') and is_state('binary_sensor.actron_keypad_fan_continuos','off')%}
medium
{% elif is_state('binary_sensor.actron_keypad_fan_high','on') and is_state('binary_sensor.actron_keypad_fan_continuos','off')%}
high
{% elif is_state('binary_sensor.actron_keypad_fan_low','on') and is_state('binary_sensor.actron_keypad_fan_continuos','on')%}
low continuos
{% elif is_state('binary_sensor.actron_keypad_fan_mid','on') and is_state('binary_sensor.actron_keypad_fan_continuos','on')%}
medium continuos
{% elif is_state('binary_sensor.actron_keypad_fan_high','on') and is_state('binary_sensor.actron_keypad_fan_continuos','on')%}
high continuos
{% else %}
off
{% endif %}
# Set the HVAC Temp Steps
temp_step: 0.5
# Set HAVC Mode
set_hvac_mode:
- choose:
# On Climate Entity Change to Cool Run The Follow Script to Change Keypad State
- conditions:
- condition: template
value_template: "{{ hvac_mode == 'cool' }}"
sequence:
if:
- condition: state
entity_id: binary_sensor.actron_keypad_cool
state: "on"
then:
service: logbook.log
data:
name: Climate Status
entity_id: climate.actron_aircon
message: Already set to cool!
else:
repeat:
sequence:
- service: button.press
entity_id: button.actron_keypad_mode
- delay:
milliseconds: 500
until:
- condition: state
entity_id: binary_sensor.actron_keypad_cool
state: "on"
# On Climate Entity Change to Heat Run The Follow Script to Change Keypad State
- conditions:
- condition: template
value_template: "{{ hvac_mode == 'heat' }}"
sequence:
if:
- condition: state
entity_id: binary_sensor.actron_keypad_heat
state: "on"
then:
service: logbook.log
data:
name: Climate Status
entity_id: climate.actron_aircon
message: Already set to heat!
else:
repeat:
sequence:
- service: button.press
entity_id: button.actron_keypad_mode
- delay:
milliseconds: 500
until:
- condition: state
entity_id: binary_sensor.actron_keypad_heat
state: "on"
# On Climate Entity Change to Auto Run The Follow Script to Change Keypad State
- conditions:
- condition: template
value_template: "{{ hvac_mode == 'auto' }}"
sequence:
if:
- condition: state
entity_id: binary_sensor.actron_keypad_auto
state: "on"
then:
service: logbook.log
data:
name: Climate Status
entity_id: climate.actron_aircon
message: Already set to auto!
else:
repeat:
sequence:
- service: button.press
entity_id: button.actron_keypad_mode
- delay:
milliseconds: 500
until:
- condition: state
entity_id: binary_sensor.actron_keypad_auto
state: "on"
# On Climate Entity Change to Off Run The Follow Script to Change Keypad State
- conditions:
- condition: template
value_template: "{{ hvac_mode == 'off' }}"
- condition: and
conditions:
condition: state
entity_id: binary_sensor.actron_aircon_on_off_state
state: "on"
sequence:
- service: button.press
entity_id: button.actron_keypad_power
# Set Temperatue:
set_temperature:
- service: input_number.set_value
data:
value: "{{ temperature }}"
target:
entity_id: input_number.aircon_climate_temp
# Set Fan Mode
set_fan_mode:
- choose:
- conditions:
- condition: template
value_template: "{{ fan_mode == 'low' }}"
- condition: and
conditions:
condition: template
value_template: "{{ is_state('binary_sensor.actron_aircon_on_off_state', 'on') }}"
sequence:
repeat:
sequence:
- service: button.press
entity_id: button.actron_keypad_fan
- delay:
milliseconds: 500
until:
- condition: state
entity_id: binary_sensor.actron_keypad_fan_low
state: "on"
- condition: and
conditions:
condition: state
entity_id: binary_sensor.actron_keypad_fan_continuos
state: "off"
- conditions:
- condition: template
value_template: "{{ fan_mode == 'medium' }}"
- condition: and
conditions:
condition: template
value_template: "{{ is_state('binary_sensor.actron_aircon_on_off_state', 'on') }}"
sequence:
repeat:
sequence:
- service: button.press
entity_id: button.actron_keypad_fan
- delay:
milliseconds: 500
until:
- condition: state
entity_id: binary_sensor.actron_keypad_fan_mid
state: "on"
- condition: and
conditions:
condition: state
entity_id: binary_sensor.actron_keypad_fan_continuos
state: "off"
- conditions:
- condition: template
value_template: "{{ fan_mode == 'high' }}"
- condition: and
conditions:
condition: template
value_template: "{{ is_state('binary_sensor.actron_aircon_on_off_state', 'on') }}"
sequence:
repeat:
sequence:
- service: button.press
entity_id: button.actron_keypad_fan
- delay:
milliseconds: 500
until:
- condition: state
entity_id: binary_sensor.actron_keypad_fan_high
state: "on"
- condition: and
conditions:
condition: state
entity_id: binary_sensor.actron_keypad_fan_continuos
state: "off"
- conditions:
- condition: template
value_template: "{{ fan_mode == 'low continuos' }}"
- condition: and
conditions:
condition: template
value_template: "{{ is_state('binary_sensor.actron_aircon_on_off_state', 'on') }}"
sequence:
repeat:
sequence:
- service: button.press
entity_id: button.actron_keypad_fan
- delay:
milliseconds: 500
until:
- condition: state
entity_id: binary_sensor.actron_keypad_fan_low
state: "on"
- condition: and
conditions:
condition: state
entity_id: binary_sensor.actron_keypad_fan_continuos
state: "on"
- conditions:
- condition: template
value_template: "{{ fan_mode == 'medium continuos' }}"
- condition: and
conditions:
condition: template
value_template: "{{ is_state('binary_sensor.actron_aircon_on_off_state', 'on') }}"
sequence:
repeat:
sequence:
- service: button.press
entity_id: button.actron_keypad_fan
- delay:
milliseconds: 500
until:
- condition: state
entity_id: binary_sensor.actron_keypad_fan_mid
state: "on"
- condition: and
conditions:
condition: state
entity_id: binary_sensor.actron_keypad_fan_continuos
state: "on"
- conditions:
- condition: template
value_template: "{{ fan_mode == 'high continuos' }}"
- condition: and
conditions:
condition: template
value_template: "{{ is_state('binary_sensor.actron_aircon_on_off_state', 'on') }}"
sequence:
repeat:
sequence:
- service: button.press
entity_id: button.actron_keypad_fan
- delay:
milliseconds: 500
until:
- condition: state
entity_id: binary_sensor.actron_keypad_fan_high
state: "on"
- condition: and
conditions:
condition: state
entity_id: binary_sensor.actron_keypad_fan_continuos
state: "on"
I also created a binary helper sensor named ābinary_sensor.actron_aircon_on_off_stateā with the following template. This is to just check if the aircon unit is on or off.
{% if is_state('binary_sensor.actron_keypad_heat','on') or is_state('binary_sensor.actron_keypad_cool','on') or is_state('binary_sensor.actron_keypad_auto','on') %}
on
{% else %}
off
{% endif %}
And I have also created the following automation that presses the required buttons when the climate entity temperate changes.
@brentk or @lordvorta sorry I need more help (havenāt done much circuit design/soldering since high school and apparently Iām a bit rusty)
All my parts have arrived and Iām triple checking the circuit diagram and also looking at the phot lordvorta posted earlier Actron Aircon / ESP32 Controller Help - #69 by lordvorta
Iām trying to make sure I wire everything to my ESP32 devkit correctly and looking at the circuit diagram and the notes in the bottom corner I have these pins
1: +5v - VIN (i think?)
2: 0v - GND
3: SCL - D22
4: SDA - D21
5: G33 - D33
6: VOUT - ??
7: Key - ??
8: G32 - not required as above
I also wanted to confirm that while Iām leaving out R4, R5 and the connection to G32 that I need to connect the Key pin from the wall controller to GND on the ESP32?
@Breddo This is a simplified version of the circuit which includes the DAC but removes R4 & R5 - you definitely donāt want to connect Key to GND.
J2 connects to the relevant pind on your ESP32 - pin numbers will depend on model used.
@lordvorta Thatās a nice looking set up! What do you power it with, there seems to be some sort of a plug in the usb socket, is that an elbow and where is it going?
I wonder if it would be possible to power from the
Iām also looking to automate a few things, and I wonder what your take on this is since youāve made a pretty good progress with the climate entity.
My AC unit has 2 sensors (basically one per floor) and 8 rooms / zones. Half of rooms takes temps from one sensor and the other half takes temps the other sensor.
The point is, many rooms and not enough sensors.
What I want to do is an automation that would allow me to set up a ātargetā temperature for each room individually and monitor a specific temp sensor assigned to it in HA (each room will have a separate temp sensor connected to HA). So when AC is ON it would automatically switch rooms on or off depending on the HA sensor data and HA individual target temps and not the actual Actron one-per-whole-house temps (which it would technically do by setting the AC target temp to the lowest of all rooms in the cool mode and to the highest target temp of all rooms in the heat mode).
Do you reckon it is achievable in HA at all or should I be looking to put that into the firmware?