Automate Alorair Sentinel HD55 dehumidifier

hey so 123 Humidity D1 Control D4 D5 D6 D7 is confusing me

where 123 is the frame id
D1 = Humidity
D2 = what?
D3 = what?
D4…D7 = empty

Can you explain what you put in D2 and D3 in your code?

ok made more progress

Continuous does NOT work

Everything else does…but consider this fresh off the code presses :stuck_out_tongue:

switch:
  - platform: template
    name: Continuous Mode
    id: continuous_mode_enable
    lambda: |-
      if (id(continuous).state) {
        return true;
      } else {
        return false;
      }
    turn_on_action:
      - canbus.send:
          data: [ 0xA4, 0x00, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00 ]
          can_id: 0x123
    turn_off_action:
      - canbus.send:
          data: [ 0xB7, 0x00, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00 ]
          can_id: 0x123

  - platform: template
    name: Drain Pump
    id: drain_pump
    restore_mode: ALWAYS_OFF
    lambda: |-
      if (id(draining).state) {
        return true;
      } else {
        return false;
      }
    turn_on_action:
      - canbus.send:
          data: [ 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00 ]
          can_id: 0x123
    turn_off_action:
      - canbus.send:
          data: [ 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00 ]
          can_id: 0x123

  - platform: template
    name: Enable Dehumidifier
    id: enable_dehumid
    restore_mode: ALWAYS_ON
    lambda: |-
      if (id(power).state) {
        return true;
      } else {
        return false;
      }
    turn_on_action:
      - canbus.send:
          data: [ 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 ]
          can_id: 0x123
    turn_off_action:
      - canbus.send:
          data: [ 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 ]
          can_id: 0x123

number:
  - platform: template
    name: Set Point
    min_value: 20
    max_value: 99
    step: 1
    set_action: 
      then:
        - lambda: |-
            x = x + 128;
            uint32_t 	can_id = 0x123;
            bool 	use_extended_id = 0;
            std::vector< uint8_t > data{ x, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
            id(my_mcp2515)->send_data(can_id, use_extended_id, data);
    lambda: return(id(humidity_setpoint).state);
            
1 Like

This might be a bit off-topic, but do any of you have tips on figuring out the CAN ID for my model (HD35P)? I’ve tried the 0x123 examples in this post and am guessing a few other random IDs for testing. No luck.

I have a LilyGo TCAN485 and am considering purchasing the remote to see if I can sniff its activity. However, I’m unsure about what additional equipment I might need beyond the TCAN, and a RJ45 Break out.

Suggestions appreciated!

From the dehumidifier TO the remote older designed models use CAN ID 0x3b0

this is just conjecture - if you look at the website they sell 2 remotes; one for a group of models and from what I can tell a newer one that does that older format and the newer one I am seeing in my code above.

I have another unit that I think uses the older format - I am still hacking it. My guess is that the newer remote gets some info or even just sends both types and sees what happens. Not too hard to imagine that code…

I did notice there were two remotes, and my model is on the “toovem” one. I will order one and see what I can capture from its output.

Do you know of a way to have the logger.log grab any can frame? The on_frame: component requires a can_id, and I’ve not found a way to see anything that comes across. The posts I’ve found a post about setting the can_id to 0 and mask_id to 0, but it notes this no longer works as of 2024.

Here’s my latest config for a sanity check.

substitutions:
  name: esphome-web-67d480
  friendly_name: HD35P

esphome:
  name: ${name}
  friendly_name: ${friendly_name}
  min_version: 2024.6.0
  name_add_mac_suffix: false
  project:
    name: esphome.web
    version: '1.0'

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: !secret api_key
# Allow Over-The-Air updates
ota:
- platform: esphome

# Allow provisioning Wi-Fi via serial
improv_serial:

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

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "HD35P Fallback Hotspot"
    password: !secret wifi_password

# In combination with the `ap` this allows the user
# to provision wifi credentials to the device via WiFi AP.
captive_portal:

dashboard_import:
  package_import_url: github://esphome/example-configs/esphome-web/esp32.yaml@main
  import_full_config: true

# Sets up Bluetooth LE (Only on ESP32) to allow the user
# to provision wifi credentials to the device.
esp32_improv:
  authorizer: none

# To have a "next url" for improv serial
web_server:

light:
  - platform: neopixelbus
    id: neopixel
    type: GRB
    variant: WS2812
    pin: GPIO04
    num_leds: 1
    name: "Status LED"
    on_turn_on: 
      - light.turn_on:
          id: neopixel
          brightness: 50%
          red: 100%
          green: 0%
          blue: 0%    
        
    
          

    restore_mode:
      RESTORE_DEFAULT_ON 



# https://tinymicros.com/wiki/AlorAir_Sentinel_HD55_Dehumidifier
# https://community.home-assistant.io/t/automate-alorair-sentinel-hd55-dehumidifier/306084/23
canbus:
  - platform: esp32_can
    tx_pin: GPIO27
    rx_pin: GPIO26
    can_id: 0x05
    bit_rate: 50kbps
      #also tried bit_rate: 125kbps
    use_extended_id: false
    on_frame:
      # also tried 0x120 - 0x130
    - can_id: 0x123 
      then:
      - logger.log:
          format: "%02x %02x %02x %02x %02x %02x %02x %02x"
          args: [ 'x[0]', 'x[1]', 'x[2]', 'x[3]', 'x[4]', 'x[5]', 'x[6]', 'x[7]' ]
      - sensor.template.publish:
          id: humidity_actual
          state: !lambda 'return x[0];'
      - sensor.template.publish:
          id: humidity_setpoint
          state: !lambda 'return x[1];'
      - sensor.template.publish:
          id: byte_2
          state: !lambda 'return x[2];'
      - sensor.template.publish:
          id: temperature
          state: !lambda 'return x[3];'
      - sensor.template.publish:
          id: byte_4
          state: !lambda 'return x[4];'
      - sensor.template.publish:
          id: byte_5
          state: !lambda 'return x[5];'
      - binary_sensor.template.publish:
          id: draining
          state: !lambda 'return (x[5] & 0x10) == 0x10;'
      - sensor.template.publish:
          id: byte_6
          state: !lambda 'return x[6];'
      - sensor.template.publish:
          id: byte_7
          state: !lambda 'return x[7];'
    - can_id: 0x3b0
      then:
      - logger.log:
          format: "%02x %02x %02x %02x %02x %02x %02x %02x"
          args: [ 'x[0]', 'x[1]', 'x[2]', 'x[3]', 'x[4]', 'x[5]', 'x[6]', 'x[7]' ]
      - sensor.template.publish:
          id: humidity_actual
          state: !lambda 'return x[0];'
      - sensor.template.publish:
          id: humidity_setpoint
          state: !lambda 'return x[1];'
      - sensor.template.publish:
          id: byte_2
          state: !lambda 'return x[2];'
      - sensor.template.publish:
          id: temperature
          state: !lambda 'return x[3];'
      - sensor.template.publish:
          id: byte_4
          state: !lambda 'return x[4];'
      - sensor.template.publish:
          id: byte_5
          state: !lambda 'return x[5];'
      - binary_sensor.template.publish:
          id: draining
          state: !lambda 'return (x[5] & 0x10) == 0x10;'
      - sensor.template.publish:
          id: byte_6
          state: !lambda 'return x[6];'
      - sensor.template.publish:
          id: byte_7
          state: !lambda 'return x[7];'
           

interval:
  - interval: 5s
    then:
      - canbus.send:
          data: [ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ]
          can_id: 0x123
  - interval: 6s
    then:
      - canbus.send:
          data: [ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ]
          can_id: 0x3b0

sensor:
  # Uptime sensor.
  - platform: uptime
    name: Uptime
    disabled_by_default: true

  # WiFi Signal sensor.
  - platform: wifi_signal
    name: WiFi Signal
    update_interval: 60s
    disabled_by_default: true

  - platform: template
    name: Humidity
    id: humidity_actual
    accuracy_decimals: 0
    unit_of_measurement: "%"
    device_class: "humidity"
    state_class: "measurement"
  - platform: template
    name: Humidity Setpoint
    id: humidity_setpoint
    accuracy_decimals: 0
    unit_of_measurement: "%"
    device_class: "humidity"
    state_class: "measurement"
  - platform: template
    name: Temperature
    id: temperature
    accuracy_decimals: 0
    unit_of_measurement: "°C"
    device_class: "temperature"
    state_class: "measurement"

  - platform: template
    name: Byte 2
    id: byte_2
    accuracy_decimals: 0
  - platform: template
    name: Byte 4
    id: byte_4
    accuracy_decimals: 0
  - platform: template
    name: Byte 5
    id: byte_5
    accuracy_decimals: 0
  - platform: template
    name: Byte 6
    id: byte_6
    accuracy_decimals: 0
  - platform: template
    name: Byte 7
    id: byte_7
    accuracy_decimals: 0

binary_sensor:
  - platform: template
    name: Draining
    id: draining

There is a small amount of progress today. The remote arrived, and I rigged up the TCAN between the remote and HD35P.

I still don’t see consistent data, but once, only on a re-flash, I’ll get a single block of data on 0x123. Most of the time, it’s bad data. I.E., temperature at 108 and humidity at 1%, but once or twice, I got accurate data.

I’ve tried a few different canbus.send configurations trying to figure out what is causing that initial send, but no luck yet. :melting_face:

[15:13:56][D][wifi:481]: Starting scan...
[15:13:56][D][sensor:094]: 'Uptime': Sending state 0.28400 s with 0 decimals of accuracy
[15:13:56][D][esp32.preferences:114]: Saving 1 preferences to flash...
[15:13:56][D][esp32.preferences:143]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed
[15:13:56][D][canbus:035]: send standard id=0x3b0 rtr=FALSE size=8
[15:13:56][W][component:157]: Component wifi set Warning flag: scanning for networks
[15:13:56][D][canbus:072]: received can message (#1) std can_id=0x123 size=8
[15:13:56][D][main:575]: 01 00 00 2b 1a 00 00 00
[15:13:56][D][sensor:094]: 'Humidity': Sending state 1.00000 % with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Humidity Setpoint': Sending state 0.00000 % with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Byte 2': Sending state 0.00000  with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Temperature': Sending state 43.00000 °C with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Byte 4': Sending state 26.00000  with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Byte 5': Sending state 0.00000  with 0 decimals of accuracy
[15:13:56][D][binary_sensor:036]: 'Draining': Sending state OFF
[15:13:56][D][sensor:094]: 'Byte 6': Sending state 0.00000  with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Byte 7': Sending state 0.00000  with 0 decimals of accuracy
[15:13:56][D][main:166]: 01 00 00 2b 1a 00 00 00
[15:13:56][D][sensor:094]: 'Humidity': Sending state 1.00000 % with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Humidity Setpoint': Sending state 0.00000 % with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Byte 2': Sending state 0.00000  with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Temperature': Sending state 43.00000 °C with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Byte 4': Sending state 26.00000  with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Byte 5': Sending state 0.00000  with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Byte 6': Sending state 0.00000  with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Byte 7': Sending state 0.00000  with 0 decimals of accuracy
[15:13:56][D][canbus:072]: received can message (#2) std can_id=0x123 size=8
[15:13:56][D][main:575]: 43 28 00 17 08 01 04 00
[15:13:56][D][sensor:094]: 'Humidity': Sending state 67.00000 % with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Humidity Setpoint': Sending state 40.00000 % with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Byte 2': Sending state 0.00000  with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Temperature': Sending state 23.00000 °C with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Byte 4': Sending state 8.00000  with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Byte 5': Sending state 1.00000  with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Byte 6': Sending state 4.00000  with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Byte 7': Sending state 0.00000  with 0 decimals of accuracy
[15:13:56][D][main:166]: 43 28 00 17 08 01 04 00
[15:13:56][D][sensor:094]: 'Humidity': Sending state 67.00000 % with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Humidity Setpoint': Sending state 40.00000 % with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Byte 2': Sending state 0.00000  with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Temperature': Sending state 23.00000 °C with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Byte 4': Sending state 8.00000  with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Byte 5': Sending state 1.00000  with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Byte 6': Sending state 4.00000  with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Byte 7': Sending state 0.00000  with 0 decimals of accuracy
[15:13:56][D][canbus:072]: received can message (#3) std can_id=0x123 size=8
[15:13:56][D][main:575]: 01 00 00 2b 1a 00 00 00
[15:13:56][D][sensor:094]: 'Humidity': Sending state 1.00000 % with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Humidity Setpoint': Sending state 0.00000 % with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Byte 2': Sending state 0.00000  with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Temperature': Sending state 43.00000 °C with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Byte 4': Sending state 26.00000  with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Byte 5': Sending state 0.00000  with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Byte 6': Sending state 0.00000  with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Byte 7': Sending state 0.00000  with 0 decimals of accuracy
[15:13:56][D][main:166]: 01 00 00 2b 1a 00 00 00
[15:13:56][D][sensor:094]: 'Humidity': Sending state 1.00000 % with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Humidity Setpoint': Sending state 0.00000 % with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Byte 2': Sending state 0.00000  with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Temperature': Sending state 43.00000 °C with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Byte 4': Sending state 26.00000  with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Byte 5': Sending state 0.00000  with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Byte 6': Sending state 0.00000  with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Byte 7': Sending state 0.00000  with 0 decimals of accuracy
[15:13:56][D][canbus:072]: received can message (#4) std can_id=0x123 size=8
[15:13:56][D][main:575]: 43 28 00 17 08 01 04 00
[15:13:56][D][sensor:094]: 'Humidity': Sending state 67.00000 % with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Humidity Setpoint': Sending state 40.00000 % with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Byte 2': Sending state 0.00000  with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Temperature': Sending state 23.00000 °C with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Byte 4': Sending state 8.00000  with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Byte 5': Sending state 1.00000  with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Byte 6': Sending state 4.00000  with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Byte 7': Sending state 0.00000  with 0 decimals of accuracy
[15:13:56][D][main:166]: 43 28 00 17 08 01 04 00
[15:13:56][D][sensor:094]: 'Humidity': Sending state 67.00000 % with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Humidity Setpoint': Sending state 40.00000 % with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Byte 2': Sending state 0.00000  with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Temperature': Sending state 23.00000 °C with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Byte 4': Sending state 8.00000  with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Byte 5': Sending state 1.00000  with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Byte 6': Sending state 4.00000  with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Byte 7': Sending state 0.00000  with 0 decimals of accuracy
[15:13:56][D][canbus:072]: received can message (#5) std can_id=0x123 size=8
[15:13:56][D][main:575]: 01 00 00 2b 1a 00 00 00
[15:13:56][D][sensor:094]: 'Humidity': Sending state 1.00000 % with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Humidity Setpoint': Sending state 0.00000 % with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Byte 2': Sending state 0.00000  with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Temperature': Sending state 43.00000 °C with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Byte 4': Sending state 26.00000  with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Byte 5': Sending state 0.00000  with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Byte 6': Sending state 0.00000  with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Byte 7': Sending state 0.00000  with 0 decimals of accuracy
[15:13:56][D][main:166]: 01 00 00 2b 1a 00 00 00
[15:13:56][D][sensor:094]: 'Humidity': Sending state 1.00000 % with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Humidity Setpoint': Sending state 0.00000 % with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Byte 2': Sending state 0.00000  with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Temperature': Sending state 43.00000 °C with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Byte 4': Sending state 26.00000  with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Byte 5': Sending state 0.00000  with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Byte 6': Sending state 0.00000  with 0 decimals of accuracy
[15:13:56][D][sensor:094]: 'Byte 7': Sending state 0.00000  with 0 decimals of accuracy

Even more progress!

With the TCAN connected in the middle, If I remove all the canbus.send’s, It will flood the log with data, over and over, until the TCAN locks up and reboots.
The data coming in is strange, its a mix of alternating good and bad data.

I still need to find what the remote is sending to get this data back, but progress is progress.


15:37:07][D][main:402]: 01 00 00 29 1b 00 00 00
[15:37:07][D][sensor:094]: 'Humidity': Sending state 1.00000 % with 0 decimals of accuracy
[15:37:07][D][sensor:094]: 'Humidity Setpoint': Sending state 0.00000 % with 0 decimals of accuracy
[15:37:07][D][sensor:094]: 'Byte 2': Sending state 0.00000  with 0 decimals of accuracy
[15:37:07][D][sensor:094]: 'Temperature': Sending state 41.00000 °C with 0 decimals of accuracy
[15:37:07][D][sensor:094]: 'Byte 4': Sending state 27.00000  with 0 decimals of accuracy
[15:37:07][D][sensor:094]: 'Byte 5': Sending state 0.00000  with 0 decimals of accuracy
[15:37:07][D][binary_sensor:036]: 'Draining': Sending state OFF
[15:37:07][D][sensor:094]: 'Byte 6': Sending state 0.00000  with 0 decimals of accuracy
[15:37:07][D][sensor:094]: 'Byte 7': Sending state 0.00000  with 0 decimals of accuracy
[15:37:07][D][canbus:072]: received can message (#2) std can_id=0x123 size=8
[15:37:07][D][main:402]: 42 2d 00 17 07 01 04 00
[15:37:07][D][sensor:094]: 'Humidity': Sending state 66.00000 % with 0 decimals of accuracy
[15:37:07][D][sensor:094]: 'Humidity Setpoint': Sending state 45.00000 % with 0 decimals of accuracy
[15:37:07][D][sensor:094]: 'Byte 2': Sending state 0.00000  with 0 decimals of accuracy
[15:37:07][D][sensor:094]: 'Temperature': Sending state 23.00000 °C with 0 decimals of accuracy
[15:37:07][D][sensor:094]: 'Byte 4': Sending state 7.00000  with 0 decimals of accuracy
[15:37:07][D][sensor:094]: 'Byte 5': Sending state 1.00000  with 0 decimals of accuracy
[15:37:07][D][sensor:094]: 'Byte 6': Sending state 4.00000  with 0 decimals of accuracy
[15:37:07][D][sensor:094]: 'Byte 7': Sending state 0.00000  with 0 decimals of accuracy
[15:37:07][D][canbus:072]: received can message (#3) std can_id=0x123 size=8
[15:37:07][D][main:402]: 01 00 00 29 1b 00 00 00
[15:37:07][D][sensor:094]: 'Humidity': Sending state 1.00000 % with 0 decimals of accuracy
[15:37:07][D][sensor:094]: 'Humidity Setpoint': Sending state 0.00000 % with 0 decimals of accuracy
[15:37:07][D][sensor:094]: 'Byte 2': Sending state 0.00000  with 0 decimals of accuracy
[15:37:07][D][sensor:094]: 'Temperature': Sending state 41.00000 °C with 0 decimals of accuracy
[15:37:07][D][sensor:094]: 'Byte 4': Sending state 27.00000  with 0 decimals of accuracy
[15:37:07][D][sensor:094]: 'Byte 5': Sending state 0.00000  with 0 decimals of accuracy
[15:37:07][D][sensor:094]: 'Byte 6': Sending state 0.00000  with 0 decimals of accuracy
[15:37:07][D][sensor:094]: 'Byte 7': Sending state 0.00000  with 0 decimals of accuracy
[15:37:07][D][canbus:072]: received can message (#4) std can_id=0x123 size=8
[15:37:07][D][main:402]: 42 2d 00 17 07 01 04 00
[15:37:07][D][sensor:094]: 'Humidity': Sending state 66.00000 % with 0 decimals of accuracy
[15:37:07][D][sensor:094]: 'Humidity Setpoint': Sending state 45.00000 % with 0 decimals of accuracy
[15:37:07][D][sensor:094]: 'Byte 2': Sending state 0.00000  with 0 decimals of accuracy
[15:37:07][D][sensor:094]: 'Temperature': Sending state 23.00000 °C with 0 decimals of accuracy
[15:37:07][D][sensor:094]: 'Byte 4': Sending state 7.00000  with 0 decimals of accuracy
[15:37:07][D][sensor:094]: 'Byte 5': Sending state 1.00000  with 0 decimals of accuracy
[15:37:07][D][sensor:094]: 'Byte 6': Sending state 4.00000  with 0 decimals of accuracy
[15:37:07][D][sensor:094]: 'Byte 7': Sending state 0.00000  with 0 decimals of accuracy
[15:37:07][D][canbus:072]: received can message (#5) std can_id=0x123 size=8

(a day later)
An inch sideways on progress…

I got my head wrapped around some code examples from GitHub and uploaded a non-ESPHome bin; these work, and I see good data coming back from the HD35P.

New standard frame from 0x00000123, DLC 8, Data 0x46 0x2D 0x00 0x18 0x0A 0x01 0x04 0x00

However, this does not work with the ESPHome configs I’ve tried, and I’m at around the 50 mark on bin files. :grimacing:

For reference, here’s the code I’m using that works.


#include <Arduino.h>
#include "config.h"
#include <HardwareSerial.h>
#include <ESP32CAN.h>
#include <CAN_config.h>
#include <SPI.h>
#include <SD.h>

void SD_test(void)
{
  SPI.begin(SD_SCLK_PIN, SD_MISO_PIN, SD_MOSI_PIN, SD_CS_PIN);
  if (!SD.begin(SD_CS_PIN))
  {
    Serial.println("SDCard MOUNT FAIL");
  }
  else
  {
    uint32_t cardSize = SD.cardSize() / (1024 * 1024);
    String str = "SDCard Size: " + String(cardSize) + "MB";
    Serial.println(str);
  }
}
CAN_device_t CAN_cfg;             // CAN Config
unsigned long previousMillis = 0; // will store last time a CAN Message was send
const int interval = 5000;        // interval at which send CAN Messages (milliseconds)
const int rx_queue_size = 10;     // Receive Queue size

void setup()
{
  pinMode(PIN_5V_EN, OUTPUT);
  digitalWrite(PIN_5V_EN, HIGH);

  pinMode(CAN_SE_PIN, OUTPUT);
  digitalWrite(CAN_SE_PIN, LOW);

  Serial.begin(115200);

  SD_test();
  Serial.println("Basic Demo - ESP32-Arduino-CAN");
  CAN_cfg.speed = CAN_SPEED_50KBPS;
  CAN_cfg.tx_pin_id = GPIO_NUM_27;
  CAN_cfg.rx_pin_id = GPIO_NUM_26;
  CAN_cfg.rx_queue = xQueueCreate(rx_queue_size, sizeof(CAN_frame_t));
  // Init CAN Module
  ESP32Can.CANInit();

  Serial.print("CAN SPEED :");
  Serial.println(CAN_cfg.speed);

  // put your setup code here, to run once:
}

void loop()
{

  CAN_frame_t rx_frame;

  unsigned long currentMillis = millis();

  // Receive next CAN frame from queue
  if (xQueueReceive(CAN_cfg.rx_queue, &rx_frame, 3 * portTICK_PERIOD_MS) == pdTRUE)
  {

    if (rx_frame.FIR.B.FF == CAN_frame_std)
    {
      printf("New standard frame");
    }
    else
    {
      printf("New extended frame");
    }

    if (rx_frame.FIR.B.RTR == CAN_RTR)
    {
      printf(" RTR from 0x%08X, DLC %d\r\n", rx_frame.MsgID, rx_frame.FIR.B.DLC);
    }
    else
    {
      printf(" from 0x%08X, DLC %d, Data ", rx_frame.MsgID, rx_frame.FIR.B.DLC);
      for (int i = 0; i < rx_frame.FIR.B.DLC; i++)
      {
        printf("0x%02X ", rx_frame.data.u8[i]);
      }
      printf("\n");
    }
  }
  // Send CAN Message
  if (currentMillis - previousMillis >= interval)
  {
    previousMillis = currentMillis;
    CAN_frame_t tx_frame;
    tx_frame.FIR.B.FF = CAN_frame_std;
    tx_frame.MsgID = 0x123;
    tx_frame.FIR.B.DLC = 8;
    tx_frame.data.u8[0] = 0x01;
    tx_frame.data.u8[1] = 0x00;
    tx_frame.data.u8[2] = 0x00;
    tx_frame.data.u8[3] = 0x00;
    tx_frame.data.u8[4] = 0x00;
    tx_frame.data.u8[5] = 0x00;
    tx_frame.data.u8[6] = 0x00;
    tx_frame.data.u8[7] = 0x00;

    ESP32Can.CANWriteFrame(&tx_frame);
    Serial.println("CAN send done");
  }
}

I purchased a HD55S White (no pump) but does not feature WiFi, manufactured July 2023 with serial number starting with S42.

I purchased the Lilygo XY_32_CAN+RS485 and wired/programmed exactly as jjhuff did with his HDi65S above hoping to see responses from my HD55S. I originally left the “bit_rate: 50kbps” as jjhuff did but also tried the “bit_rate: 125kbps” as dw4417 did with his 2023 model HD55 (he doesn’t state if his was an S model). I even tried 250kbps out of desperation. As others have stated, the Lilygo LED works great along with the Uptime and WiFi Signal messages of the Lilygo. However, I receive no output from the HD55S.

I have no past experience with CANBus although I took a look at the HD55S mainboard to verify the CANBus connections and traced these out to the ethernet connection and the CANBus_High and CANBus_Lo on the Lilygo.

Any suggestions? Thanks in advance!

I’m using 50kbps on my unit, but I don’t have the serial number at the moment.

Also, make sure you have gnd/0v hooked up in addition to CAN H/L.

Finally, I had to make sure the SE pin on the CAN transceiver was getting driven correctly:

output:
  - platform: gpio
    id: can_se_pin
    pin: GPIO23

I also have a HD35P and cannot get the lily t-can to work. This is after get my other one to work with an Adafruit CANBUS adapter. So I am not sure what to think…post you complete code and let me see if I can help with the HD35P…

This is the one that matches the settings that work with non-esphome-generated bins. (The post above has that C code for reference.)


substitutions:
  name: esphome-web-67d480
  friendly_name: HD35P

esphome:
  name: ${name}
  friendly_name: ${friendly_name}
  min_version: 2024.6.0
  name_add_mac_suffix: false
  project:
    name: esphome.web
    version: '1.0'

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:
  level: VERY_VERBOSE
# Enable Home Assistant API
api:
  encryption:
    key: !secret api_key
# Allow Over-The-Air updates
ota:
- platform: esphome

# Allow provisioning Wi-Fi via serial
improv_serial:

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

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "HD35P Fallback Hotspot"
    password: !secret wifi_password

# In combination with the `ap` this allows the user
# to provision wifi credentials to the device via WiFi AP.
captive_portal:

dashboard_import:
  package_import_url: github://esphome/example-configs/esphome-web/esp32.yaml@main
  import_full_config: true

# Sets up Bluetooth LE (Only on ESP32) to allow the user
# to provision wifi credentials to the device.
esp32_improv:
  authorizer: none

# To have a "next url" for improv serial
web_server:

light:
  - platform: neopixelbus
    id: neopixel
    type: GRB
    variant: WS2812
    pin: GPIO04
    num_leds: 1
    name: "Status LED"
    on_turn_on: 
      - light.turn_on:
          id: neopixel
          brightness: 50%
          red: 100%
          green: 0%
          blue: 0%    
        
    
          

    restore_mode:
      RESTORE_DEFAULT_ON 



canbus:
  - platform: esp32_can
    tx_pin: GPIO27
    rx_pin: GPIO26
    can_id: 0x05
    bit_rate: 50kbps
      #also tried bit_rate: 125kbps
    use_extended_id: false
    on_frame:
    - can_id: 0x123
      then:
      - logger.log:
          format: "%02x %02x %02x %02x %02x %02x %02x %02x"
          args: [ 'x[0]', 'x[1]', 'x[2]', 'x[3]', 'x[4]', 'x[5]', 'x[6]', 'x[7]' ]
      - sensor.template.publish:
          id: humidity_actual
          state: !lambda 'return x[0];'
      - sensor.template.publish:
          id: humidity_setpoint
          state: !lambda 'return x[1];'
      - sensor.template.publish:
          id: byte_2
          state: !lambda 'return x[2];'
      - sensor.template.publish:
          id: temperature
          state: !lambda 'return x[3];'
      - sensor.template.publish:
          id: byte_4
          state: !lambda 'return x[4];'
      - sensor.template.publish:
          id: byte_5
          state: !lambda 'return x[5];'
      - binary_sensor.template.publish:
          id: draining
          state: !lambda 'return (x[5] & 0x10) == 0x10;'
      - sensor.template.publish:
          id: byte_6
          state: !lambda 'return x[6];'
      - sensor.template.publish:
          id: byte_7
          state: !lambda 'return x[7];'

#interval:
interval:
  - interval: 5s
    then:
      - canbus.send:
          data: [ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ]
          can_id: 0x123      

# Frames from remote
# 01 00 00 28 1b 00 00 00
# New standard frame from 0x00000123, DLC 8, Data 0x31 0x1D 0x00 0x00 0x00 0x00 0x00 0x00 
# THIS ONE!? New standard frame from 0x00000123, DLC 8, Data 0x01 0x00 0x00 0x33 0x1C 0x00 0x00 0x00 


sensor:
  # Uptime sensor.
  - platform: uptime
    name: Uptime
    disabled_by_default: true

  # WiFi Signal sensor.
  - platform: wifi_signal
    name: WiFi Signal
    update_interval: 60s
    disabled_by_default: true

  - platform: template
    name: Humidity
    id: humidity_actual
    accuracy_decimals: 0
    update_interval: 10s
    unit_of_measurement: "%"
    device_class: "humidity"
    state_class: "measurement"
  - platform: template
    name: Humidity Setpoint
    id: humidity_setpoint
    accuracy_decimals: 0
    update_interval: 10s
    unit_of_measurement: "%"
    device_class: "humidity"
    state_class: "measurement"
  - platform: template
    name: Temperature
    id: temperature
    accuracy_decimals: 0
    update_interval: 10s
    unit_of_measurement: "°C"
    device_class: "temperature"
    state_class: "measurement"

  - platform: template
    name: Byte 2
    id: byte_2
    accuracy_decimals: 0
  - platform: template
    name: Byte 4
    id: byte_4
    accuracy_decimals: 0
  - platform: template
    name: Byte 5
    id: byte_5
    accuracy_decimals: 0
  - platform: template
    name: Byte 6
    id: byte_6
    accuracy_decimals: 0
  - platform: template
    name: Byte 7
    id: byte_7
    accuracy_decimals: 0

binary_sensor:
  - platform: template
    name: Draining
    id: draining

so my 35p is doing this

3c 3c 00 17 15 02 00 20

3b 3c 00 17 16 02 00 20

37 3c 00 18 16 02 00 20

on and running at set at 25 and reading 55

37 19 00 17 09 01 04 20

power button off and fan is on

37 19 00 17 08 20 00 20

power button in / cont mode / pump light (pump enabled) / fan is running

39 14 00 17 11 09 04 20

55, power, fan is on, non-cont - pump light

37 37 00 17 09 01 04 20

So this unit has a button to disable the pump for a gravity drain mode, I am assuming that is in here somewhere…

I’m still at the stage of it not responding to canbus.sends. How does my yaml above compare with yours?

not sure here is the main section

canbus:
  - platform: esp32_can
    id: my_mcp2515
    tx_pin: GPIO27
    rx_pin: GPIO26
    can_id: 0x05
    bit_rate: 50kbps
    #bit_rate: 125kbps
    use_extended_id: false
    on_frame:
    - can_id: 0x123
      then:
      - logger.log:
          format: "%02x %02x %02x %02x %02x %02x %02x %02x"
          args: [ 'x[0]', 'x[1]', 'x[2]', 'x[3]', 'x[4]', 'x[5]', 'x[6]', 'x[7]' ]
      - sensor.template.publish:
          id: humidity_actual
          state: !lambda 'return x[0];'
      - sensor.template.publish:
          id: humidity_setpoint
          state: !lambda 'return x[1];'
      - sensor.template.publish:
          id: temperature
          state: !lambda 'return x[3];'

      - sensor.template.publish:
          id: status_2
          state: !lambda 'return x[5];'

      - sensor.template.publish:
          id: fan_speed
          state: !lambda 'return x[4];'

      - sensor.template.publish:
          id: byte_2
          state: !lambda 'return x[2];'

      - sensor.template.publish:
          id: byte_4
          state: !lambda 'return x[4];'

      - sensor.template.publish:
          id: byte_6
          state: !lambda 'return x[6];'
      - sensor.template.publish:
          id: byte_7
          state: !lambda 'return x[7];'

      - binary_sensor.template.publish:
          id: draining
          state: !lambda 'return (x[5] & 0x10) == 0x10;'

      - binary_sensor.template.publish:
          id: power
          state: !lambda 'return (x[5] & 0x02) == 0x02;'

      # adjusted 8/3 for garage
      - binary_sensor.template.publish:
          id: running
          state: !lambda 'return (x[7] & 0x04) == 0x04;'

      - binary_sensor.template.publish:
          id: continuous
          state: !lambda 'return (x[5] & 0x08) == 0x08;'

interval:
  - interval: 1s
    then:
      - canbus.send:
          data: [ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ]
          #data: [ 0x01, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x00 ]
          can_id: 0x123

OH!

you might need this

output:
  - platform: gpio
    id: ENABLE_PIN
    pin:
      number: GPIO19

  - platform: gpio
    id: CAN_SE_PIN
    pin:
      number: GPIO23

  - platform: gpio
    id: ENABLE_5V_PIN
    pin:
      number: GPIO16

esphome:
  name: ${hostname}
  friendly_name: ${friendly_name}  
  area: ${room}
  comment: ${devicename}
  on_boot:
  - priority: 800
    then:
      - output.turn_on: ENABLE_PIN
      - output.turn_off: CAN_SE_PIN
      - output.turn_on: ENABLE_5V_PIN

@newdamage1 did you figure it out and get it to respond?

I’m in the same situation with a HD55, the Lilygo and not getting any response. I’ve tried various combinations of things mentioned in this thread (different bit rates, can ids), but so far no luck :frowning:

Edit: Nevermind I was able to figure it out all. My issue was a miscabling. After swapping the cables it all worked.

Edit: nvm! I fixed it - I was missing this in my configuration:

output:
  - platform: gpio
    id: can_se_pin
    pin: GPIO23

Thank you all! :slight_smile:

@Midi99 having the same issue… Swapping cables how?
I’ve swapped out two RJ45 cables so far, same issue.

I’m using the following pinout on my cat6 cable, which is terminated using standard 568b pattern at the rj45 end:
solid brown - gnd - pin 8
striped brown - vcc - pin 7
striped blue - can high - pin 5
solid blue - can low - pin 4

I’m able to power by Lilygo using the rj45 output, but i don’t get any canbus signal.

Waht did you swap? Whole new ethernet cable, or just the pins?
Are you using usb-c power?

Thanks in advance!

The “Central Control” button on the HD55S seems to work just fine despite AlorAir saying not to use it. When in Central Control mode, you can apply 24V AC or DC to terminals A3-A4 to turn the dehumidifier on/off. The fan purge mode still works after turning off, and the machine restores to Central Control mode on power loss/restore.

Hey…you know how this goes :slight_smile: I have some time to come back to this so I am. Did you make any progress with your 35? I can see some of the data, but I am nowhere near what I can do with my 55…

substitutions:
  devicename: GarageDehumid
  friendly_name: Garage Dehumidifier Controller
  hostname: garage-dehumidifier
  location: Inside
  floor: 1stfloor
  room: Testing
  sensor_interval: 120s

esphome:
  name: ${hostname}
  friendly_name: ${friendly_name}  
  area: ${room}
  comment: ${devicename}
  on_boot:
  - priority: 500
    then:
      - canbus.send:
          data: [ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ]
          can_id: 0x123
  - priority: 100
    then:
      - canbus.send:
          data: [ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ]
          can_id: 0x123
  - priority: 800
    then:
      - output.turn_on: ENABLE_PIN
      - output.turn_off: CAN_SE_PIN
      - output.turn_on: ENABLE_5V_PIN

  platformio_options:
    build_unflags: -Werror=all
    board_build.flash_mode: dio

esp32:
  board: esp32dev
  framework:
    type: arduino

preferences:
  flash_write_interval: 10min
  
<<: !include common/logger.yaml
<<: !include common/web_server.yaml
<<: !include common/wifi.yaml
<<: !include common/time.yaml
<<: !include common/ota.yaml
<<: !include common/api.yaml

output:
  - platform: gpio
    id: ENABLE_PIN
    pin:
      number: GPIO19

  - platform: gpio
    id: CAN_SE_PIN
    pin:
      number: GPIO23

  - platform: gpio
    id: ENABLE_5V_PIN
    pin:
      number: GPIO16


#light:
#  - platform: neopixelbus
#    type: GRB
#    variant: WS2812
#    id: statusled
#    pin: GPIO04
#    num_leds: 1
#    name: "Status LED"
#    effects:
#      - pulse:

#sensor:
#  - platform: template
#    name: Temperature
#    id: temp
#  - platform: template
#    name: Humidity
#    id: humid
#  - platform: template
#    name: Pump
#    id: pump
# gpio32 = int
# gpio14 = 14

#  feather is L G H
# can is 4/blue is lo
# can is 5/blue stripe is high
# can is 8/brwn grn

# 37 37 16 00 01 00 00 00
# 37 37 15 00 03 00 00 00
# 35 37 15 00 03 00 00 00
# RHactual RHset Temp D3 Status D5 D6 D7
#123 Humidity D1 Control D4 D5 D6 D7


# garage
# 3c 3c 00 17 15 02 00 20
# 3b 3c 00 17 16 02 00 20
# 37 3c 00 18 16 02 00 20
# on and running at 25 set 55 reading
# 37 19 00 17 09 01 04 20
# off fan is on
# 37 19 00 17 08 20 00 20
# power / cont / pump light / fan is on
# 39 14 00 17 11 09 04 20
# 55, power, fan is on, non-cont - pump liught
# 37 37 00 17 09 01 04 20

# power off, pump on (not running), fan is on
# 36 37 00 17 0a 20 00 20

# power is blinking, pump light on (not draining), fan is off 
# 38 37 00 17 10 22 00 20

# power is blinking, pumplight ins on, DRAINING, fan is off
# 38 37 00 17 11 32 00 20

# power is blinking, pump disabled, fan is off
# 37 37 00 17 12 02 00 20


#To set Humidity, add 128 to desired humidity set point
#Controlbit0 = 1 toggles machine on or off depending on current state
#Set all other bytes to 0 (e.g. D1, D4, etc)

#I have not completely decoded Status nor Control nor the other data bytes. Sending Controlbit4 to 1 (0x8) seems to turn on Cont Defrost and if Cont Defrost is on 0x3 in Control seems to turn it off.

canbus:
  - platform: esp32_can
    id: my_mcp2515
    tx_pin: GPIO27
    rx_pin: GPIO26
    can_id: 0x05
    bit_rate: 50kbps
    #bit_rate: 125kbps
    use_extended_id: false
    on_frame:
    - can_id: 0x123
      then:
      - logger.log:
          format: "%02x %02x %02x %02x %02x %02x %02x %02x"
          args: [ 'x[0]', 'x[1]', 'x[2]', 'x[3]', 'x[4]', 'x[5]', 'x[6]', 'x[7]' ]
      - sensor.template.publish:
          id: humidity_actual
          state: !lambda 'return x[0];'
      - sensor.template.publish:
          id: humidity_setpoint
          state: !lambda 'return x[1];'
      - sensor.template.publish:
          id: temperature
          state: !lambda 'return x[3];'

      - sensor.template.publish:
          id: status_2
          state: !lambda 'return x[5];'

      - sensor.template.publish:
          id: fan_speed
          state: !lambda 'return x[4];'

      - sensor.template.publish:
          id: byte_2
          state: !lambda 'return x[2];'

      - sensor.template.publish:
          id: byte_4
          state: !lambda 'return x[4];'

      - sensor.template.publish:
          id: byte_6
          state: !lambda 'return x[6];'
      - sensor.template.publish:
          id: byte_7
          state: !lambda 'return x[7];'

      - binary_sensor.template.publish:
          id: draining
          state: !lambda 'return (x[5] & 0x10) == 0x10;'

      - binary_sensor.template.publish:
          id: power
          state: !lambda 'return (x[5] & 0x02) == 0x02;'

      # adjusted 8/3 for garage
      - binary_sensor.template.publish:
          id: running
          state: !lambda 'return (x[7] & 0x04) == 0x04;'

      - binary_sensor.template.publish:
          id: continuous
          state: !lambda 'return (x[5] & 0x08) == 0x08;'

interval:
  - interval: 1s
    then:
      - canbus.send:
          data: [ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ]
          #data: [ 0x01, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x00 ]
          can_id: 0x123

sensor:

  #- !include common/sensors/wifi_sensor_db.yaml
  #- !include common/sensors/wifi_sensor_percent.yaml 
  - platform: template
    name: Fan Speed
    id: fan_speed
    accuracy_decimals: 0

    
#  - platform: homeassistant
#    name: External Humidity
#    id: crawl_space_average_humidity
#    entity_id: sensor.crawl_space_average_humidity
#    internal: true

#  - platform: homeassistant
#    name: External Temperature
#    id: crawl_space_average_temperature
#    entity_id: sensor.crawl_space_average_temperature
#    internal: true

  - platform: template
    name: Humidity
    id: humidity_actual
    accuracy_decimals: 0
    unit_of_measurement: "%"
    device_class: "humidity"
    state_class: "measurement"

  - platform: template
    name: Humidity Setpoint
    id: humidity_setpoint
    accuracy_decimals: 0
    unit_of_measurement: "%"
    device_class: "humidity"
    state_class: "measurement"

  - platform: template
    name: Temperature
    id: temperature
    accuracy_decimals: 0
    unit_of_measurement: "°C"
    device_class: "temperature"
    state_class: "measurement"

  - platform: template
    name: Status 1
    id: status_1
    accuracy_decimals: 0

  - platform: template
    name: Status 2
    id: status_2
    accuracy_decimals: 0

  - platform: template
    name: Byte 2
    id: byte_2
    accuracy_decimals: 0

  - platform: template
    name: Byte 4
    id: byte_4
    accuracy_decimals: 0

  - platform: template
    name: Byte 5
    id: byte_5
    accuracy_decimals: 0

  - platform: template
    name: Byte 6
    id: byte_6
    accuracy_decimals: 0

  - platform: template
    name: Byte 7
    id: byte_7
    accuracy_decimals: 0
              
binary_sensor:
  #37 3c 00 18 17 12 00 20
  - platform: template
    name: Draining
    id: draining
    device_class: running

  - platform: template
    name: Running
    id: running
    device_class: running

  - platform: template
    name: Power
    id: power
    device_class: power

  - platform: template
    name: Continuous Mode
    id: continuous

  - platform: template
    name: Pump Enabled
    id: pumpenabled

text_sensor:
  #- !include common/sensors/wifi_text_sensors.yaml
  #- !include common/sensors/location_text_sensor.yaml
  #- !include common/sensors/floor_text_sensor.yaml
  #- !include common/sensors/room_text_sensor.yaml

  - platform: template
    name: Error Code
    id: error


# 123 Humidity D1 Control D4 D5 D6 D7
switch:
  - platform: template
    name: Continuous Mode
    id: continuous_mode_enable
    restore_mode: ALWAYS_OFF
    lambda: |-
      if (id(continuous).state) {
        return true;
      } else {
        return false;
      }
    turn_on_action:
      - canbus.send:
          data: [ 0xA4, 0x00, 0x09, 0x01, 0x00, 0x00, 0x00, 0x00 ]
          can_id: 0x123
      - number.set:
          id: setpoint
          value: 30        
    turn_off_action:
      - canbus.send:
          data: [ 0xB7, 0x00, 0x09, 0x01, 0x00, 0x00, 0x00, 0x00 ]
          can_id: 0x123
      - number.set:
          id: setpoint
          value: 55       

  - platform: template
    name: Drain Pump
    id: drain_pump
    restore_mode: ALWAYS_OFF
    lambda: |-
      if (id(draining).state) {
        return true;
      } else {
        return false;
      }
    turn_on_action:
      - canbus.send:
          data: [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,  0x00, 0x00 ]
          can_id: 0x123
    turn_off_action:
      - canbus.send:
          data: [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,  0x00, 0x00 ]
          can_id: 0x123

  - platform: template
    name: Enable Dehumidifier
    id: enable_dehumid
    restore_mode: ALWAYS_ON
    lambda: |-
      if (id(power).state) {
        return true;
      } else {
        return false;
      }
    turn_on_action:
      - canbus.send:
          data: [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00 ]
          can_id: 0x123
    turn_off_action:
      - canbus.send:
          data: [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00 ]
          can_id: 0x123

number:

  - platform: template
    id: setpoint
    name: Set Point
    min_value: 30
    max_value: 95
    update_interval: 15s
    device_class: humidity
    step: 5
    set_action: 
      then:
        - lambda: |-
            x = x + 128;
            uint32_t 	can_id = 0x123;
            bool 	use_extended_id = 0;
            std::vector< uint8_t > data{ x, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
            id(my_mcp2515)->send_data(can_id, use_extended_id, data);
    lambda: return(id(humidity_setpoint).state);
            
button:
  - platform: restart
    name: "Restart"

1 Like

I want to thank everyone for their input here. Here is my code for my HD55 that uses the different format, hope it helps someone else. My code is working great so far :grin:

esphome:
  name: alorair-hd55
  friendly_name: alorair_hd55

esp32:
  board: esp32-s3-devkitc-1
  framework:
    type: esp-idf

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

ota:
  - platform: esphome
    password: "******"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  ap:
    ssid: "HD55_Fallback"

# Optional fallback hotspot
captive_portal:

# Enable Web UI
web_server:

# Logging and OTA
logger:
  level: DEBUG

# Status Sensor
text_sensor:
  - platform: template
    name: "HD55 Status"
    id: hd55_status_text
    icon: mdi:information-outline

binary_sensor:
  - platform: template
    name: "HD55 Power Switch"
    id: power
    internal: true

  - platform: template
    name: "HD55 Continuous Mode"
    id: continuous
    internal: true

# CAN Bus Configuration
canbus:
  - platform: esp32_can
    id: hd55_can
    tx_pin: GPIO21
    rx_pin: GPIO19
    bit_rate: 125KBPS
    can_id: 0x05  # dummy required by ESPHome
    use_extended_id: false

    # Receive and decode CAN status frames from HD55
    on_frame:
      - can_id: 0x3b0
        then:
          - logger.log:
              format: "%02x %02x %02x %02x %02x %02x %02x %02x"
              args: [ 'x[0]', 'x[1]', 'x[2]', 'x[3]', 'x[4]', 'x[5]', 'x[6]', 'x[7]' ]
          - lambda: |-
              id(unit_rh).publish_state(x[0]); // Byte 0 = Humidity (%)
              id(setpoint_value).publish_state(x[1]); // Byte 1 = Setpoint (%)
              // id(unit_temp).publish_state(x[2]); // Byte 2 = Temperature (°C)
              id(unit_temp).publish_state(x[2] * 9.0 / 5.0 + 32.0); // Byte 2 = Temperature °C, converted to °F

              const uint8_t status = x[4]; // Byte 4 = Status
              const char* status_str = "Unknown";

              switch (status) {
                  case 0x00:
                  status_str = "Normal, Off"; // 0x01 turns on and off
                  id(power).publish_state(false);  // Turn on this off
                  id(continuous).publish_state(false);  // Turn on this off
                  break;
                  case 0x01:
                  status_str = "Normal, Idle"; // 0x01
                  id(power).publish_state(true);  // Turn on this switch
                  id(continuous).publish_state(false);  // Turn on this off
                  break;
                  case 0x03:
                  status_str = "Normal, Running";
                  id(power).publish_state(true); // Turn on this switch
                  id(continuous).publish_state(false); // Turn off this switch
                  break;
                  case 0x10:
                  status_str = "Off, Pumping"; // 0x02 i think turns on pump?
                  break;
                  case 0x11:
                  status_str = "Idle, Pumping"; // 0x02
                  break;
                  case 0x13:
                  status_str = "Running, Pumping"; // 0x02
                  break;
                  case 0x08:
                  status_str = "Continuous, Off"; // 0x04 turns on, 0x03 turns off but previous set point is lost 
                  id(power).publish_state(false); // Turn off this switch
                  id(continuous).publish_state(true); // Turn off this switch
                  break;
                  case 0x09:
                  status_str = "Continuous, Idle"; // 0x04
                  id(power).publish_state(true) ; // Turn off this switch
                  id(continuous).publish_state(true); // Turn on this switch
                  break;
                  case 0x0b:
                  status_str = "Continuous, Running"; // 0x04
                  id(power).publish_state(true) ; // Turn off this switch
                  id(continuous).publish_state(true); // Turn on this switch
                  break;
              }

              id(hd55_status_text).publish_state(status_str);

# ====== Periodic Polling to Request Status ======
interval:
  - interval: 10s
    then:
      - canbus.send:
          can_id: 0x123
          use_extended_id: false
          data: [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]

# ====== Sensor Definitions ======
sensor:
  - platform: template
    name: "HD55 Unit RH"
    id: unit_rh
    unit_of_measurement: "%"
    accuracy_decimals: 0
    filters:
      - sliding_window_moving_average:
          window_size: 12
          send_every: 3
      - lambda: |-
          return round(x);  // Round to nearest whole number

  - platform: template
    name: "HD55 Unit Temperature"
    id: unit_temp
    unit_of_measurement: "°F" # Must also change byte 2 section above^
    accuracy_decimals: 0
    filters:
      - sliding_window_moving_average:
          window_size: 12
          send_every: 3
      - lambda: |-
          return round(x);  // Round to nearest whole number

  - platform: template
    id: setpoint_value
    name: "HD55 Current Setpoint"
    unit_of_measurement: "%"
    accuracy_decimals: 0

# ====== Humidity Setpoint Control ======
number:
  - platform: template
    name: "HD55 Humidity Setpoint"
    id: setpoint_control
    min_value: 36 # 35 sets continuous mode on
    max_value: 99
    step: 1
    restore_value: true
    optimistic: true
    set_action:
      then:
        - lambda: |-
            uint8_t sp = (uint8_t)(x + 128);  // Protocol expects RH + 128
            std::vector<uint8_t> data = { sp, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
            id(hd55_can).send_data(0x123, false, data);
            id(setpoint_value).publish_state(x);

# ====== Switch Controls for Unit Commands ======
switch:
  - platform: template
    name: "HD55 Power Switch"
    id: enable_dehumid
    lambda: return id(power).state;
    turn_on_action:
      - canbus.send:
          can_id: 0x123
          data: [0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00]
    turn_off_action:
      - canbus.send:
          can_id: 0x123
          data: [0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00]

  - platform: template
    name: "HD55 Continuous Mode"
    id: continuous_mode_enable
    lambda: return id(continuous).state;
    turn_on_action:
      - canbus.send:
          can_id: 0x123
          data: [0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00]
    turn_off_action:
      - lambda: |-
          uint8_t sp = (uint8_t)(id(setpoint_control).state + 128);  // RH + 128
          std::vector<uint8_t> data = { sp, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
          id(hd55_can).send_data(0x123, false, data);