core: NSW fuel sensors unavailable on boot (api rate error)

The problem

nsw_fuel_station sensors regularly are not available on boot

image

A delay/retry timer should be added to this sensor. I have no programming experience so can’t help 😦

The only solution right now is to delay and then restart and hope that you can get all sensors up without triggering the API limit (10-20% of all boots from my 4 sensor experience).

Environment

  • Home Assistant Core release with the issue: 0.116.4
  • Last working Home Assistant Core release (if known): since inception of this sensor
  • Operating environment (OS/Container/Supervised/Core): Container
  • Integration causing this issue: nsw_fuel_station sensor
  • Link to integration documentation on our website: https://www.home-assistant.io/integrations/nsw_fuel_station/

Problem-relevant configuration.yaml

  - platform: nsw_fuel_station
    #station_name: 'Kissing Pt Rd'  
    station_id: 17126
    fuel_types:
      - E10

  - platform: nsw_fuel_station
    #station_name: 'West Ryde'    
    station_id: 1441
    fuel_types:
      - E10

  - platform: nsw_fuel_station
    #station_name: 'Granville'   
    station_id: 17114
    fuel_types:
      - E10

  - platform: nsw_fuel_station
    #station_name: 'Granville2'   
    station_id: 2141
    fuel_types:
      - E10

Traceback/Error logs

Log error ends in:

requests.exceptions.ConnectionError: HTTPSConnectionPool(host='api.onegov.nsw.gov.au', port=443): Max retries exceeded with url: /FuelCheckApp/v1/fuel/prices/station/17126 (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f6859395700>: Failed to establish a new connection: [Errno -3] Try again')

Additional information

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 17 (9 by maintainers)

Most upvoted comments

No, it happens after no restarts in a month. Then I try to keep restarting to ‘fix’ the problem and roll the dice with api limits.

I think your solution of (possibly) no data for an hour is far more useful than ‘no data until next restart/roll of the dice’. I’ll owe you a beer for your fix 😃

Thanks for the quick reply Nick - detail added.

It has flown under the radar before: https://github.com/home-assistant/core/issues/23280

Please fill out the Environment section of the issue template. Thanks!

Apologies - done.