Cannot seem to use Material Icons in ESPHome with MAX31856 temp sensor

I just built up a prototype meat thermometer using MAX31856 and ESP8266, I copied the code as it exists on the ESPHome MAX31856 page. To my surprise when I added the integration to Home Assistant the icon used was the standard thermometer type:
image

It’s pretty straightfoward usually, just set the icon value to mdi:grill or something and it should show up in Home Assistant but I tried:

  • mdi:hamburger
  • ‘mdi:hamburger’
  • mdi:grill
  • mdi:food-steak
  • “mdi:grill”
  • “mdi:food-steak”

and every time it comes up with the thermometer. Even after removing the integration and re-adding it. I even tried renaming the sensor so it would be a completely fresh entity to Home Assistant!

Here’s the current yaml:

substitutions:
  node_name: grill
  friendly_name: Grill
  board: nodemcuv2
  restore_from_flash: 'False'
  log_level: DEBUG

packages:
  wifi: !include common/wifi.yaml
  device_base: !include common/device_base_esp8266.yaml

spi:
  clk_pin: D1
  mosi_pin: D2
  miso_pin: D3

sensor:
  - platform: max31856
    name: "Grill Meat Sensor 1"
    icon: "mdi:food-steak"
    cs_pin: D5

What gives?? :frowning:

There will be a copy of the nodes config in the .storage folder. It wont have the same name, open the files to find the matching config. Delete the node in the integration, then delete the file, then restart. You should also backup the text of your sketch in the esphome interface.

You could also just change it on the lovelace card when it’s displayed on a dashboard.

Thanks @Mikefila, I did what you said. I found the file in .storage and then removed the integration, deleted the file, restarted HA. I had the device powered off while doing all of that. Then I plugged the device into power and when it was connected to my WiFi, I added the integration back.

image

Strangely, all the device’s icons work except for the max31856 one! They are all set from the ESPHome YAML file.

I know I can override the icon with a few entries in the customize section but I’ve used this ESPHome icon: field many, many times and it has always worked. This is the first time I’m really struggling with it and I think it might be a bug.

Hah, I’m noticing that there’s a few of my custom icons on a three of my ESPHome devices that aren’t showing up right.

The ones I called out above and:

  • mdi:flower-tulip
  • mdi:candle

seems weird. Anyone else with this issue?

Not a bug - a feature! The MAX31856 ESPHome component uses a device class for the temperature sensor. This will always override an icon specified in ESPHome. Your only option is to use customize in Home Assistant (or maybe edit the entity on the Configuration / Entities page).

I’ve noticed this for a few power sensors.

Thanks for the response @tom_l. You’re right!, here it is in the change log: Changelog - Version 1.17.0 - 4th May 2021 — ESPHome

And from the docs it looks like you can disable it by setting device_class: "" in the ESPHome definition.

That makes me wonder what the benefits are of having the device class defined on an ESPHome sensor for HA to pick up. Aside from it making all the icons the same… I guess any HA unit conversions would all apply. Is there anything else?

1 Like

Neat. I did not know that.

Not a lot for a temperature sensor, other than not having to define the most used icon (thermometer).

For other classes like battery, wifi or the binary sensor classes you get a changing icon.

This is a really good point. I’ll have to keep that in mind when I’m overriding stuff. I prefer leaving the animated icons to do their thing! :+1:t5: