How to parse this MQTT message as a value?

with MQTT Explorer, i see this
{“SOC”:63,“raw”:“103E620101EFFBE721EF7E00000000002200001C9E1F1C1D231F1D1F1D003FBE240DBE1900007F002500AA110000A3102600007D580000742728008DE2C300192899000000000BB8”}

how do i create an entity SOC with value of 63? in my config.yml file?

mqtt:
  sensor:
    - name: "Battery SoC"
      unique_id: "any_unique_identifier_here_look_for_a_GUID_generator_or_just_use_text_that_is_unique"
      state_topic: "SoC_topic"
      device_class: "battery"
      unit_of_measurement: "%"
      state_class: measurement # if you want long term statistics, otherwise delete this line
      value_template: "{{ value_json.SOC }}"

it works.
you are amazing! thank you so much

1 Like