Transmitting sensor data via http does not work!

Good day! Tell me how you can get this from the remote ha sensor to the local HA? It used to be via the api and rest, but now it doesn ’ t work! Ho w ca n I redo everythin g o n webhook?

The REST API is still there and working. Can you show what doesn’t work?
When did it work last time (which version of HA) and when did it stop working?

When requested http://192.168.0.1/api/states/sensor/sensor.online?api_password=qwerty started giving 401 errors!

Check the REST API docs here.

You need a token to make requests to the rest api. The option you are using has been deprecated a long time ago as far as I know.

From which HA version did you update and which version are you using now?

Version was 0.89 updated to 106.6. Thank you for the direction I will understand!

Phuu that’s a huge jump in versions and a lot happened in the mean time.

I can only recommend updating HA on a more frequent basis. If you wait so long there are a lot of breaking changes that you need to deal with and depending on your setup, it may be even better to start from scratch. Just my two cents.

Thank you very much! And you could tell me what other way to get data from a remote HA without API and MQTT?

Hmm, don’t know any other ways than API and MQTT out of my head. Why do you not want to use API anymore?

To be honest I can 't figure it out myself! Since the last time I did it on a hint and all I did was register it in the configuration.time in YAML on http: api_password:QWERTY and the other severe the sensors platform: Leisure
resource:

http://192.168.0.1:8123/api/states/sensor-да.online_custom?
api_password=QWERTY

name: green_house
force_update: true
value_template: ‘{{ value_json.state }}’ and everything worked!

Read the link I provided, you just need to create a token (explained in the link as well) and add this token to the header of the api request. The sensor etc. stays the same.

Can I give you an example? And the fact that I’m really confused!

Yes you can.

How did you make the call to the REST API in the past?

http://192.168.0.1:8123/api/states/sensor-да.online_custom?api_password=QWERTY
url request or HA sensor.yaml

Did you already create a token on the remote HA instance?

Try like this:

sensor:
  - platform: rest
    name: green_homes
    resource: http://192.168.13.34:8123/api/states/sensor.online_custom
    method: GET
    headers: 
      Authorization: 'Bearer xtokenx'
      content-type: 'application/json'

And replace xtokenx with your token

In the http configuration: Api_password replaced with Api: as written in the manual! I created a token in my profile but there are no results yet!
Returns an error in logs on the requested HA

Logger: homeassistant.components.rest.sensor
Source: components/rest/sensor.py:203 
Integration: rest ([documentation](https://www.home-assistant.io/integrations/rest), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+rest%22)) 
First occurred: 20:39:59 (1 occurrences) 
Last logged: 20:39:59

Error fetching data: http://192.168.13.34:8123/api/states/sensor.online_custom_1 failed with HTTPConnectionPool(host='192.168.13.34', port=8123): Max retries exceeded with url: /api/states/sensor.online_custom_1 (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f5f97f3d050>: Failed to establish a new connection: [Errno 111] Connection refused'))

You get a connection refused error, something wrong with your token. So on the HA instance with IP 192.168.13.34 you created a token, then on the machine you have the code you entered my code with your token? Can you show your config with the token redacted?

- platform: rest
  name: green_homes
  resource: http://192.168.13.34:8123/api/states/sensor.online_custom_1
  method: GET
  headers: 
    Authorization: 'Bearer REMOVED'
    content-type: 'application/json'

I said redact the token :grimacing:

Did you create this token on the machine with ip 192.168.13.34? Do you geg any errors in the logs?

I apologize if I seem stupid to you English is not my native language!You’re right I haven 't completely edited it! Now changed but the token does not work as it should in the sensor it is written 401: Unauthorized

Yes the token was created on a machine with the address 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/

Are you able to access Home Assistant of the machine with the ip 192.168.13.34 from this machine through the browser? Does it work with curl?