remuslazar / homeassistant-carwings

Custom HomeAssistant Integration to access Nissan Connect EV Services
MIT License
24 stars 1 forks source link

[pycarwings3.pycarwings3] got an empty BatteryStatusRecords makes the integration fail (could be due to 2G shut down) #48

Open evest opened 6 days ago

evest commented 6 days ago

System Health details

System Information

version core-2024.9.1
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.12.4
os_name Linux
os_version 6.6.31-haos-raspi
arch aarch64
timezone Europe/Oslo
config_dir /config
Home Assistant Community Store GitHub API | ok -- | -- GitHub Content | ok GitHub Web | ok GitHub API Calls Remaining | 4998 Installed Version | 1.34.0 Stage | running Available Repositories | 1401 Downloaded Repositories | 11
Home Assistant Cloud logged_in | true -- | -- subscription_expiration | January 10, 2025 at 01:00 relayer_connected | true relayer_region | eu-central-1 remote_enabled | true remote_connected | true alexa_enabled | false google_enabled | false remote_server | eu-central-1-1.ui.nabu.casa certificate_status | ready instance_id | e26cf404b5804e879a0c2a083a0c5710 can_reach_cert_server | ok can_reach_cloud_auth | ok can_reach_cloud | ok
Home Assistant Supervisor host_os | Home Assistant OS 13.1 -- | -- update_channel | stable supervisor_version | supervisor-2024.09.1 agent_version | 1.6.0 docker_version | 26.1.4 disk_total | 116.5 GB disk_used | 13.8 GB healthy | true supported | true host_connectivity | true supervisor_connectivity | true ntp_synchronized | true virtualization | board | rpi4-64 supervisor_api | ok version_api | ok installed_addons | File editor (5.8.0), TellStick (2.2.0), Samba share (12.3.2), Z-Wave JS (0.7.1), Advanced SSH & Web Terminal (19.0.0), deCONZ (7.0.0), Mosquitto broker (6.4.1), Zigbee2MQTT (1.40.1-1), Home Assistant Google Drive Backup (0.112.1), SQLite Web (4.2.1)
Dashboards dashboards | 11 -- | -- resources | 9 views | 20 mode | storage
Nibe Uplink Heat Pumps api_endpoint_reachable | ok -- | --
Recorder oldest_recorder_run | September 12, 2024 at 21:25 -- | -- current_recorder_run | September 13, 2024 at 11:34 estimated_db_size | 597.86 MiB database_engine | sqlite database_version | 3.45.3

Checklist

Describe the issue

Running version 0.2.1

When the integration is loading, it fails with the following error:

2024-09-13 13:47:11.324 INFO (MainThread) [custom_components.nissan_carwings] Starting Nissan Carwings integration for user=REDACTED
2024-09-13 13:47:17.698 DEBUG (MainThread) [custom_components.nissan_carwings] carwings3.get_leaf() OK: vin=REDACTED
2024-09-13 13:47:19.237 WARNING (MainThread) [pycarwings3.pycarwings3] got an empty BatteryStatusRecords
2024-09-13 13:47:19.237 DEBUG (MainThread) [custom_components.nissan_carwings] Finished fetching nissan_carwings data in 7.913 seconds (success: True)
2024-09-13 13:47:19.240 ERROR (MainThread) [homeassistant.components.sensor] Error adding entity None for domain sensor with platform nissan_carwings
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 595, in _async_add_entities
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 823, in _async_add_entity
    original_icon=entity.icon,
                  ^^^^^^^^^^^
  File "/config/custom_components/nissan_carwings/sensor.py", line 82, in icon
    charging = self.coordinator.data[DATA_BATTERY_STATUS_KEY].is_charging
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'is_charging'

I can authenticate using the app, and I can refresh/start the climate control, but I cannot see battery information in the app.

I then checked the online version on https://no.nissanconnect.eu/nb-no/CsmVehicle/Home/VIN-HERE. The battery information isn't showing there either.

However; when I logged in, I got this warning page (originally in Norwegian) : https://www-nissan-no.translate.goog/carwings-maintenance.html?_x_tr_sl=no&_x_tr_tl=en&_x_tr_hl=no&_x_tr_pto=wapp

Dear customer,

We would like to inform you that the NissanConnect EV app currently connected to your car will be switched off in preparation for the 2G network shutdown. This will affect the Nissan LEAF produced until 2016 and the e-NV200 produced until 2018.

The discontinuation of the NissanConnect EV app is linked to the mobile network operators' decision to shut down the 2G network, which affects all car manufacturers that use the same 2G technology.

As a result, you will not be able to use your NissanConnect services remotely through the NissanConnect EV app from April 1, 2024.

However, we can inform you that the time setting of climate control and charging will still be available directly in the car's navigation system. 

We can assure you that Nissan will also continue its commitment in the future and invest in future-oriented technologies and platforms for future products.

Thank you for being a Nissan owner and for your support.

Sincerely,
Nissan

This might explain why it fails, but it seems that it might still be able to control the climate system, which is something at least. However, the integration needs to handle the missing battery data to get past the startup.

Reproduction steps

Fails consistently when loading the integration.

Debug logs

2024-09-13 13:47:11.323 DEBUG (MainThread) [custom_components.nissan_carwings] <class 'custom_components.nissan_carwings.coordinator.CarwingsDataUpdateCoordinator'> initialized with update interval 0:05:00
2024-09-13 13:47:11.323 DEBUG (MainThread) [custom_components.nissan_carwings] <class 'custom_components.nissan_carwings.coordinator.CarwingsClimateDataUpdateCoordinator'> initialized with update interval 0:05:00
2024-09-13 13:47:11.324 DEBUG (MainThread) [custom_components.nissan_carwings] <class 'custom_components.nissan_carwings.coordinator.CarwingsDrivingAnalysisDataUpdateCoordinator'> initialized with update interval 0:05:00
2024-09-13 13:47:11.324 INFO (MainThread) [custom_components.nissan_carwings] Starting Nissan Carwings integration for user=REDACTED
2024-09-13 13:47:17.698 DEBUG (MainThread) [custom_components.nissan_carwings] carwings3.get_leaf() OK: vin=REDACTED
2024-09-13 13:47:19.237 WARNING (MainThread) [pycarwings3.pycarwings3] got an empty BatteryStatusRecords
2024-09-13 13:47:19.237 DEBUG (MainThread) [custom_components.nissan_carwings] Finished fetching nissan_carwings data in 7.913 seconds (success: True)
2024-09-13 13:47:19.240 ERROR (MainThread) [homeassistant.components.sensor] Error adding entity None for domain sensor with platform nissan_carwings
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 595, in _async_add_entities
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 823, in _async_add_entity
    original_icon=entity.icon,
                  ^^^^^^^^^^^
  File "/config/custom_components/nissan_carwings/sensor.py", line 82, in icon
    charging = self.coordinator.data[DATA_BATTERY_STATUS_KEY].is_charging
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'is_charging'
2024-09-13 13:47:19.254 ERROR (MainThread) [homeassistant.components.binary_sensor] Error adding entity binary_sensor.leaf1stev_plug_status_2 for domain binary_sensor with platform nissan_carwings
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 595, in _async_add_entities
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 909, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1366, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1005, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1130, in _async_write_ha_state
    self.__async_calculate_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1066, in __async_calculate_state
    available = self.available  # only call self.available once per update cycle
                ^^^^^^^^^^^^^^
  File "/config/custom_components/nissan_carwings/binary_sensor.py", line 57, in available
    return self.coordinator.data[DATA_BATTERY_STATUS_KEY].is_connected is not None
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'is_connected'
2024-09-13 13:47:19.260 ERROR (MainThread) [homeassistant.components.binary_sensor] Error adding entity binary_sensor.leaf1stev_charging for domain binary_sensor with platform nissan_carwings
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 595, in _async_add_entities
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 909, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1366, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1005, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1130, in _async_write_ha_state
    self.__async_calculate_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1066, in __async_calculate_state
    available = self.available  # only call self.available once per update cycle
                ^^^^^^^^^^^^^^
  File "/config/custom_components/nissan_carwings/binary_sensor.py", line 83, in available
    return self.coordinator.data[DATA_BATTERY_STATUS_KEY].is_charging is not None
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'is_charging'
2024-09-13 13:47:19.276 DEBUG (MainThread) [custom_components.nissan_carwings] carwings3.get_leaf() OK: vin=REDACTED
2024-09-13 13:47:19.279 DEBUG (MainThread) [custom_components.nissan_carwings] carwings3.get_leaf() OK: vin=REDACTED
2024-09-13 13:47:20.582 DEBUG (MainThread) [custom_components.nissan_carwings] carwings3.get_latest_hvac_status() OK: running=False, remaining_time=None, start/stop timestamp: None
2024-09-13 13:47:20.583 DEBUG (MainThread) [custom_components.nissan_carwings] Finished fetching nissan_carwings data in 1.307 seconds (success: True)
2024-09-13 13:47:21.157 ERROR (MainThread) [custom_components.nissan_carwings] Error fetching driving analysis data - KeyError: 'ElectricMileageLevel'
2024-09-13 13:47:21.158 ERROR (MainThread) [custom_components.nissan_carwings] Error fetching nissan_carwings data: Error fetching driving analysis data - KeyError: 'ElectricMileageLevel'
2024-09-13 13:47:21.158 DEBUG (MainThread) [custom_components.nissan_carwings] Finished fetching nissan_carwings data in 1.880 seconds (success: False)

Diagnostics dump

No response

remuslazar commented 3 days ago

The NissanConnectEV (Carwings) services seem to be down since 2 weeks or so.. Historically, I've seen the API go down for a few days, but this current outage appears to be more significant. I have attempted to contact Nissan for clarification or an update, but I haven't received any response yet.

The connectivity in the car is OK, the car can at least update the chargepoint data successfully. Let's hope that they will not really shut down the service altogether..

evest commented 10 hours ago

Wonder if this is regional as well, provided that the car is using 2G for the communcation. In Norway, the 2G network will close down in 2025, while other countries in the EU is waiting for 2029. The message about closing down the service was in Norwegian, so might not be relevant for other markets, but strange that the service seems down for all.

I got a climate start notification on my phone a couple of days after it being sent, so maybe someone turned on a server some where - at least momentairly.

Guess there is nothing much we can do until they get the service running again. IF they are even trying. Agree, would be sad to see this gone.