I'm stuck with REST, sensors don't show up

Hi,

I’m completely stuck with my first REST sensor and I need someone with experience to help me out (or point me in the right direction)…

I’ve filled the configuration.yaml with the most basic example:

rest:
  - resource: http://ip.jsontest.com
    sensor:
      - name: test_rest
        value_template: "{{ value_json.ip }}"

The reason for the RESTFull instead of the REST Sensor is that I tried the sensor first and I couldn’t get that to work as well.

After a full restart of the home-assistant I don’t see the new sensor “test_rest” in my system. (Development → States → search on test_rest, nothing found)

I see in the logging that the sensor actually retrieves my IP address every 15 seconds, so it must be doing something. But how do I get the value in an entity which I can use in an automation or the dashboard?

Extract from the logging:

2024-11-15 15:24:11.759 DEBUG (MainThread) [homeassistant.components.rest.data] Updating from http://ip.jsontest.com
2024-11-15 15:24:11.970 DEBUG (MainThread) [homeassistant.components.rest] Finished fetching rest data data in 0.212 seconds (success: True)
2024-11-15 15:24:11.971 DEBUG (MainThread) [homeassistant.components.rest.data] Data fetched from resource: {"ip": "2001:4c3c:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx"}

Any help would be very very welcome!

Thank you all very much for assisting me.

Kind regards,
Marco

Name is meant to be the friendly name. Try replacing the underscore with a space. The generated entity id will have the underscore in it automatically.

rest:
  - resource: http://ip.jsontest.com
    sensor:
      - name: "Test Rest"
        value_template: "{{ value_json.ip }}"

Thank you @atlflyer!

The spaces or underscores in the name actually didn’t matter, but when I added the quotes, it worked!

Sometimes it just needs the eyes of the master :slight_smile: