Line graph for mqtt temperature sensor

Hi, i need help with “history_graph” for temperature graph.
I set mqtt sensor:

sensor:
 - platform: mqtt
   name: "temp_sensor_time"
   state_topic: "td-eleven"
   value_template: “{{ value_json[2] }}”

history graph:

history_graph:
  gr1:
    name: test1
    entities:
      - sensor.temp_sensor_data
    hours_to_show: 24

data from MQTT: [“2018-11-21 13:39:21”, ‘test’, 23.6]
However, when data arrives, the sensor registers them, but the graph remains empty. :disappointed_relieved:
temp2
Sorry for my bad english and bad code of configuration.

Try

value_template: "{{ value_json[0].test }}"

Edit:
Sorry my eyes are going - I saw a semi colon next to test. But I think ‘test’ is invalid json, it needs to be in double quotes.

Edit 2:
But you do need two ‘{’. This seems to work in the template editor, even if the ‘test’ isn’t correct. Third time lucky.:sweat:

value_template: "{{ value_json[2] }}"

Sorry, my bad

Yes, i save config with
value_template: "{{ value_json[2] }}"
but graph still empty :frowning:

Should these be the same?

Yes, tihs name from entities list.

I found solution.
In my case
value_template: “{{ value_json[2] }}”
Problem in quotes . I replace from to " and all values become float, not string.

1 Like

Using history graph and MQTT sensor, would it be possible to make a graph for the following day for instance?
In my case I get electricity prices per hour one day in advance and I’d like to plot that in a graph.

With your sensor do you supply it with time as well, or is the time stamp automatic and not changeable?

Thanks

Its automatic time stamp