Hi
I try to pull some information from an external web service and for some strange reason I manage to get the data the first time after an core restart but all calls afterwards return this error:
ERROR (MainThread) [homeassistant.components.rest.data] Error fetching data: https://website.com failed with [Errno 104] Connection reset by peer
The configuration I have added looks something like this:
sensor:
name: avfall_papir
value_template: >
{% for entry in value_json %}
{% if entry.FraksjonId == 2 %}
{{ entry.Tommedatoer[0] }}
{% endif %}
{% endfor %}
scan_interval: 3600 # once every hour
resource: https://website.com
timeout: 50
verify_ssl: false
headers:
Host: website
User-Agent: Home Assistant
Referer: https://website/
RenovasjonAppKey: XXX
Kommunenr: XXX
cookie: SameSite=None
- platform: template
sensors:
avfall_papir_template:
friendly_name: Papiravfall
value_template: >
{% if states('sensor.avfall_papir') in ['unavailable', 'unknown', 'none'] %}
{{ states('sensor.avfall_papir_template') }}
{% else %}
{{ as_timestamp(states('sensor.avfall_papir')) | timestamp_custom('%d/%m') }}
{% endif %}
When I try to pull the same data with the application “Advanced REST client” it always succeed and return the following data:
[{"FraksjonId":1,"Tommedatoer":["2021-04-22T00:00:00","2021-05-06T00:00:00"]},{"FraksjonId":2,"Tommedatoer":["2021-04-22T00:00:00","2021-05-20T00:00:00"]}]