dan-r / HomeAssistant-NissanConnect

Unofficial Home Assistant integration for interacting with Nissan Connect vehicles 🚗
Apache License 2.0
26 stars 6 forks source link

Missing data for Ariya #3

Closed dragonjo84 closed 5 months ago

dragonjo84 commented 5 months ago

Hello sorry for my English I will try to explain you my problem

I write my account, mail and password but it's a bad configuration, no update is possible.

I have an Ariya of December 23 in France. I download it on HACS, install it, restart HA and in integration panel wrote my account but no issue... Thanks a lot

dan-r commented 5 months ago

Can you share any errors shown in the home assistant logs?

dragonjo84 commented 5 months ago

Hello here is the log of HA

Logger: homeassistant.config_entries Source: config_entries.py:406 First occurred: 20:20:44 (7 occurrences) Last logged: 20:49:20

Error setting up entry NissanConnect Account for nissan_connect Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 406, in async_setup result = await component.async_setup_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/nissan_connect/init.py", line 48, in async_setup_entry await hass.async_add_executor_job(vehicle.refresh) File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/nissan_connect/kamereon.py", line 849, in refresh self.fetch_all() File "/config/custom_components/nissan_connect/kamereon.py", line 854, in fetch_all self.fetch_battery_status() File "/config/custom_components/nissan_connect/kamereon.py", line 1148, in fetch_battery_status self.battery_capacity = battery_data['batteryCapacity'] # kWh


KeyError: 'batteryCapacity'

> Le 21 janv. 2024 à 20:29, Dan Raper ***@***.***> a écrit :
> 
> 
> Can you share any errors shown in the home assistant logs?
> 
> —
> Reply to this email directly, view it on GitHub <https://github.com/dan-r/HomeAssistant-NissanConnect/issues/3#issuecomment-1902736227>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AOJ3NDDQTTO3OA23HRFST3DYPVUAPAVCNFSM6AAAAABCEGMHECVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMBSG4ZTMMRSG4>.
> You are receiving this because you authored the thread.
> 
dan-r commented 5 months ago

Would you mind testing v0.3.1-beta.1? I have put in a fix that should resolve this issue, but there may be more things its failing on.

You may need to follow this to update to beta.

dragonjo84 commented 5 months ago

Yeah !!! Thanks a lot !!!

dan-r commented 5 months ago

Great news! Can you check that its all working correctly?

This is what I see for my Leaf and it should be the same for an Ariya but I haven't tested. image

dragonjo84 commented 5 months ago

some status not updated

IMG_7962 IMG_7963

dan-r commented 5 months ago

Any more errors in the logs?

mraardvark commented 5 months ago

Hi @dan-r I am also an Ariya user. I am looking at using the kamereon classes outside of HA. I am able to login successfully and interestingly I can also only see the totalMileage, batteryLevel, plugStatus and chargeStatus fields (oh, and oilLevel!) as well as HVAC status. All other fields are None (missing in the json). In other words, it appears to match what @dragonjo84 can see in HA.

dan-r commented 5 months ago

@mraardvark are you able to take a look at the JSON returned from the API (like /battery-status for example) to see if the fields are called something different?

mraardvark commented 5 months ago

I have thrown a few prints() into the code (I don't know my way around it just yet), and those json strings i do get look like this:

hvac_data: {'lastUpdateTime': '2024-01-23T20:44:56Z', 'internalTemperature': -3.0, 'hvacStatus': 'off'}
cockpit_data: {'totalMileage': 727, 'oilLevel': 0}
battery_data: {'batteryLevel': 100, 'plugStatus': 1, 'chargeStatus': 0}
mraardvark commented 5 months ago

And @dan-r FYI: door_status and location also seem to be working.

dan-r commented 5 months ago

Interesting, looks a lot more sparse than what I get with my Leaf on the battery_data endpoint:

hvac: {'lastUpdateTime': '2024-01-23T21:32:20Z', 'hvacStatus': 'off', 'internalTemperature': 14.0}
cockpit: {'totalMileage': 33756}
battery: {'batteryLevel': 72, 'batteryBarLevel': 174, 'rangeHvacOn': 155, 'rangeHvacOff': 159, 'plugStatus': 0, 'chargeStatus': 0, 'chargePower': 1, 'lastUpdateTime': '2024-01-23T21:32:20Z', 'batteryCapacity': 40000, 'timeRequiredToFullSlow': 780, 'timeRequiredToFullNormal': 540, 'timeRequiredToFullFast': 180}
mraardvark commented 5 months ago

Hehe, and you have no oil ;) Are you in EU or NA?

dan-r commented 5 months ago

I'm in the EU (well, UK, sore subject), and its a 2022 Leaf (pre-logo change facelift).

I was poking around with the NissanConnect app earlier and did come across this endpoint: https://nci-bff-web-prod.apps.eu2.kamereon.io/bff-web/v2/cars/VIN/battery-status?canGen=GEN3

I haven't used it in the integration because it seems to just give less data for me, but it may be the key for the Ariya:

{
            "batteryAutonomy": 159,
            "batteryBarLevel": 174,
            "batteryCapacity": 40000,
            "batteryLevel": 72,
            "batteryTemperature": 0,
            "chargePower": 1,
            "chargingRemainingTime": 780,
            "chargingStatus": 0.0,
            "lastUpdateTime": "2024-01-23T21:36:57Z",
            "plugStatus": 0,
            "rangeHvacOff": 0,
            "rangeHvacOn": 0
}
mraardvark commented 5 months ago

I do get a bit more data out of that one: {'lastUpdateTime': '0', 'batteryLevel': 100, 'batteryTemperature': 0, 'batteryAutonomy': 0, 'plugStatus': 1, 'chargingStatus': 0.0, 'chargingRemainingTime': -1, 'rangeHvacOn': 0, 'rangeHvacOff': 0} `

dan-r commented 5 months ago

A bit more but still seems fairly useless! Eg. no range, either in the range or autonomy field

mraardvark commented 5 months ago

Indeed. Anyway - I have something to use for now, and will watch this space if there is any news, or some testing that needs doing. As mentioned, I am not a HA user (bad experience trying to get usb serial port on a dockerized HA), so I just run python scripts from cron... Ideas on my todo list:

  1. My power provider charges the car when its cheapest at night (wildly so) but cannot interrogate the car to find our how much it needs. A script could query SOC from this API and feed it into their API every night when the car is detected as plugged in.
  2. An e-paper + avr-iot wifi goodie that shows SOC and other vitals in a friendly non-app way
dan-r commented 5 months ago

Glad its working as is/outside HA. Its definitely a bit of a pain to setup, but once you have everything in it, it makes life much easier than using loads of separate apps.

My power provider also does cheap nightly rates (1/4 day rate), so I use this integration along with HomeAssistant-Ohme to tell my charger/utility provider how much charge the car needs.

I personally use a couple of 'jailbroken' kindles and a script to fetch a HA dashboard as a jpg to show some stats around the house. Haven't looked into the avr-iot or DIY ePaper stuff yet, but its also on my todo list...

RaptorG commented 5 months ago

Can confirm works a charm on late 2023 early 2023 Leaf Tekna. Hardware: ZE1-P. Appears to be same as 2020 but with face lift. Glad they did it as it contributed in our decision to buy it. Older ones looked somewhat tired an boresome. Highly recommend influxdb and graffana .. time consuming to setup dashboards but awesome. GivEnergy Battrey SoC

image

dan-r commented 5 months ago

@RaptorG mines a March 2022 (pre-facelift) Tekna and shows as ZE1-P too. I believe electrically, mechanically and interior-wise they're all the same after 2019 when the 'NissanConnect EV' app went away and the latest head unit came in.

I've got Grafana/InfluxDB (+ Home Assistant feeding in) setup with a few dashboards but it doesnt get enough use!

RaptorG commented 5 months ago

Have you considered your options when Oh-mi and Nis-san send you notices to shutdown both of these projects? I cannot imagine life without these integration while I have products from both vendors. Both have not exposed APIs to public. Also I noticed (Whisper) G00gle's and k@m3r30n keys.

dan-r commented 5 months ago

Nissan side of things is based on the dartnissanconnect library which is used for the 'My Leaf' app, leaf2mqtt and a few other projects. In the EU at least, there's been no attempt to shut these down AFAIK (US is another matter).

For the other one, I've heard nothing negative yet, but know they are aware of it and have been since the start of the year. The integration identifies itself in the user-agent, so it would take seconds to block for them.

dragonjo84 commented 5 months ago

Hello always some informations aren’t synchronizedJoffreyLe 21 janv. 2024 à 20:51, Joffrey FARDEL @.> a écrit :Hello here is the log of HALogger: homeassistant.config_entriesSource: config_entries.py:406First occurred: 20:20:44 (7 occurrences)Last logged: 20:49:20Error setting up entry NissanConnect Account for nissan_connectTraceback (most recent call last):  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 406, in async_setup    result = await component.async_setup_entry(hass, self)             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  File "/config/custom_components/nissan_connect/init.py", line 48, in async_setup_entry    await hass.async_add_executor_job(vehicle.refresh)  File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run    result = self.fn(self.args, self.kwargs)             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  File "/config/custom_components/nissan_connect/kamereon.py", line 849, in refresh    self.fetch_all()  File "/config/custom_components/nissan_connect/kamereon.py", line 854, in fetch_all    self.fetch_battery_status()  File "/config/custom_components/nissan_connect/kamereon.py", line 1148, in fetch_battery_status    self.battery_capacity = battery_data['batteryCapacity']  # kWh                            ~~~~^^^^^^^^^^^^^^^^^^^KeyError: 'batteryCapacity'Le 21 janv. 2024 à 20:29, Dan Raper @.> a écrit :Can you share any errors shown in the home assistant logs?—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.>

dan-r commented 5 months ago

@dragonjo84 you seem to be running quite an old version of the integration. Could you please try again with the latest version?

dan-r commented 5 months ago

Closing for now as I haven't heard back in a couple of weeks.

Feel free to re-open if you're still seeing the same behaviour.

SpainBoys commented 4 months ago

Good afternoon!

I am the owner of a NISSAN ARIYA in Spain. I am registered in the Nissan Connect app, but with these credentials I am not able to log in to your integration. Can you please tell me where else I need to register to successfully login to your integration? Which website do I need to do it on? The instructions for your integration do not say anything about this.

I hope for help. Regards, ALEX

dan-r commented 4 months ago

@SpainBoys the credentials are the same as for the NissanConnect app. Please open a new issue and provide any relevant logs if this problem persists.