Help home assistant find my mqtt temperature sensor!

I’ve got the following temperature sensor as a MQTT attribute on a motion sensor. The json looks like this:

3:{7 items
"attribute_type":string"String"
"current_value":string"82"
"description":string"MultiSensor_01_Temperature"
"id":int43
"setting_value":string"255"
"supports_read":booltrue
"supports_write":boolfalse
}

Currently my config.yaml looks like this:

mqtt:
  sensor:
    name: "Temperature Sensor"
    state_topic: "home/wink/7/status"
    json_attributes_topic: "home/wink/7/status/+"
    value_template: "{{ value_json.MultiSensor_01_Temperature}}"

Still nothing showing up in the UI or logs, or developer settings as issues.

I had read something about json_attributes, and that looked hopeful, but then read it’s been deprecated? I keep running over the same topics, but haven’t found anything yet.

TIA!

Post an actual example of a payload published to home/wink/7/status because what you posted appears to be the schema for the payload’s JSON structure (not an actual JSON payload).

Thanks for the reply!
This is what shows on MQTT Explorer for home/wink/7/status

{
  "Alarm_Notifications_On_Off": true,
  "BatteryLevel": 100,
  "MultiSensor_01_Temperature": "255",
  "On_Off": false
}

Not sure if it’s useful, but here’s the auto discovered motion detector on the same device:

{
  "uniq_id": "mqtt_switch.pir_sensor",
  "name": "Pir Sensor",
  "stat_t": "home/wink/7/status/switch/pir_sensor/state",
  "json_attr_t": "home/wink/7/status/switch/pir_sensor/attributes",
  "avty_t": "home/wink/7/status/switch/pir_sensor/availability",
  "pl_off": "off",
  "pl_on": "on",
  "cmd_t": "home/wink/7/status/switch/pir_sensor/set"
}

Searching around, I can’t find anyone that has gotten the temp sensor working via MQTT for this device. I’m a persistent fellow, so I’ll keep banging away at it for a while, but if anyone has a clue to throw at me, it would be welcome.

Thanks!

Your MQT Sensor configuration is missing an important hyphen after the sensor: key.

mqtt:
  sensor:
    - name: "Temperature Sensor"
      state_topic: "home/wink/7/status"
      json_attributes_topic: "home/wink/7/status/+"
      value_template: "{{ value_json.MultiSensor_01_Temperature}}"

NOTE

Based on the information in the auto-discovered motion detector, the value you entered for the temperature sensor’s json_attributes_topic isn’t correct.

1 Like

I doubt the state_topic is correct either to be honest. Given that the discovery for the PIR actually has

home/wink/7/status/switch/pir_sensor/state

I would expect it to be something more like:

home/wink/7/status/sensor/multisensor_01_temperature/state
1 Like

Thank you both for your help. Many of the previous configs elicited no errors or other log entries. The current one does and looks like this:

mqtt:
  sensor:
    -  name: "MultiSensor_01_Temperature"
       state_topic: "home/wink/7/status"
       unit_of_measurement: "F"
       json_attributes_topic: "/home/wink/7/status"
       value_template: "{{ value_json.multisensor_01_temperature }}"

The warning is:

WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'multisensor_01_temperature' when rendering '{{ value_json.multisensor_01_temperature }}'

I have tried a few combinations of state_topic and json_attributes_topic with no luck. Am I missing something obvious? Is there a recognized way to define the topics / templates? Looking about there seems to be a dizzying array of configs that don’t seem to provide any clue how to set mine.

I’ll keep banging away. Thanks!

The error message indicates that the payload received via home/wink/7/status doesn’t contain multisensor_01_temperature. That’s true.

Look closely at the sample payload you posted and the example I posted. Both reference MultiSensor_01_Temperature not multisensor_01_temperature.

Change the capitalization to match the example I posted.

As I have already stated - your state_topic should quite clearly be:

home/wink/7/status/sensor/multisensor_01_temperature/state

Ok. This is what I have now based on both of your recommendations:

mqtt:
  sensor:
    -  name: "MultiSensor_01_Temperature"
       state_topic: "home/wink/7/status/sensor/multisensor_01_temperature/state"
       unit_of_measurement: "F"
       json_attributes_topic: "home/wink/7/status"
       value_template: "{{ value_json.Multisensor_01_Temperature }}"

No errors in the logs, but also nothing shows on the UI.

I appreciate the help!