REST sensor not working

Hi,

I’m trying to read data from an json API. I can access the API like this:

core-ssh:~# curl -X GET http://10.101.4.101:8000
{"gridpower": "740.574", "solarpower": "91.926", "totalpower": "832.5"}

I have added the following to my configuration (added the externalip example from https://home-assistant.io/components/sensor.rest/ as wel):

sensor:

  - platform: rest
    resource: http://10.101.4.101:8000
    name: solarpower
    value_template: '{{value_json.solarpower}}'
    
  - platform: rest
    resource: http://ip.jsontest.com
    name: externalip
    value_template: '{{ value_json.ip }}'

I have added the following to my groups:

energieview:
name: Energie
view: yes
icon: mdi:flash
entities:     
  - sensor.solarpower
  - sensor.externalip

But nothing is showing in the group, and can’t see the entity via the dev tools.
Any ideas?

Thanks!!

Try this in both sensors instead:

value_template: '{{value_json.state}}'

Eventually this worked:

- platform: rest
    resource: http://10.101.4.101:8000
    name: Energieverbruik zonnepanelen
    unit_of_measurement: 'W'
    value_template: '{{value_json.solarpower | round(0) }}'

It seems that reloading core & groups was not enough. It only started working after restarting hass.