ActronConnect
HI ā¦ self confessed Beginner on HA, I have Actron ESP AC unit and the Actron Connect ā¦ seen a few integration options, but hesitant to do DNS redirects suggested elsewhereā¦ could you share the code for this please, one of the things I want to do is tie in the AC control with Power costs, as we will be moving to Amber Electric (wholesale pricing) and I want to Switch off AC when price goes above say 30c /kwā¦
Thanks
Marcus
For those of you wanting to implement a solution with HA but donāt know where to start, I thought Iād share what Iād found in the last few days to make it easier.
Firstly, if you want a very simple solution where you can automate the turning on / off of your Actron air-conditioner, then all you need this (copied from the original post by Keith above for easier reference) in your configuration.yaml:
rest_command:
turn_ac_on:
url: https://que.actronair.com.au/rest/v0/device/ACONNECT{yourSpecificUnit}?user_access_token={yourSpecificUserAccessToken}
method: put
payload: '{"DA": {"amOn": true} }'
content_type: 'application/json; charset=utf-8'
turn_ac_off:
url: https://que.actronair.com.au/rest/v0/device/ACONNECT{yourSpecificUnit}?user_access_token={yourSpecificUserAccessToken}
method: put
payload: '{"DA": {"amOn": false} }'
content_type: 'application/json; charset=utf-8'
set_ac_setpoint:
url: https://que.actronair.com.au/rest/v0/device/ACONNECT{yourSpecificUnit}?user_access_token={yourSpecificUserAccessToken}
method: put
payload: >
{"DA": {"tempTarget":
{{ new_aircon_sp }}
}}
content_type: 'application/json; charset=utf-8'
I didnāt know where to put this until last night when I came across another post.
Once thatās in, customise the {yourSpecificUnit} and {yourSpecificUserAccessToken} with yours and the rest is quite straight forward. You donāt even have to restart Home Assistant, just click to re-load the configuration.yaml.
Now, if you go to create a new button card, you can select the commands from āCall serviceā:
You can also create an automation:
So if thatās all you want to do is automate, thatās it.
If you want to get fancy and pretty much implement the Actron app in Home Assistant, then you need to set up some sensors:
sensor:
- platform: rest
resource: http://{your_HA_IP_address}/6.json
method: GET
name: "AC Inside Temp"
value_template: '{{value_json.roomTemp_oC}}'
unit_of_measurement: "Ā°C"
- platform: rest
resource: http://{your_HA_IP_address}/6.json
method: GET
name: "AC is On"
value_template: '{{value_json.isOn | abs}}'
# you need the 'abs' to convert from boolean value to a '0' or '1'
# You'll need to do the same with 'isInESP_Mode' as well
- platform: rest
resource: http://{your_HA_IP_address}/6.json
method: GET
name: "AC Enabled Zones 0"
value_template: '{{value_json.enabledZones[0]}}'
# enabledZones return an array so this gives you the individual zone's value.
# It returns '0' or '1'
Add this to the configuration.yaml (after the ārest_commandā) and re-load the configuration.yaml file and now if you go to āDeveloper Toolsā and then āStatesā, you can filter by āAC_ā and youāll see these sensors with proper values displayed:
{"isOn":false,"mode":2,"fanSpeed":2,"setPoint":24.5,"roomTemp_oC":27.4,"isInESP_Mode":false,"fanIsCont":0,"compressorActivity":2,"errorCode":"","individualZoneTemperatures_oC":[null,null,null,null,null,null,null,null],"enabledZones":[0,1,1,0,0,0,0,0],"liveTimer":null}
Using the above as examples, you can implement all the sensors in the configuration.yaml file and then create button cards for them.
This is as far as I got so far, with the important thing being able to turn the air con on or off from Home Assistant.
Iāll next find out how to set the temperature value and turn zones on / off (using PUT) but if anyone knows how to, please post a reply.
Hope this is useful to help you guys started.
If you template experts out there can āprettifyā the āsensorā section above, please post your solution - this is my trial and error finding out creating a sensor and when it works, I just duplicate the code, so itās probably very inefficient and untidy.
While all that is very nice and thank you for sharing your code to help others, I have to ask why are you doing it this way? The add-on works and I have full functionality using the add-on.
Which add-on? The one by Mike McGuire?
Like others, I wasnāt comfortable implementing that solution as I still want access to the Actron app for the time being.
Someone said he created a solution using Node-Red but couldnāt uploaded it and I donāt know enough about Node-Red to try it, so Keithās solution seems the easiest to tackle, thatās why I tried to implement it and only just figure out how to put all the code etc mentioned above to work.
If thereās another add-on other than the Mike McGuire one, please let me know. Iām more than happy to use it (more sleep for me)!
Ah ok that makes sense. I havenāt touched the official app since I got it fully working with Home Assistant. I basically donāt use any official app anymore since Home Assistant can do pretty much everything.
Also I hope you didnāt delete your code because of me. Always encourage users to share code to help others
FYI: DNS redirects are very easy to do if you run Pi-Hole.
So youāre using the Mike McGuire one?
I deleted the post because I thought if you already have a solution going then what Iām posting here will be useless.
If you are using the Mike McGuire one, then Iāll undelete it because I guess there are people like me who doesnāt want to lose access to the original app. Actually, for people who may just want to be able to automatically turn on the air con, adding the rest commands in the configuration.yaml is probably still the easiest way.
By the way, is the Mike McGuire add-on easy to implement? I downloaded it and saw that it needed some key or id or something which was one reason it puts me off. I might bite the bullet and give it another go if itās not hard.
Iām ok with DNS redirectsā¦just not familiar with Mosquito (except the real ones) which confuses me.
Its such a steep learning curve with HA. I only have an in-wall unit in my bedroom but I still canāt figure this out lol. Is there a simple guide for what I want to do?
Node Red Flow for Control of Pretty Much Everything Using HA
Sensors used for Node Red Flow
#Actron Connect Sensors #####################################
sensor:
# AC On
- platform: rest
resource: http://192.168.0.126/6.json
method: GET
name: "Template AC On"
scan_interval: 3
value_template: '{{value_json.isOn}}'
# Inside Temp
- platform: rest
resource: http://192.168.0.126/6.json
method: GET
name: "Inside Temp AC"
value_template: '{{ value_json.roomTemp_oC }}'
unit_of_measurement: "Ā°C"
# AC Setpoint
- platform: rest
resource: http://192.168.0.126/6.json
method: GET
name: "AC Current Setpoint"
value_template: '{{ value_json.setPoint }}'
scan_interval: 5
unit_of_measurement: "Ā°C"
# Fan Speed Source Sensor
- platform: rest
resource: http://192.168.0.126/6.json
method: GET
name: "Template Fan Speed"
scan_interval: 5
value_template: '{{ value_json.fanSpeed }}'
unit_of_measurement: ""
# Fan Speed
- platform: template
sensors:
fan_speed:
friendly_name: "Fan Speed"
value_template: >-
{% if is_state('sensor.template_fan_speed', "0") %}
Low
{% elif is_state('sensor.template_fan_speed', "1") %}
Med
{% elif is_state('sensor.template_fan_speed', "2") %}
High
{% endif %}
# Zones
- platform: rest
resource: http://192.168.0.126/6.json
method: GET
name: "Zones"
scan_interval: 3
value_template: '{{ value_json.enabledZones }}'
# Mode Source Sensor
- platform: rest
resource: http://192.168.0.126/6.json
method: GET
name: "Template Mode"
scan_interval: 5
value_template: '{{ value_json.mode }}'
unit_of_measurement: ""
# Mode
- platform: template
sensors:
mode:
friendly_name: "Mode"
value_template: >-
{% if is_state('sensor.template_mode', "0") %}
Auto
{% elif is_state('sensor.template_mode', "1") %}
Heat
{% elif is_state('sensor.template_mode', "2") %}
Cool
{% elif is_state('sensor.template_mode', "3") %}
Fan
{% else %}
Unknown
{% endif %}
# Mode Compressor Sensor
- platform: rest
resource: http://192.168.0.126/6.json
method: GET
name: "Template AC Compressor Activity"
scan_interval: 5
value_template: '{{ value_json.compressorActivity }}'
unit_of_measurement: ""
# AC Compressor Activity
- platform: template
sensors:
ac_compressor:
friendly_name: "AC Compressor"
value_template: >-
{% if is_state('sensor.template_ac_compressor_activity', "0") %}
Heating
{% elif is_state('sensor.template_ac_compressor_activity', "1") %}
Cooling
{% elif is_state('sensor.template_ac_compressor_activity', "2") %}
Off
{% else %}
Unknown
{% endif %}
The code is messy and could be cleaned up by reducing some of the template sensors but it works so no bothered to change it.
Rest Commands to Control Aircon
#ActronConnect Send Commands ###########################################
rest_command:
turn_ac_on:
url: https://que.actronair.com.au/rest/v0/device/your details
method: put
payload: '{"DA": {"amOn": true} }'
content_type: 'application/json; charset=utf-8'
turn_ac_off:
url: https://que.actronair.com.au/rest/v0/device/your details
method: put
payload: '{"DA": {"amOn": false} }'
content_type: 'application/json; charset=utf-8'
set_ac_setpoint:
url: https://que.actronair.com.au/rest/v0/device/your details
method: put
payload: >
{"DA": {"tempTarget":
{{ new_aircon_sp }}
content_type: 'application/json; charset=utf-8'
zones_test:
url: https://que.actronair.com.au/rest/v0/device/your details
method: put
payload: '{"DA": {"amOn": true, "enabledZones" :[0,1,0,0,0,0,0,0]} }'
content_type: 'application/json; charset=utf-8'
# Script for Auto Aircon
heater_auto:
url: https://que.actronair.com.au/rest/v0/device/your details
method: put
payload: '{"DA": {"amOn" : true, "tempTarget": 27.5, "mode": 1, "fanSpeed": 0, "enabledZones": [1,1,0,0,1,1,0,0]} }'
content_type: 'application/json; charset=utf-8'
#Change AC Modes
ac_mode_heat:
url: https://que.actronair.com.au/rest/v0/device/your details
method: put
payload: '{"DA": {"mode": 1} }'
content_type: 'application/json; charset=utf-8'
ac_mode_cool:
url: https://que.actronair.com.au/rest/v0/device/your details
method: put
payload: '{"DA": {"mode": 2} }'
content_type: 'application/json; charset=utf-8'
ac_mode_fan:
url: https://que.actronair.com.au/rest/v0/device/your details
method: put
payload: '{"DA": {"mode": 3} }'
content_type: 'application/json; charset=utf-8'
ac_mode_auto:
url: https://que.actronair.com.au/rest/v0/device/your details
method: put
payload: '{"DA": {"mode": 0} }'
content_type: 'application/json; charset=utf-8'
# Change Fan Speed
fan_speed_low:
url: https://que.actronair.com.au/rest/v0/device/your details
method: put
payload: '{"DA": {"fanSpeed": 0} }'
content_type: 'application/json; charset=utf-8'
fan_speed_med:
url: https://que.actronair.com.au/rest/v0/device/your details
method: put
payload: '{"DA": {"fanSpeed": 1} }'
content_type: 'application/json; charset=utf-8'
fan_speed_high:
url: https://que.actronair.com.au/rest/v0/device/your details
method: put
payload: '{"DA": {"fanSpeed": 2} }'
content_type: 'application/json; charset=utf-8'
# Change Aircon Temp
set_ac_setpoint:
url: https://que.actronair.com.au/rest/v0/device/your details
method: put
payload: >
{"DA": {"tempTarget":
{{ states('input_number.aircon_setpoint') }}
}}
content_type: 'application/json; charset=utf-8'
Iāve made a PlatformIO/ESPHome component that decodes the raw data on the RS485 bus used by the air conditioners that support the ACM-1/2 and ICAMIB-MOD modules.
Itās still work in progress, but I can already control more with this than the ACM-1/Actron Connect integration via ESPHome. Also have found a way to remotely set the individual Ultima zone wall controller temperatures which even the ICAMIB-MOD canāt do.
This is amazing work, good on you mate, I am going to try it out, just need to get the RS485 module, I have got everything else. Is there anything you need help with testing?
Mostly just using/testing with systems other than mine (Platinum Ultima).
Iāve been using it as my main control now (was using the WIFI ACM-1 before with the HA interface from Mike J McGuires), and has been working fine for me.
Sounds good, I am going to order the module and install it.
@awulf having some trouble connecting to the aircon, I am using the A & B pins used for the ACM-2 (blue and white wires in bottom left of board) on the board in the indoor unit since the outdoor unit does have A & B pins.
The code installs on the esp32 and the logs show up, it doesnt connect the aircon:
[22:11:05][C][actron485.climate:226]: Actron485 Status:
[22:11:05][C][actron485.climate:227]: Receiving Data: NO
Please let me know if I have done anything wrong.
RS485 Module:
ESPhome Code:
esphome:
name: ac-remote
friendly_name: ac-remote
platformio_options:
lib_extra_dirs: /config/
libraries:
Actron485
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key:
ota:
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Esphome-Web-68Afb8"
password: "XmUTGWrG0YMJ"
captive_portal:
external_components:
- source:
type: local
path: /config/actron485/components
# Adds fan component per zone (required)
fan:
# UART settings for Actron485 (required)
uart:
rx_pin: GPIO27
tx_pin: GPIO26
baud_rate: 4800
climate:
- platform: actron485
name: "Actron Climate Controller"
write_enable_pin: GPIO25 # Write Enable pin for the RS-485 communication
esp_fan_available: false # For Systems with ESP Auto mode, adds Auto fan mode.
ultima: # For ULTIMA Systems only, adds climate controls per zone.
available: false
adjust_master_target: false # Adjust master target temperature to allow the targeted zone temperature.
logging_mode: CHANGE
zones:
- number: 1
name: Family
- number: 2
name: Alfresco
- number: 3
name: Garage A/C
- number: 4
name: Study & Pantry
- number: 5
name: Bed 1
- number: 6
name: Bed 2
Change to: logging_mode: ALL
This will display all data thatās coming through. Download the logs if and post the resulting data here. If you see nothing at all there is probably something wrong with the connection or that RS485 transceiver isnāt working. As far as I can see from your configuration and wiring setup, itās looking correct.
It may be just the photo, but the RS485 light there is looking very dim like itās not receiving enough power. All mine light up as bright as that LED on the ESP32.
Another thing you can try (if you have one) is sticking an Oscilloscope or Logic analyser at the RO
pin to see if any data is coming through.
Still no luck.
ESPhome code:
esphome:
name: ac-remote
friendly_name: ac-remote
platformio_options:
lib_extra_dirs: /config/
libraries:
Actron485
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
logger:
level: DEBUG
baud_rate: 0 # Disable logging over the serial port
# Enable Home Assistant API
api:
encryption:
key: "**"
ota:
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Esphome-Web-68Afb8"
password: "**"
captive_portal:
external_components:
- source:
type: local
path: /config/actron485/components
# Adds fan component per zone (required)
fan:
# UART settings for Actron485 (required)
uart:
rx_pin: GPIO27
tx_pin: GPIO26
baud_rate: 4800
climate:
- platform: actron485
name: "Actron Climate Controller"
write_enable_pin: GPIO25 # Write Enable pin for the RS-485 communication
esp_fan_available: false # For Systems with ESP Auto mode, adds Auto fan mode.
ultima: # For ULTIMA Systems only, adds climate controls per zone.
available: false
adjust_master_target: false # Adjust master target temperature to allow the targeted zone temperature.
logging_mode: ALL
zones:
- number: 1
name: Family
- number: 2
name: Alfresco
- number: 3
name: Garage A/C
- number: 4
name: Study & Pantry
- number: 5
name: Bed 1
- number: 6
name: Bed 2
LOGS
INFO ESPHome 2023.12.9
INFO Reading configuration /config/esphome/esphome-web-68afb8.yaml...
INFO Starting log output from 192.168.0.225 using esphome API
INFO Successfully connected to ac-remote @ 192.168.0.225 in 0.089s
INFO Successful handshake with ac-remote @ 192.168.0.225 in 0.153s
[14:09:28][I][app:102]: ESPHome version 2023.12.9 compiled on Jan 26 2024, 13:57:10
[14:09:28][C][wifi:573]: WiFi:
[14:09:28][C][wifi:405]: Local MAC: [redacted]
[14:09:28][C][wifi:410]: SSID: [redacted]
[14:09:28][C][wifi:411]: IP Address: 192.168.0.225
[14:09:28][C][wifi:413]: BSSID: [redacted]
[14:09:28][C][wifi:414]: Hostname: 'ac-remote'
[14:09:28][C][wifi:416]: Signal strength: -55 dB āāāā
[14:09:28][C][wifi:420]: Channel: 1
[14:09:28][C][wifi:421]: Subnet: 255.255.255.0
[14:09:28][C][wifi:422]: Gateway: 192.168.0.1
[14:09:28][C][wifi:423]: DNS1: 192.168.0.1
[14:09:28][C][wifi:424]: DNS2: 0.0.0.0
[14:09:28][C][logger:439]: Logger:
[14:09:29][C][logger:440]: Level: DEBUG
[14:09:29][C][logger:441]: Log Baud Rate: 0
[14:09:29][C][logger:443]: Hardware UART: UART0
[14:09:29][C][uart.arduino_esp32:137]: UART Bus 0:
[14:09:29][C][uart.arduino_esp32:138]: TX Pin: GPIO26
[14:09:29][C][uart.arduino_esp32:139]: RX Pin: GPIO27
[14:09:29][C][uart.arduino_esp32:141]: RX Buffer Size: 256
[14:09:29][C][uart.arduino_esp32:143]: Baud Rate: 4800 baud
[14:09:29][C][uart.arduino_esp32:144]: Data Bits: 8
[14:09:29][C][uart.arduino_esp32:145]: Parity: NONE
[14:09:29][C][uart.arduino_esp32:146]: Stop bits: 1
[14:09:29][C][actron485.climate:226]: Actron485 Status:
[14:09:29][C][actron485.climate:227]: Receiving Data: NO
[14:09:29][C][actron485.climate:571]: ClimateTraits:
[14:09:29][C][actron485.climate:572]: [x] Visual settings:
[14:09:29][C][actron485.climate:573]: - Min temperature: 16.0
[14:09:29][C][actron485.climate:574]: - Max temperature: 30.0
[14:09:29][C][actron485.climate:575]: - Temperature step:
[14:09:29][C][actron485.climate:576]: Target: 0.5
[14:09:29][C][actron485.climate:577]: Current: 0.1
[14:09:29][C][actron485.climate:578]: - Min humidity: 30
[14:09:29][C][actron485.climate:579]: - Max humidity: 99
[14:09:29][C][actron485.climate:581]: [x] Supports current temperature
[14:09:29][C][actron485.climate:593]: [x] Supports action
[14:09:29][C][actron485.climate:618]: - Continuous Fan
[14:09:29][C][actron485.climate:618]: - Standard Fan
[14:09:29][C][captive_portal:088]: Captive Portal:
[14:09:29][C][mdns:115]: mDNS:
[14:09:29][C][mdns:116]: Hostname: ac-remote
[14:09:29][C][ota:097]: Over-The-Air Updates:
[14:09:29][C][ota:098]: Address: ac-remote.local:3232
[14:09:29][C][api:139]: API Server:
[14:09:29][C][api:140]: Address: ac-remote.local:6053
[14:09:29][C][api:142]: Using noise encryption: YES