Configure restfull API

Hi all,

I’m trying to add a restfull intergration like described here.

I’m getting this error now.

homeassistant.exceptions.InvalidStateError: Invalid state encountered for entity ID: sensor.stroom_00_00. State max length is 255 characters.

I don’t understand why. If you go to the api url you can copy the expected output. I pasted it in here to find the jsonpath.
According to this page the value I want to display has this path $.data.0.prijsZP.

My config in configuration.yaml is this:

rest:
  - resource: https://enever.nl/feed/stroomprijs_vandaag.php
    scan_interval: 3600
    sensor:
      - name: "Stroom 00:00"
        json_attributes_path: "$.data.0.prijsZP"
        unit_of_measurement: "Euro"

can you try this path?

data[0].prijsZP

Same error :frowning:

Value_template seems to work. See post [SOLVED] RESTful Sensor.. How to get the right attribute from JSON result

1 Like