Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Integration Availability #80

Open
tango2590 opened this issue Apr 1, 2023 · 11 comments
Open

Integration Availability #80

tango2590 opened this issue Apr 1, 2023 · 11 comments

Comments

@tango2590
Copy link

Integration sensors keep becoming unavailable. Tried reloading a few times with no luck. Yesterday I had some issues with the HTTP 500 error, but reloading seemed to fix it. But ever since, the integration seems unstable. Remote start and Polling fail occasionally. Here's a couple lines from the log:

Remote Start/Polling:

 File "/usr/local/lib/python3.10/site-packages/subarulink/controller.py", line 1276, in _parse_vehicle_status
    status[sc.HEADING] = int(data.get(api.API_HEADING))
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'

Binary Sensors:

  File "/config/custom_components/subaru/binary_sensor.py", line 227, in icon
    return BINARY_SENSOR_ICONS[self.device_class][self.is_on]
  File "/config/custom_components/subaru/binary_sensor.py", line 242, in is_on
    return self.get_current_value() in ON_VALUES[self.device_class]
  File "/config/custom_components/subaru/binary_sensor.py", line 247, in get_current_value
    if data := self.coordinator.data.get(self.vin):
AttributeError: 'NoneType' object has no attribute 'get'
@stboch
Copy link

stboch commented Apr 1, 2023

@tango2590 Please provide a Diagnostic from within Home-Assistant, you can find it under the integration ... menu or the Device Page

@tango2590
Copy link
Author

Sorry for the delay. This is from shortly after the issue. Initial issue occurred April 1st @ 0800, diagnostic download from 0811.
config_entry-subaru-44ae93c0db73d340fad430110cdae677.json.txt

@tango2590
Copy link
Author

Integration (and I specifically mean remote starts) have been fine for a few days, but it just happened again for some reason, It appears the Notification is formatted a little different too. Still a HTTP 500 error though. Screenshot of notification and new diagnostic log attached.
config_entry-subaru-44ae93c0db73d340fad430110cdae677.json (1).txt
Screenshot 2023-04-06 at 20 50 29

@stboch
Copy link

stboch commented Apr 7, 2023

This new issue is known just started today. Working on an update to the latest API version.

@G-Two
Copy link
Owner

G-Two commented Apr 7, 2023

Fix for 404 error has been released as 0.7.6

@tango2590 As for the other errors, I was not able to duplicate, nor did I see any issues with your diagnostic data. Let me know if it persists, and if you can, please paste in the full stack traces the next time the error happens.

@Mark612
Copy link

Mark612 commented Apr 7, 2023

Fix for 404 error has been released as 0.7.6

I couldn't connect all day yesterday, and 0.7.6 fixed the issue. Thank you.

@tango2590
Copy link
Author

tango2590 commented Dec 16, 2023

The "int() as a string" error happened again today when attempting a remote start. What's weird is the remote start command worked 11 minutes prior to this second request. I haven't seen this error since April so not sure what's causing it to randomly happen.

This error originated from a custom integration.

Logger: custom_components.subaru
Source: helpers/update_coordinator.py:300
Integration: Subaru (HACS) (documentation, issues)
First occurred: 08:20:23 (2 occurrences)
Last logged: 08:25:23

Unexpected error fetching subaru_data data: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 300, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 256, in _async_update_data
    return await self.update_method()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/subaru/__init__.py", line 108, in async_update_data
    return await _refresh_subaru_data(hass, entry, vehicles, controller)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/subaru/__init__.py", line 198, in _refresh_subaru_data
    await refresh_subaru(vehicle, controller)
  File "/config/custom_components/subaru/remote_service.py", line 133, in refresh_subaru
    success = await controller.fetch(vin, force=True)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/subarulink/controller.py", line 569, in fetch
    result = await self._fetch_status(vin)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/subarulink/controller.py", line 1058, in _fetch_status
    status = self._parse_vehicle_status(js_resp, vin)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/subarulink/controller.py", line 1285, in _parse_vehicle_status
    status[sc.HEADING] = int(data.get(api.API_HEADING))
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'

@G-Two
Copy link
Owner

G-Two commented Jan 29, 2024

The heading returned from the Subaru API seems to be problematic. It is sometimes null. When it is provided it is seldom correct. The integration doesn't use it, so I might just remove it from subarulink since it provides little value and frequent errors.

@tango2590
Copy link
Author

I saw the change on the python package, but that actually seems to have exacerbated the issue. Previously, the HTTP 500 error only occurred occasionally. But since the change 2 days ago, every remote start attempt results in the HTTP 500 error. Does the HA integration need a change now that headers are no longer used?

@G-Two
Copy link
Owner

G-Two commented Feb 7, 2024

It's not related because I haven't updated this custom component to use subarulink 0.7.10 yet. But even if it were, the changes are all on the client side parsing and have nothing to do with HTTP requests, so they shouldn't cause an HTTP 500.

I'm not sure what you mean when you say that headers are no longer used. Which headers?

@tango2590
Copy link
Author

I just know the headers were removed in the python package, which is when this integration began giving me consistent issues. Might just be a coincidence though. Since then, there's been about an 70% chance that the integration fails a command such as remote start with an HTTP 500 error. Prior to those changes, the integration worked almost flawlessly, with an error occuring maybe a couple times per month at most.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants