g-two / homeassistant-subaru Goto Github PK
View Code? Open in Web Editor NEWSubaru STARLINK custom component for Home Assistant.
License: Apache License 2.0
Subaru STARLINK custom component for Home Assistant.
License: Apache License 2.0
It appears the HACS integration is having trouble connecting to the Subaru API. I will include the error below. Only thing the HA UI says is "Failed to connect". I have tried both the main branch and the pre-commit with no change in behavior. Let me know if any additional info is needed
This error originated from a custom integration.
Logger: custom_components.subaru.config_flow
Source: custom_components/subaru/config_flow.py:63
Integration: Subaru (documentation, issues)
First occurred: 1:19:30 PM (4 occurrences)
Last logged: 1:35:19 PM
Unable to communicate with Subaru API: HTTP 500: {"httpCode":500,"errorCode":"error","errorMessage":"java.lang.ArrayIndexOutOfBoundsException - null"} RequestInfo(url=URL('https://mobileapi.prod.subarucs.com/g2v27/twoStepAuthContacts.json'), method='POST', headers=<CIMultiDictProxy('Host': 'mobileapi.prod.subarucs.com', 'User-Agent': 'HomeAssistant/2023.8.2 aiohttp/3.8.5 Python/3.11', 'Accept': '/', 'Accept-Encoding': 'gzip, deflate', 'Cookie': 'JSESSIONID=60E7EBE11273660D2955D8A914AB2141; X-Oracle-BMC-LBS-Route=4f65eea550dddceedeb77fa2e2997443fe398a63659292929fc9ab849d024abac24349a63cc2b1fe', 'Content-Length': '0', 'Content-Type': 'application/octet-stream')>, real_url=URL('https://mobileapi.prod.subarucs.com/g2v27/twoStepAuthContacts.json'))
I have a custom shortcut on my iPhone that seems to communicate with a different URL using HTTP headers. Info included below
Shortcut using URL: https://www.mysubaru.com/service/g2/requesttype/execute.json
where requesttype
is action to call. Example: "unlock" to unlock doors, "engineStart" to start the car, etc..
Link to Reddit post:
https://www.reddit.com/r/shortcuts/comments/iu9eib/successfully_created_shortcut_for_subaru_starlink/
There is more info in the comments of the post which you may be interested in for more
Example of remote start failure reason:
2020-12-08 13:00:27 INFO (MainThread) [subarulink.controller] Subaru API reports remote service request is in progress: 4S4_1607450418631_22_@NGTP
2020-12-08 13:00:29 DEBUG (MainThread) [subarulink.connection] GET: https://mobileapi.prod.subarucs.com/g2v17/service/g2/remoteService/status.json
2020-12-08 13:00:29 DEBUG (MainThread) [subarulink.controller] {'data': {'cancelled': False,
'errorCode': 'NegativeAcknowledge:doorNotClosed',
'remoteServiceState': 'finished',
'remoteServiceType': 'engineStart',
'result': None,
'serviceRequestId': '4S4_1607450418631_22_@NGTP',
'subState': None,
'success': False,
'updateTime': 1607450428000,
'vin': '4S4'},
'dataName': 'remoteServiceStatus',
'errorCode': None,
'success': True}
2020-12-08 13:00:29 ERROR (MainThread) [subarulink.controller] Remote service request completed but failed: 4S4_1607450418631_22_@NGTP Error: NegativeAcknowledge:doorNotClosed
Currently I only have the odometer sensor after loading this integration into HA via HACS. I've attached a copy of the diagnostics showing I am getting additional data back.
subaru-c6aa80ce45540ab4e50ba7f9e0f986c6-2023 Outback Touring-c778143cf4f458573052e7b05e4a6880.json.txt
I have what seems to be an outlier use case. That is, I'm trying to use this integration twice. We have two starlink accounts, that have separate users/pass/pin. Due to how the integration is written, it's not possible with the current code.
My first attempt at a quicker workaround was to fork this repo and then just change the domain and any other overlapping components. This seemed to work at first, but then I saw inconsistent where either one or the other account could perform remote services.
I think the ultimate issue can be traced to the aiohttp library creating an auth session against the API endpoint. This session seems to overlap between multiple integrations within the home assistant context. Such that if you add a new integration, no matter the domain, the session will be overwritten with the newer auth session.
I might be on my own here, but figured it was worth reaching out in case there were any ideas.
If you don't think this issue is relevant to the project, feel free to close, and I'll try to figure something out.
Im receiving and error on Remote start. All other remote functions are currently working with this exception.
Failed to call service subaru/remote.start. the JSON object must be str, bytes or bytearray, not NoneType
Edit: Added Car info and Log
Model - 2021 Subaru Ascent Premium Trim
Logger: homeassistant.components.websocket_api.http.connection
Source: custom_components/subaru/remote_service.py:62
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 7:35:13 AM (3 occurrences)
Last logged: 4:52:54 PM
[140173696245088] the JSON object must be str, bytes or bytearray, not NoneType
[140173493087536] the JSON object must be str, bytes or bytearray, not NoneType
[140173376046320] the JSON object must be str, bytes or bytearray, not NoneType
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 185, in handle_call_service
await hass.services.async_call(
File "/usr/src/homeassistant/homeassistant/core.py", line 1495, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1530, in _execute_service
await handler.job.target(service_call)
File "/config/custom_components/subaru/init.py", line 125, in async_call_service
await async_call_remote_service(
File "/config/custom_components/subaru/remote_service.py", line 62, in async_call_remote_service
success = await getattr(controller, cmd)(vin)
File "/usr/local/lib/python3.9/site-packages/subarulink/controller.py", line 684, in remote_start
await self.get_climate_settings(vin)
File "/usr/local/lib/python3.9/site-packages/subarulink/controller.py", line 315, in get_climate_settings
self._vehicles[vin]["climate"] = json.loads(js_resp["data"])
File "/usr/local/lib/python3.9/json/init.py", line 339, in loads
raise TypeError(f'the JSON object must be str, bytes or bytearray, '
TypeError: the JSON object must be str, bytes or bytearray, not NoneType
To add support for HACS
Put the following in a file called hacs.json in the root of the project
{ "name": "subaru", "content_in_root": false, "render_readme": true, "iot_class": "Cloud Polling" }
If you check the services that run on the Lovelace UI buttons "Update" and "Poll Vehicle", and verify them against the services that they call (Subaru.update and Subaru.fetch), you'll notice that the descriptions for these services are actually swapped.
The Subaru.fetch service does actually poll the vehicle.
Currently the option to poll the vehicle for new information has two settings: Poll every 2 hours, or disabled. Given the caveat about frequent polling potentially draining the 12V battery, it makes sense that this is disabled by default.
When charging a plug-in hybrid vehicle, it's useful to poll more frequently in order to display the charging status in Home Assistant. This can be accomplished with the following automation:
# request vehicle data updates from Subaru while charging
---
alias: 'Request Subaru data updates while charging'
trigger:
- platform: time_pattern
minutes: "/30"
condition:
- condition: state
entity_id: binary_sensor.subaru_ev_battery_charging
state: 'on'
action:
- service: button.press
data:
entity_id: button.subaru_locate
However, I suspect writing such an automation may not be intuitive to many users, since it requires pressing the "Locate" button". It would be nice if this functionality was instead presented to the user as a third polling option—"Poll only while charging"—which will poll at a 30-minute interval any time the battery charging state is on.
Installed via HACS, adding integration returns the error details below. The same error also occured with the version of the Subaru module built into HA Core (which is why I tried the HACS version).
Logger: custom_components.subaru.config_flow
Source: custom_components/subaru/config_flow.py:59
Integration: Subaru (HACS) (documentation, issues)
First occurred: 1:07:39 PM (1 occurrences)
Last logged: 1:07:39 PM
Unable to communicate with Subaru API: HTTP 500: <coroutine object ClientResponse.text at 0x7f6d0317c0> RequestInfo(url=URL('https://mobileapi.prod.subarucs.com/g2v21/twoStepAuthContacts.json'), method='POST', headers=<CIMultiDictProxy('Host': 'mobileapi.prod.subarucs.com', 'User-Agent': 'HomeAssistant/2022.5.5 aiohttp/3.8.1 Python/3.9', 'Accept': '*/*', 'Accept-Encoding': 'gzip, deflate', 'Cookie': 'JSESSIONID=EAA829EFAC06239B329F4007C4F7E63E; X-Oracle-BMC-LBS-Route=4f65eea550dddceedeb77fa2e2997443fe398a6302222a4a6cf6a9a4be077efb53b7bfbe45671244', 'Content-Length': '0', 'Content-Type': 'application/octet-stream')>, real_url=URL('https://mobileapi.prod.subarucs.com/g2v21/twoStepAuthContacts.json'))
Snip from Full Logs:
/usr/local/lib/python3.9/site-packages/subarulink/connection.py:334: RuntimeWarning: coroutine 'ClientResponse.text' was never awaited
raise SubaruException("HTTP %d: %s %s" % (resp.status, resp.text(), resp.request_info))
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
2022-05-25 13:07:39 ERROR (MainThread) [custom_components.subaru.config_flow] Unable to communicate with Subaru API: HTTP 500: <coroutine object ClientResponse.text at 0x7f6d0317c0> RequestInfo(url=URL('https://mobileapi.prod.subarucs.com/g2v21/twoStepAuthContacts.json'), method='POST', headers=<CIMultiDictProxy('Host': 'mobileapi.prod.subarucs.com', 'User-Agent': 'HomeAssistant/2022.5.5 aiohttp/3.8.1 Python/3.9', 'Accept': '*/*', 'Accept-Encoding': 'gzip, deflate', 'Cookie': 'JSESSIONID=EAA829EFAC06239B329F4007C4F7E63E; X-Oracle-BMC-LBS-Route=4f65eea550dddceedeb77fa2e2997443fe398a6302222a4a6cf6a9a4be077efb53b7bfbe45671244', 'Content-Length': '0', 'Content-Type': 'application/octet-stream')>, real_url=URL('https://mobileapi.prod.subarucs.com/g2v21/twoStepAuthContacts.json'))
No description for services need to identify the vin is needed.
BTW also like the usage of notifications for remote start status.
I've been using the HACS MySubaru Custom Integration for a couple months now. It's always worked flawlessly. Then 2023-11-10 at 10am, all the data (odometer, fuel mileage, tire pressure, etc.) stopped updating for both my Outback and my wife's Outback. I can see the data if I log in to the MySubaru app or website, so it does not appear to be an issue with the vehicles. I restarted Home Assistant, checked for Integration updates, and even removed and re-configured my MySubaru account. Nothing has had any effect. Pressing the Poll Vehicle button seems to complete successfully (no errors) but does not refresh any of the entities.
All the entities (except remote start, which still works) show as unavailable. When I tried to press the Refresh button (button.ryans_outback_refresh), I got the following error: Failed to call service button/press. time data 2023-11-11T04:21:39.000+0000' does not match format '%Y-%m-%dT%H:%M:%S%z
Unsure if that's related to my current issue.
I really enjoy this Integration, and has been quite useful in my home. Any assistance is appreciated. Thanks.
Ignition status of the engine consistently shows off. I have a Gen2 vehicle with everything else working. Looking back at the sensor data, it has never actually shown to be "on". I get the confirmation that the engine started on my phone from the MySubaru app, but I was hoping to initiate a voice command through Alexa based on ignition status for an audio confirmation.
Will there be any plans to be able to call remote start with a user preset? This appears to be a new feature in starlink.
When I press lock or unlock I receive this error
failed to call service lock/lock. cannot unpack non-iterable NoneType object
If there is anything else I can provide to help isolate this issue, I will be more than willing.
Thanks!
I think that ensuring that what ever is in starlink is up to date regularly can be helpful. The 2 hour locate may be a little heavy when it's just necessary to sync homeassistant with starlink.
I haven't been able to pin down if this is related to the 2023.07 update or not, but yesterday my device_tracker entity for my 2019 Subaru Forrester went unavailable. I think the Lat and Lon are appearing in the diagnostics, but they are redeacted.
config_entry-subaru-362393d662e05f9cc7a1ec28b5ac4371.json.txt
`Logger: homeassistant.components.device_tracker
Source: helpers/entity.py:459
Integration: Device tracker (documentation, issues)
First occurred: 9:14:33 PM (2 occurrences)
Last logged: 9:14:33 PM
Error adding entities for domain device_tracker with platform subaru
Error while setting up subaru platform for device_tracker
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 504, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 680, in _async_add_entity
f"{device_name} {entity.suggested_object_id}"
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 459, in suggested_object_id
if self.class.name.fget is Entity.name.fget and self.platform: # type: ignore[attr-defined]
^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'fget'`
When starting up Home Assistant 2022.10.x, I get the following warnings
WARNING (MainThread) [homeassistant.helpers.frame] Detected integration that uses volume utility. This is deprecated since 2022.10 and will stop working in Home Assistant 2023.4, it should be updated to use unit_conversion.VolumeConverter instead. Please report issue to the custom integration author for subaru using this method at custom_components/subaru/sensor.py, line 55: L_PER_GAL = vol_convert(1, VOLUME_GALLONS, VOLUME_LITERS)
WARNING (MainThread) [homeassistant.helpers.frame] Detected integration that uses distance utility. This is deprecated since 2022.10 and will stop working in Home Assistant 2023.4, it should be updated to use unit_conversion.DistanceConverter instead. Please report issue to the custom integration author for subaru using this method at custom_components/subaru/sensor.py, line 56: KM_PER_MI = dist_convert(1, LENGTH_MILES, LENGTH_KILOMETERS)
2023.4 is a ways off, but figured it should be noted.
Hi All, so everytime I try to upgrade the software from HACS, I get the following error and have to roll back to the previous version I was on. Can anyone help with this?
subaru
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 382, in async_setup
result = await component.async_setup_entry(hass, self)
File "/config/custom_components/subaru/init.py", line 102, in async_setup_entry
vehicles[vin] = _get_vehicle_info(controller, vin)
File "/config/custom_components/subaru/init.py", line 220, in _get_vehicle_info
VEHICLE_API_GEN: controller.get_api_gen(vin),
File "/usr/local/lib/python3.10/site-packages/subarulink/controller.py", line 362, in get_api_gen
_LOGGER.debug("Getting vehicle API gen %s:%s", vin, result)
UnboundLocalError: local variable 'result' referenced before assignment
I had the integration working with my vehicle on a previous installation of HA, on docker with and a manual installation. I recently migrated to HA OS and installed the integration via HACS.
After setting up the integration, I entered my pin and it was accepted, but shows the message "Failed to setup"
In the log I see two errors (below), but I it indicates that one is cause by the first not being handled.
I've confirmed it is still working through the Subaru app and I know the vehicle should be supported as it was connected before.
Error 1
This error originated from a custom integration.
Logger: subarulink.controller
Source: custom_components/subaru/__init__.py:218
Integration: Subaru (HACS) (documentation, issues)
First occurred: 2:48:43 PM (3 occurrences)
Last logged: 3:18:26 PM
Unhandled API error code DEVICE_NOT_AUTHENTICATED
Error 2
Logger: homeassistant.config_entries
Source: config_entries.py:402
First occurred: 2:48:43 PM (3 occurrences)
Last logged: 3:18:26 PM
Error setting up entry [MY EMAIL] for subaru
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 402, in async_setup
result = await component.async_setup_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/subaru/__init__.py", line 103, in async_setup_entry
vehicles[vin] = await _get_vehicle_info(controller, vin)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/subaru/__init__.py", line 218, in _get_vehicle_info
VEHICLE_HAS_POWER_WINDOWS: await controller.has_power_windows(vin),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/subarulink/controller.py", line 286, in has_power_windows
await self.get_data(vin)
File "/usr/local/lib/python3.11/site-packages/subarulink/controller.py", line 409, in get_data
await self.fetch(vin)
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 1081, in _fetch_status
raise err
File "/usr/local/lib/python3.11/site-packages/subarulink/controller.py", line 1067, in _fetch_status
js_resp = await self._remote_query(vin, api.API_CONDITION)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/subarulink/controller.py", line 975, in _remote_query
js_resp = await self._get(cmd.replace("api_gen", api_gen))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/subarulink/controller.py", line 910, in _get
self._check_error_code(js_resp)
File "/usr/local/lib/python3.11/site-packages/subarulink/controller.py", line 934, in _check_error_code
raise SubaruException(f"Unhandled API error: {error} - {js_resp}")
subarulink.exceptions.SubaruException
I've been noticing these errors in the logs and whenever the entities for my vehicle become unavailable.
I figure it's a rate-limiting issue, but could be something else. The SXM is confusing since I don't have a subscription to Sirius but do have a subscription for remote services. Could be a coincidence though.
Subaru Crosstrek 2018
In both versions I've tested (v0.5.2 and v0.6.0rc5) home assistant says the external temperature sensor.<VIN>_external_temp
is "Unavailable". I testing with the official home assistant integration and I do get the temperature reading.
This is for a 2019 Forester and Home Assistant 2021.12.5
I'm running Home Assistant OS as a VM in Proxmox and have been unable to add this integration. When I copy and paste the repository url into "manage add-on repositories" I get the following error message: "https://github.com/G-Two/homeassistant-subaru is not a valid add-on repository".
Is this the expected behavior?
Tire pressure entities are unavailable in Home Assistant. I'm also seeing the following errors in the logs that may point to a script failure during tire processing.
Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 455, in async_add_entities await asyncio.gather(*tasks) File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 731, in _async_add_entity await entity.add_to_platform_finish() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 823, in add_to_platform_finish self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 568, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 635, in _async_write_ha_state attr.update(self.extra_state_attributes or {}) File "/config/custom_components/subaru/sensor.py", line 284, in extra_state_attributes "Recommended pressure": info[ KeyError: 'FRONT_TIRES'
config_entry-subaru-1e404d34d787bf760c63ae31d7204b7a.json.txt
this might have been planed but did catch my scripts off guard. if this is a deprecated service add to release notes and update readme.md
This integration has been working wonderfully over the last couple years. I last used it last night to remote start my car without an issue. However, today I went to remote start it and it failed. In fact, the entire integration is having an issue connecting. None of the sensors are available. My vehicle is still accessible through the MySubaru app and the website. I've attempted reloading the integration a couple times as well as HA with no luck.
I've pasted the logs from HA below.
HomeAssistant Version: 2022.11.4
HA Supervisor: 2022.11.2
Running on a RPie w/ OS 9.3
Log Details (ERROR)
This error originated from a custom integration.
Logger: subarulink.connection
Source: custom_components/subaru/__init__.py:80
Integration: Subaru (HACS) (documentation, issues)
First occurred: 17:37:45 (174 occurrences)
Last logged: 19:29:15
RequestInfo(url=URL('https://mobileapi.prod.subarucs.com/g2v21/login.json'), method='POST', headers=<CIMultiDictProxy('Host': 'mobileapi.prod.subarucs.com', 'User-Agent': 'Mozilla/5.0 (Linux; Android 10; Android SDK built for x86 Build/QSR1.191030.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/74.0.3729.185 Mobile Safari/537.36', 'Origin': 'file://', 'X-Requested-With': 'com.subaru.telematics.app.remote', 'Accept-Language': 'en-US,en;q=0.9', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Content-Length': '158', 'Content-Type': 'application/x-www-form-urlencoded')>, real_url=URL('https://mobileapi.prod.subarucs.com/g2v21/login.json'))
('<!doctype html><html lang="en"><head><title>HTTP Status 404 – Not ' 'Found</title><style type="text/css">body ' '{font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b ' '{color:white;background-color:#525D76;} h1 {font-size:22px;} h2 ' '{font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;} ' '.line ' '{height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP ' 'Status 404 – Not Found</h1><hr class="line" /><p><b>Type</b> Status ' 'Report</p><p><b>Description</b> The origin server did not find a current ' 'representation for the target resource or is not willing to disclose that ' 'one exists.</p><hr class="line" /><h3>Apache ' 'Tomcat/8.5.58</h3></body></html>')
I’m getting the following error when trying to remote start from the Lovelace ui:
‘remote_start command failed for Subaru Ascent: Climate preset 'None' does not exist‘
I built the UI per the YAML example.
I’m assuming something else is needed? I see references to climate in the separate service section of the readme- so probably user error on my part (apologies!)
with the new energy features in version 2021.8 VOLT has been renamed to ELECTRIC_POTENTIAL_VOLT
Hi, I'm having trouble with this excellent HACS add-on and hoping you can help. I updated the HACS Subaru link to the latest version. When I did that and restarted HA, I now get the following error and the integration fails to load:
TypeError: SensorEntityDescription.init() got an unexpected keyword argument 'translation_key'
I'm a bunch of version behind on HA -- I'm on Home Assistant 2022.11.5. Could that be it? Or any other pointers?
Thank you!
I personally would prefer to not have a notification every time I call a Subaru service. I've looked though your code and can only tell that the notification ID is assigned the DOMAIN variable. I'm not a developer and can't identify where the value of DOMAIN is pulled from to call persistent_notification.dismiss
Can you please give me some information or if this is a possible use case for this integration, allow the notifications to be disabled unless there's an error message.
All said, this is by far the most functional integration in all of HA. Thank you.
I'm having an issue. I installed the integration and linked it to my Starlink account but then realized my subscription didn't include all sensors available so I removed the integration completely (restarted after, etc) and upgraded my Starlink subscription to include the rest of the sensors. Now when I try to install the integration again it gets to the "PIN" field and whenever I enter it, it states my "PIN is incorrect" even though I know it's not and it worked before.
Is there something cached on HA I need to clean up, any idea what's happening here?
Thanks!
Hi there - attempted to start my car from HA and it wouldn't work, so I checked the logs and the integration isn't loading anymore?
I see this error:
Error setting up entry [email protected] for subaru
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 304, in async_setup
result = await component.async_setup_entry(hass, self) # type: ignore
File "/config/custom_components/subaru/init.py", line 79, in async_setup_entry
await controller.connect()
File "/usr/local/lib/python3.9/site-packages/subarulink/controller.py", line 88, in connect
self._parse_vehicle(vehicle)
File "/usr/local/lib/python3.9/site-packages/subarulink/controller.py", line 740, in _parse_vehicle
vin = vehicle["vin"].upper()
TypeError: 'NoneType' object is not subscriptable
I have tried rebooting HA multiple times. I have solid internet, and all of my other integrations that are cloud based seem ok. Any thoughts? No changes overnight, on core-2021.10.6 and OS 6.5.
Looking at the diagnostics file I can see that sunroof should be supported as my vehicle reports the correct feature PANPM-DG2G
and state "windowSunroofStatus": "CLOSE",
regarding power windows I do see the states in the diagnostics file however I do not see the defined const, maybe it changed in my car?
"windowFrontLeftStatus": "CLOSE",
"windowFrontRightStatus": "CLOSE",
"windowRearLeftStatus": "CLOSE",
"windowRearRightStatus": "CLOSE",
would love to get support for these if possible!
No matter what I do(manually starting from the Subaru app from a preset or manually choosing climate settings), everytime I start from HA it always starts with my climate set to 65. In the summer, this wasn't really an issue, but now that it's cold out I really want the system to heat up my car and start melting snow. How can I change the default climate setting that the integration starts using?
This integration is only createing 2 entities, door lock and odometer for newer models using gen 3 telematics. I am guessing it is defaulting to gen 1.
https://mobileapi.prod.subarucs.com/g2v24/login.json
Shows as 404 in the logs
I'm using the latest HACS version (v0.7.0). Seems like the timestamp that is returned for the EV Time to Full Charge isn't being parsed properly, which causes the entire integration to fail.
This error originated from a custom integration.
Logger: custom_components.subaru
Source: custom_components/subaru/remote_service.py:120
Integration: Subaru (HACS) (documentation, issues)
First occurred: December 5, 2022 at 10:40:20 PM (82 occurrences)
Last logged: 11:13:54 AM
Unexpected error fetching subaru_data data: 'eventDateStr'
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 205, in _async_refresh
self.data = await self._async_update_data()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 164, in _async_update_data
return await self.update_method()
File "/config/custom_components/subaru/__init__.py", line 105, in async_update_data
return await _refresh_subaru_data(hass, entry, vehicles, controller)
File "/config/custom_components/subaru/__init__.py", line 199, in _refresh_subaru_data
await refresh_subaru(vehicle, controller)
File "/config/custom_components/subaru/remote_service.py", line 120, in refresh_subaru
success = await controller.fetch(vin, force=True)
File "/usr/local/lib/python3.10/site-packages/subarulink/controller.py", line 504, in fetch
result = await self._fetch_status(vin)
File "/usr/local/lib/python3.10/site-packages/subarulink/controller.py", line 977, in _fetch_status
status = self._parse_condition(js_resp, vin)
File "/usr/local/lib/python3.10/site-packages/subarulink/controller.py", line 1206, in _parse_condition
keep_data[sc.EV_TIME_TO_FULLY_CHARGED_UTC] = data[api.API_TIMESTAMP] + timedelta(
KeyError: 'eventDateStr'
Just as the title states, all of the sensors show as unavailable. This is on a brand new install of HA, HACS and this extension. I have a Subaru Forester Sport 2019, so I would assume these are supported, but I'm not sure of the troubleshooting steps necessary to solve this. I'm sorry if this is a newbie question, this is my first install of HA and I'm doing my best to figure it out 😅
The lock command has been failing recently with the following error:
lock command failed for JF2GTHSCXMH285553: HTTP 500: {"httpCode":500,"errorCode":"error","errorMessage":"java.lang.NullPointerException - null"} RequestInfo(url=URL('https://mobileapi.ca.prod.subarucs.com/g2v27/service/g2/remoteService/status.json?serviceRequestId=JF2GTHSCXMH285553_1696350839345_20_@NGTP'), method='GET', headers=<CIMultiDictProxy('Host': 'mobileapi.ca.prod.subarucs.com', 'User-Agent': 'Mozilla/5.0 (Linux; Android 10; Android SDK built for x86 Build/QSR1.191030.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/74.0.3729.185 Mobile Safari/537.36', 'Origin': 'file://', 'X-Requested-With': 'ca.subaru.telematics.remote', 'Accept-Language': 'en-US,en;q=0.9', 'Accept-Encoding': 'gzip, deflate', 'Accept': '/', 'Cookie': 'JSESSIONID=88E16CA6EC274E845CA877782B07A3F6; X-Oracle-BMC-LBS-Route=edfba615976e065ee5f0d8b86c4407c36046567791298f75028beb1a771f42d57a0731b7bb9e0c7b')>, real_url=URL('https://mobileapi.ca.prod.subarucs.com/g2v27/service/g2/remoteService/status.json?serviceRequestId=JF2GTHSCXMH285553_1696350839345_20_@NGTP'))
I'm not sure if this is caused by my latest Home Assistant update or whether Subaru changed something on their side.
Starlink will send push notifications and email alerts when things like windshield wiper fluid are low. Are those alerts visible through the api? If so, can these be added as sensors?
Sorry if this is a newbie question, but I just setup this via HACS with a vanilla install and it's not giving me any presets for climate options. I checked out the other issues and #41 suggests setting a custom (non stock) preset in the mobile app which I did. Is there a way to refresh these options? I'm just using the GUI at the moment, I am very new to HA and this was my first time setting up a HACS extension.
Someone stole a gear bag out of my car on two separate occasions, once while I was literally 20ft away in my house packing anothrer dufflebag and another time while I was asleep and forgot to lock my doors. So this addon has suddenly become incredibly important to me.
Cops are useless, so the video camera I have recording my car almost became a waste of money, however I rediscovered the flash lights and honk horn buttons. Now, when there's any motion detected around my car, this home assistant automation will lock my doors, just in case and start the lights flashing and horn honking. This works so well, fortunately it's only scared away a cat so far at 3am, but one issue I have is with the errors when I'm loading up into the car or driving in.
My home assistant persistent notifications are full of failure notifications because the ignition is on when the command is received. I do check the device tracker location for the vehicles location and if ignition sensor is on, but that isn't always accurate. I still want to have errors logged if the API fails, however I run all my automation in node red, so I can detect errors and act on them mid flow.
It would be nice to have the notification setting just log all errors to the home assistant logs and disable persistent notifications, or filter out ignition on responses.
I seriously can't thank you enough for developing this, at first it was just convenient to warm up the car in the morning, but it's proving to be the single most valuable software I've ever used.
V0.6.2
It took a weird level to work, interesting it seems that sometimes the update function which is triggering a location BTW.
Door: Open / Closed
Window: Open / Close
Seat_belt: Belted / Not_equipped / (never could get anything other than belted, not equipped, or unknown)
Seat_occupation: seems to never work not sure about that...
{'data': {'cancelled': False,
'errorCode': None,
'remoteServiceState': 'finished',
'remoteServiceType': 'condition',
'result': {'lastUpdatedTime': '2020-12-08T18:00:58+0000',
'odometer': 12986882,
'vehicleStatus': [{'key': 'TRANSMISSION_MODE',
'value': 'PARK'},
{'key': 'TYRE_PRESSURE_REAR_RIGHT',
'value': '32767'},
{'key': 'SEAT_BELT_STATUS_THIRD_MIDDLE',
'value': 'UNKNOWN'},
{'key': 'SEAT_OCCUPATION_STATUS_FRONT_RIGHT',
'value': 'UNKNOWN'},
{'key': 'SEAT_BELT_STATUS_FRONT_MIDDLE',
'value': 'NOT_EQUIPPED'},
{'key': 'DOOR_FRONT_LEFT_LOCK_STATUS',
'value': 'UNKNOWN'},
{'key': 'EXT_EXTERNAL_TEMP',
'value': '-64.0'},
{'key': 'WINDOW_BACK_STATUS',
'value': 'UNKNOWN'},
{'key': 'WINDOW_REAR_LEFT_STATUS',
'value': 'CLOSE'},
{'key': 'SEAT_BELT_STATUS_SECOND_MIDDLE',
'value': 'UNKNOWN'},
{'key': 'SEAT_OCCUPATION_STATUS_THIRD_RIGHT',
'value': 'UNKNOWN'},
{'key': 'DOOR_FRONT_LEFT_POSITION',
'value': 'OPEN'},
{'key': 'TYRE_PRESSURE_FRONT_RIGHT',
'value': '32767'},
{'key': 'SEAT_BELT_STATUS_THIRD_RIGHT',
'value': 'UNKNOWN'},
{'key': 'DOOR_REAR_RIGHT_POSITION',
'value': 'CLOSED'},
{'key': 'DISTANCE_TO_EMPTY_FUEL',
'value': '16383'},
{'key': 'SEAT_BELT_STATUS_FRONT_LEFT',
'value': 'BELTED'},
{'key': 'SEAT_OCCUPATION_STATUS_FRONT_MIDDLE',
'value': 'NOT_EQUIPPED'},
{'key': 'TYRE_STATUS_REAR_LEFT',
'value': 'UNKNOWN'},
{'key': 'DOOR_BOOT_POSITION',
'value': 'CLOSED'},
{'key': 'AVG_FUEL_CONSUMPTION',
'value': '16383'},
{'key': 'TYRE_PRESSURE_FRONT_LEFT',
'value': '32767'},
{'key': 'DOOR_REAR_RIGHT_LOCK_STATUS',
'value': 'UNKNOWN'},
{'key': 'SEAT_BELT_STATUS_SECOND_RIGHT',
'value': 'UNKNOWN'},
{'key': 'POSITION_SPEED_KMPH',
'value': '0'},
{'key': 'DOOR_FRONT_RIGHT_POSITION',
'value': 'CLOSED'},
{'key': 'SEAT_OCCUPATION_STATUS_FRONT_LEFT',
'value': 'UNKNOWN'},
{'key': 'DOOR_REAR_LEFT_LOCK_STATUS',
'value': 'UNKNOWN'},
{'key': 'SEAT_OCCUPATION_STATUS_SECOND_MIDDLE',
'value': 'UNKNOWN'},
{'key': 'POSITION_TIMESTAMP',
'value': '2020-12-08T17:58:50Z'},
{'key': 'DOOR_ENGINE_HOOD_POSITION',
'value': 'CLOSED'},
{'key': 'BATTERY_VOLTAGE',
'value': '11.8'},
{'key': 'TYRE_PRESSURE_REAR_LEFT',
'value': '32767'},
{'key': 'SEAT_BELT_STATUS_SECOND_LEFT',
'value': 'UNKNOWN'},
{'key': 'WINDOW_REAR_RIGHT_STATUS',
'value': 'CLOSE'},
{'key': 'WINDOW_FRONT_RIGHT_STATUS',
'value': 'OPEN'},
{'key': 'TYRE_STATUS_FRONT_LEFT',
'value': 'UNKNOWN'},
{'key': 'SEAT_OCCUPATION_STATUS_SECOND_LEFT',
'value': 'UNKNOWN'},
{'key': 'SEAT_OCCUPATION_STATUS_SECOND_RIGHT',
'value': 'UNKNOWN'},
{'key': 'SEAT_OCCUPATION_STATUS_THIRD_LEFT',
'value': 'UNKNOWN'},
{'key': 'SEAT_BELT_STATUS_THIRD_LEFT',
'value': 'UNKNOWN'},
{'key': 'ODOMETER', 'value': '12986882'},
{'key': 'POSITION_HEADING_DEGREE',
'value': '239'},
{'key': 'WINDOW_FRONT_LEFT_STATUS',
'value': 'CLOSE'},
{'key': 'SEAT_OCCUPATION_STATUS_THIRD_MIDDLE',
'value': 'UNKNOWN'},
{'key': 'DOOR_REAR_LEFT_POSITION',
'value': 'CLOSED'},
{'key': 'DOOR_ENGINE_HOOD_LOCK_STATUS',
'value': 'UNKNOWN'},
{'key': 'VEHICLE_STATE_TYPE',
'value': 'UNKNOWN'},
{'key': 'WINDOW_SUNROOF_STATUS',
'value': 'UNKNOWN'},
{'key': 'TYRE_STATUS_FRONT_RIGHT',
'value': 'UNKNOWN'},
{'key': 'SEAT_BELT_STATUS_FRONT_RIGHT',
'value': 'BELTED'},
{'key': 'TYRE_STATUS_REAR_RIGHT',
'value': 'UNKNOWN'},
{'key': 'DOOR_BOOT_LOCK_STATUS',
'value': 'UNKNOWN'},
{'key': 'DOOR_FRONT_RIGHT_LOCK_STATUS',
'value': 'UNKNOWN'}]},
'serviceRequestId': None,
'subState': None,
'success': True,
'updateTime': None,
'vin': '4S4B'},
'dataName': 'remoteServiceStatus',
'errorCode': None,
'success': True}
Having some issues with the integration. Usually a reload fixes it but this time it didn't. Component was out-of date so I tried updating but the UI just says "Failed to set up" (logs below). I've also tried restarting HA, uninstalling and reinstalling the integration and HACS component, and downgrading.
Any help would be appreciated.
This error originated from a custom integration.
Logger: homeassistant.config_entries
Source: custom_components/subaru/__init__.py:218
Integration: Subaru (HACS) (documentation, issues)
First occurred: 12:13:25 PM (2 occurrences)
Last logged: 12:15:05 PM
Error setting up entry [emailredacted]@gmail.com for subaru
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 388, in async_setup
result = await component.async_setup_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/subaru/__init__.py", line 103, in async_setup_entry
vehicles[vin] = await _get_vehicle_info(controller, vin)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/subaru/__init__.py", line 218, in _get_vehicle_info
VEHICLE_HAS_POWER_WINDOWS: await controller.has_power_windows(vin),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/subarulink/controller.py", line 286, in has_power_windows
await self.get_data(vin)
File "/usr/local/lib/python3.11/site-packages/subarulink/controller.py", line 409, in get_data
await self.fetch(vin)
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 1070, in _fetch_status
status = await self._parse_condition(js_resp, vin)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/subarulink/controller.py", line 1304, in _parse_condition
keep_data[sc.TIMESTAMP] = datetime.strptime(data[api.API_LAST_UPDATED_DATE], api.API_TIMESTAMP_FMT)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/_strptime.py", line 568, in _strptime_datetime
tt, fraction, gmtoff_fraction = _strptime(data_string, format)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/_strptime.py", line 349, in _strptime
raise ValueError("time data %r does not match format %r" %
ValueError: time data '2023-11-09T20:10:22.000+0000' does not match format '%Y-%m-%dT%H:%M:%S%z'
Upgraded to the latest beta release for HA Core (2022.12.0b2) and the integration is no longer starting up. All I see is the below in the logs.
Config entry 'redacted' for subaru integration not ready yet; Retrying in background
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'
Greetings and thank you for this integration. Being able to interface/control my vehicles via home assistant is wonderful. I recently upgraded to 0.6 and attempted to use one of the newly-created button entities, specifically remote_start. Upon pressing it HA throws the following error:
Failed to call service button.press. Service remote_start failed for Forester: Climate preset 'None' does not exist
I’m not sure there’s a way to add service data to a button entity generated by an integration. What do you think about assigning the default preset of 'Auto' to the entity upon creation?
Hello,
I recently lost access to MySubaru via Home assistant. When attempting to reconfigure the integration, I get a UI dialog that says "Cannot connect". The Home assistant logs record the following:
This error originated from a custom integration.
Logger: custom_components.subaru.config_flow
Source: custom_components/subaru/config_flow.py:63
Integration: Subaru (HACS) (documentation, issues)
First occurred: December 13, 2023 at 7:39:04 PM (3 occurrences)
Last logged: 4:08:43 PMUnable to communicate with Subaru API: HTTP 404: <!doctype html><title>HTTP Status 404 – Not Found</title><style type="text/css">body {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {color:white;background-color:#525D76;} h1 {font-size:22px;} h2 {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style>
HTTP Status 404 – Not Found
Type Status Report
Description The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.
Apache Tomcat/9.0.76
RequestInfo(url=URL('https://mobileapi.prod.subarucs.com/g2v27/login.json'), method='POST', headers=<CIMultiDictProxy('Host': 'mobileapi.prod.subarucs.com', 'User-Agent': 'Mozilla/5.0 (Linux; Android 10; Android SDK built for x86 Build/QSR1.191030.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/74.0.3729.185 Mobile Safari/537.36', 'Origin': 'file://', 'X-Requested-With': 'com.subaru.telematics.app.remote', 'Accept-Language': 'en-US,en;q=0.9', 'Accept-Encoding': 'gzip, deflate', 'Accept': '/', 'Content-Length': '162', 'Content-Type': 'application/x-www-form-urlencoded')>, real_url=URL('https://mobileapi.prod.subarucs.com/g2v27/login.json'))
After upgrading to HA 2022.7.1 I am no longer getting a location for my 2016 XTrek. All other sensors & function works as expected.
Here is the only log entry I located.
Logger: homeassistant.components.device_tracker
Source: helpers/entity.py:459
Integration: Device tracker (documentation, issues)
First occurred: July 9, 2023 at 9:13:56 AM (4 occurrences)
Last logged: 6:23:49 AM
Error adding entities for domain device_tracker with platform subaru
Error while setting up subaru platform for device_tracker
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 504, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 680, in _async_add_entity
f"{device_name} {entity.suggested_object_id}"
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 459, in suggested_object_id
if self.class.name.fget is Entity.name.fget and self.platform: # type: ignore[attr-defined]
^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'fget'
Noticed after upgrading to 0.6.0 that the sensor for EV_TIME_TO_FULLY_CHARGED_UTC
will display the epoch time once it has fully charged. This results in lovelace entity cards displaying the time to fully charge as 53 years ago
. I don't recall this being the case in previous builds (I think it was just blank). Not sure if there is a better way to handle this given it's a timestamp.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.