RTD HAT and ESPHome

Tonymac32

New member
I have a crowdsource MEGA-RTD, and saw the home assistant integration, however I don't plan on using any Raspberry Pi's in my home automation setup, so I turned to my ESP32. There was no ESPHome integration, but, ESPHome does support I2C direct communication through lambdas, so I set it up like this:

YAML:
i2c:
  - id: bus_a
    sda: 21    // use the right pins for your board
    scl: 22    // use the right pins for your board
    frequency: 400kHz
    scan: True

i2c_device:
  - id: "RTD_HAT"
    i2c_id: bus_a
    address: 0x40
    
sensor:
  - platform: template
    name: "Channel 1"
    lambda: |-
      float temp1;
      id(RTD_HAT).read_bytes(0x00, reinterpret_cast<uint8_t *>(&temp1), 4);
      return temp1;
    update_interval: 2s
  - platform: template
    name: "Channel 2"
    lambda: |-
      float temp1;
      id(RTD_HAT).read_bytes(0x04, reinterpret_cast<uint8_t *>(&temp1), 4);
      return temp1;
    update_interval: 2s
  #- value2: id("RTD_HAT").read_bytes(0x08, 4)  # Read 4 bytes starting from register (4*channel-1)
  #- value3: id("RTD_HAT").read_bytes(0x0C, 4)  # Read 4 bytes starting from register (4*channel-1)
  #- value4: id("RTD_HAT").read_bytes(0x10, 4)  # Read 4 bytes starting from register (4*channel-1)
  #- value5: id("RTD_HAT").read_bytes(0x14, 4)  # Read 4 bytes starting from register (4*channel-1)
  #- value6: id("RTD_HAT").read_bytes(0x18, 4)  # Read 4 bytes starting from register (4*channel-1)
  #- value7: id("RTD_HAT").read_bytes(0x1C, 4)  # Read 4 bytes starting from register (4*channel-1)

Note, this was set up for an ESP32 PI shaped board I crowd-sourced 6 years ago or so, however it should work well with


I haven't spent much time looking over the Sequent Microsystems ESP32 board to know it's pinout (I have about 20 of my board laying around), but just double-check the I2C channel and that should be enough.

The ultimate "win" for the ESP32 boards in general would be a proper ESPHome integration for the various Sequent boards, even though most of them could be handled this way, ESPHome allows them to be remotely utilized away from the Home Assistant main controller
 

alexburcea

Moderator
Staff member
Hi,

Thanks for sharing all these. Your configuration should work perfectly for ESP32-Pi since it uses the same I2C port pins (21 and 22).
All our cards should work like in your example, but we will consider ESPHome integration.

Alex.
 
Top