Template sensor config for JSON

Hi all
I have a senor entity_id ensor.sigfox_4d30a7 which has the state {"t":189012}, i.e. a json payload. I want to display 189012 in its own sensor using a template sensor. To do so I must use a value_template but the following config gives an error Could not render template Sigfox time: UndefinedError: 'value_json' is undefined. Any ideas?

sensor:
  - platform: template
    sensors:
      sigfox_time:
        friendly_name: "Sigfox time"
        unit_of_measurement: 'time'
        entity_id: sensor.sigfox_4d30a7
        value_template: '{{value_json.t}}'

I think it should be
value_template: '{{ states.sensor.sigfox_4d30a7.state.t }}'
The entity_id in the template sensor is for reacting on state changes.

No errors but the sensor is blank (no data)…

I’m afraid you might need a custom component

1 Like