Closed eddysteurs closed 2 years ago
since this morning the following error
2021-10-30 13:18:28 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.formula_one_sensor fails Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 438, in async_update_ha_state await self.async_device_update() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 625, in async_device_update raise exc File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run result = self.fn(*self.args, self.kwargs) File "/config/custom_components/formulaone_api/sensor.py", line 236, in update self.set_state() File "/config/custom_components/formulaone_api/sensor.py", line 215, in set_state all_attr = self.get_race_data() File "/config/custom_components/formulaone_api/sensor.py", line 189, in get_race_data races = f1.current_schedule().json File "/config/custom_components/formulaone_api/sensor.py", line 82, in json return self._json.json() File "/usr/local/lib/python3.9/site-packages/requests/models.py", line 910, in json return complexjson.loads(self.text, kwargs) File "/usr/local/lib/python3.9/site-packages/simplejson/init.py", line 525, in loads return _default_decoder.decode(s) File "/usr/local/lib/python3.9/site-packages/simplejson/decoder.py", line 370, in decode obj, end = self.raw_decode(s) File "/usr/local/lib/python3.9/site-packages/simplejson/decoder.py", line 400, in raw_decode return self.scan_once(s, idx=_w(s, idx).end()) simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Same here!
the same issue overhere.
Seems to be because of a block on the API (http://ergast.com/mrd/python-requests-is-currently-disabled/), because of this integration. If I read the code correctly, then this integration polls the API every second, which is against the terms of service.
Python App Issue Thursday, October 28th, 2021
If you’ve published a Python app or wrapper recently would you please check that you are conforming to the rules stated in the Terms and Conditions – specifically the rules concerning calling the API in a loop. The site is currently experiencing very heavy traffic from a Python app where each instance is repeatedly making three requests every 8 seconds. If this continues I will have to block all traffic using Python which would be unfair on other users. If anyone spots an app which might be the source of this traffic please let me know via: admin@ergast.com so I can contact the author.
I saw it was polling every sec. to the host, i have updated to once every 10 min. and i have send a mail to ergast to review it.
Hi Wobbe, Many thanks for letting me know.
I've sent a pull request to it for 1 api call in 10 minutes is that better for you? Not really! Apps should never call the API in a loop (except perhaps for a finite number of retries after an error). It should only call the API in response to a user input e.g. opening a page or view. Cheers, Chris
After the update i got this error message:
Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 438, in async_update_ha_state await self.async_device_update() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 625, in async_device_update raise exc File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run result = self.fn(*self.args, self.kwargs) File "/config/custom_components/formulaone_api/sensor.py", line 236, in update self.set_state() File "/config/custom_components/formulaone_api/sensor.py", line 215, in set_state all_attr = self.get_race_data() File "/config/custom_components/formulaone_api/sensor.py", line 189, in get_race_data races = f1.current_schedule().json File "/config/custom_components/formulaone_api/sensor.py", line 82, in json return self._json.json() File "/usr/local/lib/python3.9/site-packages/requests/models.py", line 910, in json return complexjson.loads(self.text, kwargs) File "/usr/local/lib/python3.9/site-packages/simplejson/init.py", line 525, in loads return _default_decoder.decode(s) File "/usr/local/lib/python3.9/site-packages/simplejson/decoder.py", line 370, in decode obj, end = self.raw_decode(s) File "/usr/local/lib/python3.9/site-packages/simplejson/decoder.py", line 400, in raw_decode return self.scan_once(s, idx=_w(s, idx).end()) simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
That's expected if the request header is still blocked by the API. Based on Chris's answer, there are 2 things this integration needs to account for:
Now the code for the smarter polling seems to be in the source of the integration on which this one is based, so that might be a nice place to start. I don't know enough about python or Home Assistant to make any assumptions on how to do the error handling.
Finally I would suggest that this integration should include a custom User-Agent with the name of the integration and the version number after the code changes and if the integration is approved by Chris. This would make it easier for both parties to resolve any future issues.
The API provider just asked me to deactivate the polling. I've just committed the changes. Everything will be down for the remainder of the season.
Sorry!
Any news on when this polling issue will be resolved? I always loved the integration and it would be great to see it back up and running before the start of the 2022 season.
Any update would be great.
I'm working on it! I have a solution but I will need time to implement it.
I will try to have it ready by the beginning of march.
David Audet
On Tue, 11 Jan 2022 at 15:37, marcous83 @.***> wrote:
Any news on when this polling issue will be resolved? I always loved the integration and it would be great to see it back up and running before the start of the 2022 season.
Any update would be great.
— Reply to this email directly, view it on GitHub https://github.com/delzear/hass-formulaoneapi/issues/13#issuecomment-1010340627, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFRWUZW6J7S5UC6Y2362YLUVSIJVANCNFSM5HA7CZKA . You are receiving this because you commented.Message ID: @.***>
Hi David,
Just wondered if you are still working on a solution on this? Would be great to have this integration back :) thanks!
I had to undergo a surgery on Monday.
I will work on it has soon has I can.
Sorry for the delay!
Hi David,
No, worries. Hope you feel better soon, sending you all of the good and healthy Vibes 😉
Br Christian
Sendt fra E-posthttps://go.microsoft.com/fwlink/?LinkId=550986 for Windows
Fra: @.> Sendt: mandag 28. februar 2022 kl. 00:05 Til: @.> Kopi: @.>; @.> Emne: Re: [delzear/hass-formulaoneapi] update of sensor fails (Issue #13)
I had to undergo a surgery on Monday.
I will work on it has soon has I can.
Sorry for the delay!
Le dim. 27 févr. 2022, 17 h 04, pissten @.***> a écrit :
Hi David,
Just wondered if you are still working on a solution on this? Would be great to have this integration back :) thanks!
— Reply to this email directly, view it on GitHub https://github.com/delzear/hass-formulaoneapi/issues/13#issuecomment-1053697688, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFRWU2JFOTRRIXJ2PDCRCDU5KNXNANCNFSM5HA7CZKA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you commented.Message ID: @.***>
— Reply to this email directly, view it on GitHubhttps://github.com/delzear/hass-formulaoneapi/issues/13#issuecomment-1053713231, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AEA2WTPBJCHXEIJ4J6XI7ELU5KU2TANCNFSM5HA7CZKA. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you commented.Message ID: @.***>
I just published a new version of this integration to reduce the API calls.
HI
Received update drivers and standings look ok but race calendar remains on 2021 Is there something else I need to do?
Asterlaan 16, 2950 Kapellen
Phone +32 473 630 377
Email: ***@***.******@***.***>
From: delzear @.> Sent: maandag 14 maart 2022 16:35 To: delzear/hass-formulaoneapi @.> Cc: eddysteurs @.>; Author @.> Subject: Re: [delzear/hass-formulaoneapi] update of sensor fails (Issue #13)
I just published a new version of this integration to reduce the API calls.
- Reply to this email directly, view it on GitHubhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fdelzear%2Fhass-formulaoneapi%2Fissues%2F13%23issuecomment-1066957896&data=04%7C01%7C%7Ccb469cf24cf94de37ec408da05d022db%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637828688747545540%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=NLjHX4q0fSFX5xI6OcJNEQIjh%2B9%2FWHGeczIcVcF%2FRYM%3D&reserved=0, or unsubscribehttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FACL7WXFKKMUZNQ3KCBADWYDU75MANANCNFSM5HA7CZKA&data=04%7C01%7C%7Ccb469cf24cf94de37ec408da05d022db%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637828688747545540%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=jgvGfHyMmHboDZkKEn8SAjgZCtbe7u4M3MHYJxBzP4E%3D&reserved=0. You are receiving this because you authored the thread.Message ID: @.**@.>>
No, the Ergast API still lists the 2021 season has the current season. I'm working on a workaround
Now working, thanks so much
From: delzear @.> Sent: Tuesday, 15 March 2022 12:48 To: delzear/hass-formulaoneapi @.> Cc: eddysteurs @.>; Author @.> Subject: Re: [delzear/hass-formulaoneapi] update of sensor fails (Issue #13)
No, the Ergast API still lists the 2021 season has the current season. I'm working on a workaround
- Reply to this email directly, view it on GitHubhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fdelzear%2Fhass-formulaoneapi%2Fissues%2F13%23issuecomment-1067895896&data=04%7C01%7C%7C75355141603a4cbc7f0a08da0679ab72%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637829416881960573%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=jc8lGvY9t3VIOkNJqPPMPGA4Yu30BiAR7ukhYNBI%2BLs%3D&reserved=0, or unsubscribehttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FACL7WXEITTKDCEIJ6IHNYA3VAB2GXANCNFSM5HA7CZKA&data=04%7C01%7C%7C75355141603a4cbc7f0a08da0679ab72%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637829416881960573%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=hZ438GyguP5cTdt73mJv4Z1zKCaDByeeguDMphcHezY%3D&reserved=0. You are receiving this because you authored the thread.Message ID: @.**@.>>
You're welcome!
@delzear Its working again. Thank you!
since this morning the following error
2021-10-30 13:18:28 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.formula_one_sensor fails Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 438, in async_update_ha_state await self.async_device_update() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 625, in async_device_update raise exc File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run result = self.fn(*self.args, self.kwargs) File "/config/custom_components/formulaone_api/sensor.py", line 236, in update self.set_state() File "/config/custom_components/formulaone_api/sensor.py", line 215, in set_state all_attr = self.get_race_data() File "/config/custom_components/formulaone_api/sensor.py", line 189, in get_race_data races = f1.current_schedule().json File "/config/custom_components/formulaone_api/sensor.py", line 82, in json return self._json.json() File "/usr/local/lib/python3.9/site-packages/requests/models.py", line 910, in json return complexjson.loads(self.text, kwargs) File "/usr/local/lib/python3.9/site-packages/simplejson/init.py", line 525, in loads return _default_decoder.decode(s) File "/usr/local/lib/python3.9/site-packages/simplejson/decoder.py", line 370, in decode obj, end = self.raw_decode(s) File "/usr/local/lib/python3.9/site-packages/simplejson/decoder.py", line 400, in raw_decode return self.scan_once(s, idx=_w(s, idx).end()) simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)