Transmitting sensor data via http does not work!

Yes, I can access the car through the browser! Curl request also ends with 4011234345
Did I create the token correctly?

And you can access it through this ip? Can you please explain your setup and what you want to achieve a bit more detailed?

To ha Lovelace can get access to this IP address! Previously, the remote machine had XA 0.89 AND some temperature and humidity sensors were transmitted via the API. But after upgrading to 106.6 it stopped working! And as you suggested to me, I changed the request. Removed it from the configuration http:, and replaced it with the api: and in the settings that the image in the previous post made a token. What haven’t I done yet or done wrong?

192.168.13.34 configuration.yaml

Configure a default setup of Home Assistant (frontend, api, etc)

default_config:

Uncomment this if you are using SSL/TLS, running in Docker container, etc.

http:

base_url: example.duckdns.org:8123

api:

Text to speech

tts:

  • platform: google_translate

group: !include groups.yaml

automation: !include automations.yaml

script: !include scripts.yaml

scene: !include scenes.yaml

sensor: !include_dir_merge_list sensors/

sensors.yaml 192.168.13.30
- platform: rest
  name: green_homes_1
  resource: http://192.168.13.34:8123/api/states/sensor.online_custom_1
  method: GET
  headers: 
    Authorization: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiI1MjQxYmUxZTgwOTc0Y2M2YWM2M2MzNzU2NDBkMTEwOSIsImlhdCI6MTU4NDYzODcyNiwiZXhwIjoxODk5OTk4NzI2fQ.uos7GdhilezRuye7WuxzPU3WbtHPqlE9BUXX-CUHj5o'
    content-type: 'application/json'
image sensor

2444343434

curl
house@homeassistant:~$ curl -X GET -H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiI2ZTY0MjcwNDY4YjU0YzJkOTRjOTNlMmQ0NGRjYzk3NiIsImlhdCI6MTU4NDY0MTQyOCwiZXhwIjoxOTAwMDAxNDI4fQ.aGhveWyhx5m3CHnm-ZGwBJl9c05b9cX_vTxj1SJ_95s"        -H "Content-Type: application/json" http://192.168.13.34:8123/api/states/sensor.online_custom_1
401: Unauthorized

You forgot Bearer in the beginning of the authorization header. It should be
Bearer dkfjrvdjxbdjdvdkel take a look at the example curl on the page I linked before.

Thank you very much! I wasn’t paying attention! But now the sensor outputs {“message”: “Invalid JSON specified .”} And the old value_template: ‘{{ value_json.state }}’ no longer suitable!

thank you again! everything worked

Glad that you got it to work :slight_smile:
Can you please post the final working configuration for others as a reference? Of course with the token redacted.

The working configuration!

When switching from the old configuration, replace http: with api: in the configuration , and create a token in the profile.

configuration.yaml
# Configure a default setup of Home Assistant (frontend, api, etc)

default_config:

# Uncomment this if you are using SSL/TLS, running in Docker container, etc.

# http:

# base_url: example.duckdns.org:8123

api:

# Text to speech

tts:

- platform: google_translate

group: !include groups.yaml

automation: !include automations.yaml

script: !include scripts.yaml

scene: !include scenes.yaml

sensor: !include_dir_merge_list sensors/
sensors.yaml
- platform: rest
  name: green_homes
  resource: http://IP-HA/api/states/sensor.online_custom
  value_template: "{{ value_json.state }}"
  method: GET
  headers: 
    Authorization: 'Bearer TOKEN'
    content-type: 'application/json'