MQQT Sensors from ESPEasy show "unavailable"

Hi all,
I’ve searched the forums, but I could not find anything which solved my problem.
I’m sure it’s a small config error but I’m searching for a week now, time to call in the troops.

I have some ESPeasy devices which are connected to the Moscquitto broker add-on.
I used discovery before (with rules in EASPeasy) and that worked but I found it more tedious to keep the easpEasy rules up to date so I wanted to migrate to configuring them in HAS.

Developer Tools -> Listen to ‘#’ reveals all topics in the expected scheme.
However, in Developer Tools - States the sensors show “unavailable”.

I’m running HASS.io version 3.10 and HAS version 200.

My broker config is default:

logins: []
anonymous: false
customize:
  active: false
  folder: mosquitto
certfile: fullchain.pem
keyfile: privkey.pem

I have created an HAS user ‘MQTT’.
The configuration.yaml section is:

mqtt:
  broker: 192.168.2.100
  username: mqtt
  password: *****
#  discovery: true
#  discovery_prefix: homeassistant

My sensors are configured as follows:

sensor:
######################################
# Elec Meters
######################################
  - platform: mqtt
    name: "Souterrain Electricity Power"
    state_topic: "homeassistant/ESPElecMeters/Electricity-SOU/Power"
    availability_topic: "homeassistant/ESPElecMeters/available"
    device_class: "power"
    unit_of_measurement: "W"
    #icon: mdi:

Other sensors:

  - platform: mqtt
    state_topic: "ESP-Sauna/Inside/Humidity"
    name: "Sauna Inside Humidity"

Generate ‘unknown’ state :thinking:
etc.

Related ESPeasy config:

Controller Publish:	homeassistant/%sysname%/%tskname%/%valname%
Controller LWT Topic: homeassistant/%sysname%/available
Unit name: ESPElecMeters
Device name: Electricity-SOU
Device values: Power (and usage)

I am at a loss what I am doing wrong.
Thanks for any help!

I also used to run ESPeasy on my sonoffs and nodeMCU’s with various sensors attached.
The in built automation engine was amazing for it’s time.

I’ve since switched to ESPhome and haven’t looked back.

It’s configured with the same yaml as Home Assistant, has its own API so doesn’t require mqtt, and personally I’ve found it much more stable. ESPeasy used to give me annoying lock ups and reboots on some devices.

I highly recommend you have a look.
Better still, install the hass.io add-on and have a play !

As mentioned by jivesinger I have moved most of my ESPEasy Wemos D1 Minis over to ESPHome but I still have two that I use on my boiler and watertank which are very stable and I don’t see the need to move them over to ESPHome just yet.

Here is my sensor MQTT settings which may be of use to you

- platform: mqtt  
  state_topic: "/esp01/tempreturn/Temperature"  
  name: "Return Temperature"  
  unit_of_measurement: "°C"  
  
- platform: mqtt  
  state_topic: "/esp01/Uptime/Days" 
  name: "Boiler Uptime" 
  unit_of_measurement: "Days" 
  
- platform: mqtt  
  state_topic: "/esp01/wifi_power/dBm"  
  name: "Boiler WiFi RSSI"  
  unit_of_measurement: "dBm" 
  
- platform: mqtt  
  state_topic: "/esp02/Water Temperature/Temp"  
  name: "Water Temperature"  
  unit_of_measurement: "°C"  
  
- platform: mqtt  
  state_topic: "/esp02/Uptime/Days" 
  name: "Hot Water Uptime" 
  unit_of_measurement: "Days" 
  
- platform: mqtt  
  state_topic: "/esp02/wifi_power/dBm"  
  name: "Hot Water WiFi RSSI"  
  unit_of_measurement: "dBm" 
  
- platform: mqtt  
  state_topic: "/esp02/WaterLeak/WaterLeak"  
  name: "Water Leak"  

Perhaps you need to drop the “homeassistant” part of the sensor and you cannot have two topics per sensor - split them like this

  - platform: mqtt
    name: "Souterrain Electricity Power"
    state_topic: "/ESPElecMeters/Electricity-SOU/Power"
    availability_topic: "/ESPElecMeters/available"
    device_class: "power"
    unit_of_measurement: "W"
	

  - platform: mqtt
    name: "Souterrain Electricity Power Availability"
    availability_topic: "/ESPElecMeters/available"

Thanks all! Turns out to be that “you cannot have two topics per sensor” was the culprit.

I will try to update the documentation.

It’s been a while since i used ESPEasy, but like in BertumUK’s sensor’s, the need a leading / in the topic.
But as said, ESPHome does it!

Thanks, indeed by default ESPeasy has a leading ‘/’, but to enable discovery I replaced that ‘/’ with ‘homeassistant’ topic.

Anyway, it’s all working now!

1 Like