Mqtt sensor strange behaviour

Hello everyone,
i’m having some troubles creating a mqtt sensor.
I’m reading an Epever solar charger and i want to publish it on HA. The reading part is not a problem, but it always show Unknown as value. All the other values are ok, just this one it’s not working. If i check in mqtt info i see there are payloads pubblished.
I tried with and without the attribute json_attributes_topic but nothing change. Thanks in advance to who point me to the right direction.


Payload: FLOAT is just a string, I suspect you actually expect to receive a floating point number ?

And please don’t post images of received data, very hard to read and impossible to past in the template editor.

Hello Francisp,
sorry for the inconvenient.
I want the string, so i can see the charging state of my MPPT. It can be “No-charging” (night), FLOAT and BOOST.
How i can extract the received data? just a copy-paste?

If it was json you received, it would be easy, but it does not appear to be json ? What tool did you use to show the received data ?

In the device info box in the mqtt device. The bottom voice is MQTT info. I see the entities, the payload used to create it and the subscribed topics.
I have this data under it:
Dark-matter-test/CHARGING-STATUS (sensor.dark_matter_test_charging_status)
MQTT discovery data:
Topic: homeassistant/sensor/Dark-matter-test/CHARGING-STATUS/config
Payload
unique_id: Dark-matter-test/CHARGING-STATUS
name: Dark-matter-test/CHARGING-STATUS
device_class: null
unit_of_measurement: ‘’
state_topic: Dark-matter-test/CHARGING-STATUS
device:
identifiers:
- Dark-matter-test
manufacturer: Deunan-Enterprises
model: Mark-1
name: Dark-matter-test
sw_version: 0.1 Alpha
platform: mqtt

Subscribed topics:
Dark-matter-test/CHARGING-STATUS
10 most recently received message(s)
Received 18:05:36
QoS: 0
Payload: FLOAT
Received 18:05:38
QoS: 0
Payload: FLOAT
Received 18:05:41
QoS: 0
Payload: FLOAT
Received 18:05:43
QoS: 0

in HA, go to settings → devices & services → mqtt → click configure → under ‘Listen to a topic’

afbeelding

Click ‘Start listening’ and show what HA actually receives

I get the correct value:
Message 100 received on Dark-matter-test/CHARGING-STATUS at 18:20:

FLOAT

QoS: 0 - Retain: false

So you receive 2 strings ? Sorry, that is above my knowledge. I hope someone else can help you.

i receive just one string

Yes, just noticed, the Qos line is not the actual message

In configuration.yaml, this should create a basic sensor :

mqtt:
  sensor:
    - name: "dark matter"
      state_topic: "Dark-matter-test/CHARGING-STATUS"

Creating it manually reads the correct string. Then it’s something in how the sensor is created.
I will dig into it and let you know what i find.
Thanks again for your time