Identity from topic: rtl_433/events

Hi,

I want to configure an entity from a MQTT events topic, in this case from rtl_433.
Is this possible?

I have the following information:

"topic":"rtl_433/9b13b3f4-rtl433/events"
"payload":{"time":"2021-04-08 18:42:31.770809","protocol":10,"model":"Acurite-Rain","id":10,"rain_mm":1854.0,"mod":"ASK","freq":433.96755,"rssi":-2.5854,"snr":9.6643,"noise":-12.2497}

I already tried this in configuration.yaml, but I’m not sure if this is correct anc it doesn’t work:

  - platform: mqtt
    name: Acurite 896 Rain Gauge event
    state_topic: "rtl_433/9b13b3f4-rtl433/events"
    unique_id: Acurite 896 Rain Gauge event
    unit_of_measurement: "mm"
    value_template: "{{ value_json.payload.rain_mm }}"

Hi @Marc_Hoekstra

I don’t believe you need to reference payload as only the JSON is transferred. In my rtl_433 setup I have the following reference

value_template: "{{ value_json.rain_mm }}"

Full example

  - platform: mqtt
    name: "Shed Probe"
    unit_of_measurement: °C
    device_class: temperature
    state_topic: "rtl_433/Fineoffset-WH5/13"
    value_template: "{{ value_json.temperature_C }}"
    json_attributes_topic: "rtl_433/Fineoffset-WH5/13"
    json_attributes_template: >
      { "humidity": "{{value_json.humidity}}",
        "time": "{{value_json.time}}",
        "temp": "{{value_json.temperature_C}}" }

Hope this helps