Platform not found: 'sensor.MMC5603'

From the ESPHome components page, I’m trying to install my MMC5603 Magnetometer. I’ve taken the sensor configuration entry and added it to my device .yaml script. When I go to install it, I get the message, “Platform not found: ‘sensor.MMC5603’.”

It seems I’m missing something, but I’m at a loss as to how to fix it. I tried updating my install of Home Assistant in the hope that it wasn’t in my original install. I believe I’ve done that correctly but it hasn’t helped.

In poking around my Home Assistant install, I’ve found other components that I’ve used at /usr/local/lib/python3.10/dist-packages/esphome/components/ . However, I did not see an entry for mmc5603.

The MMC5603 is supported by ESPHome as noted here: MMC5603 Magnetometer — ESPHome

Thanks in advance.

You mentioned that you updated HA, but have you updated ESPHome? I’m guessing you have an old version that pre-dates that sensor being included.

1 Like

That is entirely possible. Can you point me to instructions on how to update ESPHome?

Settings—Add-ons—ESPHome

Should tell you the version info and if you have the latest/let you update.

My install of Home Assistant and ESPHome is not an out-of-the-box install. I’ve got it installed on Ubuntu. I don’t have an “Add-ons” selection the settings. Is there a way of updating ESPHome via Linux command line?

When I enter esphome version at the command prompt, it gives me version 2023.4.2 so I think that should have support for the MCC5603 included.

Indeed, I saw that and ran the updates there. Still no MMC5603 support.

Tried the ‘Clean Build Files’ option in the hamburger menu for your device on the ESPHome page?

No success there either. I think I’m missing something in the support files for ESPHome. Note my first post where I said there is no MMC5603 folder.

Please post your yaml and full log.

Everything before “captive_portal” is automatically created. With it I’m able to connect via wifi, etc. Everything after that is from the ESPHome page regarding the MMC5603.

Everything after “sensor:” is underlined in red notating an error. When I hover over anything red-lined, I see the error message in the title, “Platform not found: ‘sensor.MMC5603’”. When I try to install, it does not compile.

esphome:
  name: mmc5603-magnetometer
esp32:
  board: esp32-c3-devkitm-1
  framework:
    type: arduino
# Enable logging
logger:
# Enable Home Assistant API
#
# Network info left out for brevity
#

captive_portal:
sensor:
  - platform: MMC5603
    address: 0x30
    field_strength_x:
      name: "MMC5603 Field Strength X"
    field_strength_y:
      name: "MMC5603 Field Strength Y"
    field_strength_z:
      name: "MMC5603 Field Strength Z"
    heading:
      name: "MMC5603 Heading"
    update_interval: 60s



Logs:

INFO Reading configuration /config/mmc5603-magnetometer.yaml...
Failed config

sensor.MMC5603: [source /config/mmc5603-magnetometer.yaml:32]
  
  Platform not found: 'sensor.MMC5603'.
  platform: MMC5603
  address: 48
  field_strength_x: 
    name: MMC5603 Field Strength X
  field_strength_y: 
    name: MMC5603 Field Strength Y
  field_strength_z: 
    name: MMC5603 Field Strength Z
  heading: 
    name: MMC5603 Heading
  update_interval: 60s

I assume this isn’t the issue since I’d think the error would be more specific to this effect, but you don’t appear to have an I2C bus setup:

1 Like

Yes my thoughts too.

Good catch, but adding I2C doesn’t help.

This appears to be something in my setup. I’ve been looking at what’s needed to set up a custom sensor. I found the .cpp and .h code in the ESPHome source repository (ESPHome: /opt/build/esphome/esphome/components/mmc5603 Directory Reference) and I tried creating an mmc6503 folder in my ESPHome file structure and putting those files in it. I’m not clear on what’s needed to register the component in ESPHome so that when it sees my .yaml declaration it knows what to do and where those files exist.

Don’t know why you would set up a custom component, but perhaps you have the wrong framework. As the docs say, ESP-IDF is preferred for esp32c3, and in any event the c3 is still in development. All on this page:

ESP-IDF framework

This is an alternative base framework for ESP32 chips, and recommended for variants of the ESP32 like ESP32S2, ESP32S3, ESP32C3 and single-core ESP32 chips.

Note
Support for the ESP32-S2 and ESP32-C3 is still in development and there could be issues.

I didn’t know ESP-IDF existed. I’ve successfully used a BME280 pressure, temperature and humidity sensor with this setup so I figured I’d push further and try the magnetometer.

I’m not really trying to use a custom component. I’m just trying to figure out what tells ESPHome that I’ve got code for a component, i.e. mmc5603.cpp and .h. I figured that was one way to do it. If you know of a better way please let me know. Is it possible that the MMC5603 support is only in beta and not the stable release?

No, see ESPHome 2023.4.0 - 19th April 2023 — ESPHome

But maybe you are not really on 2023.4.2? In your installation of esphome, is the file mmc5603.cpp present?

No, it’s not.