Get the state of an entity using get request (RESTful API)

Greetings,

I am trying to access the state instead of an attribute of an entity. In my case it is a light. I want to curl and send a get request to grab the information of the state and store it as a JSON file. I have tried to the get request for the light correct, but I get a error 404. Again not sure if my resource link is messed up or etc .I have the api enabled and I am trying to use REST api. Below is config.yaml excerpt and a screenshot of the listed entity.

sensor:
  - platform: template
    sensors:
        light.big_room:
        friendly_name: 'Big Room'
        entity_id: 
            - light.big_room
        value_template: "{{ is.state('sensor.light.big_room.state', 'on')}}"
  - platform: rest
    sensors:
        light.big_room:
        resource: /api/states/sensor/light.big_room
        name: Big Room
        value_template: "{{ state.state('light.big_room') }}"

How about telling us what problem you are actually trying to solve, rather than your chosen solution. Because what you appear to be doing makes no sense me.

1 Like

As Tom says. Why are you trying to read the state of the light using the HA Rest API from inside HA

I would like to export the state of entity into a JSON file. In this case it is the entity of the light in the big room.

Export for what purpose? To be processed by what?