Get value from ZB device --> unknown?

Hi.
How to correct this code? (I get “unknown” value)

mqtt:
  sensor:
    - name: "mo_bagno_test_illuminance"    
      state_topic: "zigbee2mqtt/mo_bagno"
      value_template: "{{ value_json.illuminance }}"

Home Assistant OS (on Rasp) - Broker Mosquitto - Z2Mqtt

The topic is most likely not zigbee2mqtt/mo_bagno. You need to use MQTT explorer or some similar software to figure out the actual topic.

Your topic is most likely going to be

homeassistant/<some_unique_id>/<domain>/

Make sure your state topic is correct (case sensitive!)

state_topic: "zigbee2mqtt/mo_bagno"

  sensor:
#    - name: "Frontdoor"
#      state_topic: "sensor/frontdoor"
     

    - name: "mo_bagno_test_illuminance"    
      state_topic: "zigbee2mqtt/Eetkamer"
      value_template: "{{ value_json.illuminance }}"

Be sure to wait until a new mqtt message is received.

Sorry… this code is right.

I just had to wait for the sensor to update (set previously every 60’)… :frowning:

mqtt:
  sensor:
    - name: "mo_bagno_test_illuminance"    
      state_topic: "zigbee2mqtt/mo_bagno"
      value_template: "{{ value_json.illuminance }}"

image