I’ve been trying to get my Rest sensor to respect the availability condition in my YAML configuration, but it seems like it’s ignoring it. Every time the inverter goes offline, the sensor still tries to pull data, which results in a bunch of errors in the logs. Here’s what my YAML looks like:
yaml
sensor:
- platform: rest
scan_interval: 60
resource: !secret solax_local_ip
payload: !secret solax_local_realtime_payload
method: POST
headers:
X-Forwarded-For: 5.8.8.8
name: “solax_rest_local”
json_attributes:- SN
- ver
- type
- Data
- Information
value_template: ‘Active’
availability: >-
{{ states(‘binary_sensor.192_168_2_35’) == ‘on’ }}
timeout: 30
The logs are full of errors like this:
2024-07-24 01:00:09.471 ERROR (MainThread) [homeassistant.components.rest.data] Error fetching data: http://192.168.2.35/ failed with All connection attempts failed
2024-07-24 01:00:09.471 WARNING (MainThread) [homeassistant.components.rest.util] Empty reply found when expecting JSON data
I’m really confused because I thought the availability condition would prevent the sensor from trying to fetch data when the inverter is offline. Has anyone else encountered this issue? I’d appreciate any advice or suggestions on how to fix this. Thanks!