I think the best failure mode for the component would be to fail with an unknown for values that don’t get an update. Otherwise, it gives the illusion of data being up to date. Maybe have it switch to unknown after a configurable amount of time.
I have found one way to get the location to update twice now. Have home assistant turn on the climate control, nothing else. After a short while, Home Assistant will show the location of the car correctly.
Hey! I’m quite new to HASS and looking to add support for my Renault ZOE. Figured I could take a look at how you’ve done this for your Leaf, and try to recreate it.
I’m a bit confused about where to put the different logic though, but as far as I understood it what you’ve done is:
Created a new platform and put all the logic for connecting to the API in the components/nissan_leaf.py script (handled by pycarwings dependency)
Created a device tracker (that created a new device entity within hass) in the /device_tracker/nissan_leaf.py script.
The HASS documentation for creating a new platform reads: “One Home Assistant rule is that platform logic should never interface directly with devices.”.
I’m a bit confused about how to create the “Entity Class” they describe here. Is that what you’ve done? And if so, where?
Have you copied the correct files to the correct locations? These are the files that need copying across, it should work after that. However, I did have problems with it downloading the carwings component but, I did get it working on my PC.
These are not all the same file btw, they are found in the associated folders in \components.
Hope that helps, I’m quite a noob at this thing, it took me quite a while to work out where things went, but I’ve only had HA installed for a couple of weeks.
This isn’t really a wise move as Nissan’s servers fail too often. The battery goes down in increments of 1/12 roughly so you won’t actually be in a position where the data is out of date unless it fails for a very long time.
My general advice is to just not login on any other application. They’ve architected their backend horribly so that you can’t have more than one login session and that can really mess things up. I’ve been running the component since I first published it without any problems by following this tactic.
Good points. We should already be able to query home assistant when the value was last updated to get an idea of how stale the data is.
I think my instance is failing because it can’t get the py carwings library before home assistant gives up. It did that to me the first time, but after rebooting it worked. I was going to download and store it locally to see if that fixed it.
yes i did.
Have you complete guide how to use Nissan leaf custom component. maybe i am missing some thing. i am tried both to put my username and password in configuration.yaml file and in nissan_leaf.py, but same result.
I had some time to find out why my config is failing today.
If I understand the error correctly, it is failing while trying to install the pycryptodome requirement for pycarwings2.
2018-04-03 19:46:59 ERROR (SyncWorker_3) [homeassistant.util.package] Unable to install package https://github.com/BenWoodford/pycarwings2/archive/master.zip#pycarwings: Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-w096xrm2/pycryptodome/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-wcsca0p2-record/install-record.txt --single-version-externally-managed --prefix --compile --user --prefix=" failed with error code 1 in /tmp/pip-build-w096xrm2/pycryptodome/ 2018-04-03 19:46:59 ERROR (MainThread) [homeassistant.requirements] Not initializing nissan_leaf because could not install requirement https://github.com/BenWoodford/pycarwings2/archive/master.zip#pycarwings 2018-04-03 19:46:59 ERROR (MainThread) [homeassistant.setup] Setup failed for nissan_leaf: Could not install all requirements.
What is really odd is that it was working on my HASSIO installation.
I think one of the latest HASSIO updates may have caused the problem. I am also having problems with the fact that all of the historical data has disappeared. I plan to reflash my my Pi’s memory card and restore from backup to see if that fixes it.
It’s likely that HASS.io doesn’t like using direct git links for libraries, which I’ve had to use for now as the author of the library hasn’t pulled my changes in yet.
I run mine straight in docker without HASS.io so haven’t come across these issues.
~ install https://github.com/BenWoodford/pycarwings2.git
BusyBox v1.27.2 (2018-01-29 16:01:29 GMT) multi-call binary.
Usage: install [-cdDsp] [-o USER] [-g GRP] [-m MODE] [-t DIR] [SOURCE]... DEST
Copy files and set attributes
-c Just copy (default)
-d Create directories
-D Create leading target directories
-s Strip symbol table
-p Preserve date
-o USER Set ownership
-g GRP Set group ownership
-m MODE Set permissions
-t DIR Install to DIR