ESPresense custom device MQTT sensors not showing up

Hey all,

I’m trying to put together a debug dashboard for ESPresense so I can dial in my various base stations based on real data. The base stations and devices are all set up and reporting correctly. What I’m looking to do is create sensors for each base station that shows RSSI and distance for the 4 devices I’m tracking.

ESPresense has the information I’m looking for in the espresense/devices/$device/$room topics. Here is the espresense/devices/Joe’s iPhone/kitchen JSON:

{
  "id": "Joe’s iPhone",
  "disc": "351f7a16645b68",
  "idType": 250,
  "rssi@1m": -65,
  "rssi": -89,
  "raw": 4.85,
  "distance": 4.62,
  "speed": 0.01,
  "mac": "6dec9993f4be",
  "interval": 1169
}

I have this in my configuration.yaml:

mqtt: !include mqtt.yaml

And in my mqtt.yaml I have the following:

sensor:
  - name: "Joe's iPhone Living Room RSSI"
    state_topic: "espresense/devices/Joe’s iPhone/living_room"
    json_attributes_topic: "espresense/devices/Joe’s iPhone/living_room"
    device_class: signal_strength
    value_template: "{{ value_json.rssi }}"

Ironically, my entity count does go up, but I can’t find this device to save my life. I’ve tried various iterations and I’m coming up empty-handed. Anyone out there manage to get device distance and RSSI from ESPresense using the new mqtt sensor configurations?

This ended up working for me:

sensor:
  - name: "Joe's iPhone Office RSSI"
    unique_id: espresense_joes_iphone_office_rssi
    state_topic: "espresense/devices/Joe’s iPhone/office"
    json_attributes_topic: "espresense/devices/Joe’s iPhone/office"
    availability_mode: any    
    force_update: true
    availability_topic: "espresense/devices/Joe’s iPhone/office"
    availability_template: "online"
    value_template: "{{ value_json.rssi }}"
    icon: "mdi:broadcast"
  - name: "Joe's iPhone Office Distance"
    unique_id: espresense_joes_iphone_office_distance
    state_topic: "espresense/devices/Joe’s iPhone/office"
    json_attributes_topic: "espresense/devices/Joe’s iPhone/office"
    availability_mode: latest    
    availability_topic: "espresense/devices/Joe’s iPhone/office"
    availability_template: "{% if value_json.distance > 0 %}online{% else %}offline{% endif %}"
    value_template: "{{ value_json.distance }}"
    icon: "mdi:signal-distance-variant"    
    device_class: distance
    unit_of_measurement: m

It’s still not entirely clear how I have the sensor always report online, but show the latest value with latest report time other than forcing availability_template: "online". I put both ways I’ve done it and this seems to be the only way to ensure the sensor always reports the last value. I had assumed availability_mode: latest, but maybe I was missing something.

@joestump I, too, am not seeing my device but I am seeing the entity. My sensor is:

#mqtt_room
  - platform: mqtt_room
    name: John iPhone BLE-esp
    device_id: apple:1006:10-12
    state_topic: "espresense/devices"
    timeout: 5
    away_timeout: 30

  - platform: mqtt_room
    name: 'TEST'
    device_id: 123TESTid
    state_topic: "espresense/devices"
    timeout: 5
    away_timeout: 30

Oddly, I use Mult-System Reactor and both entities show up there.