Mqtt I want to use data form /config/mqtt_dump.txt i want 32 that i highlight as shown on the right. how can i get it

mqtt I want to use data form /config/mqtt_dump.txt .
i want 32 that i highlight as shown on the right. how can i get it ?
i want it to be input of payload_template: as shown on the left.
Thank you.

You are going about things a very odd and convoluted way.

Create a mqtt sensor is where you should start.

1 Like

thank you for the advice I did as you suggested.
sensor display {34AB9527089500000005010100 32 8F}
I want the sensor to show only the number 32 that I highlighted in the picture on the left, what should I do?

I am not brilliant at templating, but you need to split the string and choose the second result.

Add a value_template option to your MQTT Sensor definition containing a template that extracts the desired characters from the received string (fifth character from the end to the third character from the end).

mqtt:
  sensor:
    - name: "BBB"
      state_topic: "response/app/34AB95270895/#"
      value_template: "{{ value[-5:-3] }}"
      unit_of_measurement: "C"

The template employs python slicing.

2 Likes

Thank you all for helping @nickrout @123

You’re welcome!

Please consider marking my post above with the Solution tag. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic has been resolved. This helps users find answers to similar questions.

For more information refer to guideline 21 in the FAQ.

1 Like