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