8 Channel MAX31855 w/ 3 bit multiplexer

Hello, I have a MAX31855 breakout board with an integrated 74HC4051D analog mux. This device appears to be made by whizoo.com and is sold on amazon. The mux interface is 3 bit. I’m wondering if there is an easy way to integrate this device into esphome, or if a custom sensor needs to be configured.

Well I received some advice on discord, and it seems there may be a couple of different ways to tackle this problem. It seems I need to create a new external component for either the entire breakout board (mux & 31855) or create a new external component for the mux (74HC4051D) that can inherit sensors like the already supported 74hc4067 mux. It was though initially that the 74hc4067 mux that is already supported would work, but it only allows voltage sources to be inherited (the 31855 is a temp. device).

So not entirely sure the best way to go. It seems creating a new external component for the mux is the most logical way to go.

Any thoughts?

Or possibly, create a new temperature_source component and include it in the existing 31855 and 74hc4067. ???

I am playing around with some local versions of the cd74hc4067 & max31855 components. I’ve created a my_components folder under esphome and copied the components to that location.

The problem I’m having is, the cd74hc4067 only accepts a voltage source as a sensor and the max31855 is not a voltage source. Voltage sources are inherit a voltage_sampler component. So what I am trying to do is modify the max31855 to be a new type of sampler, a temperature_sampler. This temperature_sampler is also located in the my_components folder and is a mirror of the voltage_sampler component, only the names have all been changed to my_temperature_sampler. Likewise, the cd74hc4067 and max31855 components have been changed to be my_cd74hc4067 & my_max31855.

I’ve modified the init.py, the .cpp, the .h and the sensor.py for each of the external components.

The issue I am having now is, in my esphome device.yaml file, I am getting a platform not found error:
Platform not found: 'sensor.my_cd74hc4067'.

My yaml is:

esphome:
  name: "garage-freezers"

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:


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

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Esphome-Web-******"
    password: "****************"

captive_portal:

spi:
  miso_pin: GPIO12
  clk_pin: GPIO14
  
external_components:
  - source:
      type: local
      path: /config/esphome/my_components
    components: [my_cd74hc4067, my_max31855, my_temperature_sampler]

my_cd74hc4067:
  - id: my_cd74hc4067_1
    pin_s0: GPIO21
    pin_s1: GPIO3
    pin_s2: GPIO1
    pin_s3: GPIO22


sensor:
  - platform: my_max31855
    name: freezer_temps
    cs_pin: GPIO16
    update_interval: 5s
  - platform: my_cd74hc4067
    id: channel_1
    number: 0
    sensor: freezer_temps
    update_interval: 5s
  - platform: my_cd74hc4067
    id: channel_2
    number: 1
    sensor: freezer_temps
    update_interval: 5s

What weird is the my_max31855 is found without issue. Does anyone have any advice?

Also, in the my_cd74hc4067/sensor.py file there is an import I dont understand how it works:
from . import cd74hc4067_ns, CD74HC4067Component. Where are these being imported from? I’m afraid with the modified external component, these import names might not be correct.

my local external components are here: [deleted]

Ok, I’ve created an ESPHome external component for the Neem-Tech / Whizoo eight channel max31855 breakout board at:
https://github.com/chrismec/octo_max31855

Thanks to everyone at the ESPHome discord channel for all your help!