MQTT Entity Not Displaying Payload

Hi Guys,

MQTT json string, I am able to get all the data with digits.

“{“volts”:“12.84”,“count”:4,“rssi”:-80,“direction”:“Out”,“cars”:4,“level”:1”}"

I cannot get the payload “direction” to display the Text “Out”. It only shows as a “0”

I want to be able to display any Text that is for the entity “direction”

  • platform: mqtt
    unique_id: driveway-direction
    state_topic: “home/driveway/”
    name: Driveway Direction
    value_template: “{{ (value_json.direction | float )}}”
    qos: 2

Cheers

Matt

You’re explicitly asking for the string to be converted to a float.
As it’s not possible, it defaults to zero.
Remove this conversion (and maybe have a look at the doc to understand your own code; yeah, I know, you copied it from somewhere, but still… :wink: )

Hi Chris

Thank you for your reply, I did not remove the “|” before float. :frowning:

Over the past 20 years of self employment I have deployed WiFi data links up to 90kms, setup an WISP Internet company, deploy network of IP Cameras and play with Arduino.

Unfortunately I do not seam to have gripped programming.

I can understand you getting frustrated with Noob’s asking same and or dumb questions, but your help is what keeps us struggling along until we hit the next road block.

I can only hope this post will help others in the future :slight_smile: