Please read up on how to use custom components, you need to grab the files for the Leaf component from the Github repo’s components folder and throw them into your own custom components folder retaining the hierarchy.
This is heavily under alpha/beta right now, so it’s not really made for first time users.
Inside your configuration directory create a new folder called custom_components. It might be that one already exists, that’s fine too. This is the folder that Home Assistant will look at when looking for custom code.
I’m trying to get the battery sensor to hit siri. It’s in listed in home assistant, but doesn’t traverse over to this component for some reason. Look at the bottom of this page. Battery tracking is possible.
Log Details (ERROR)
Sat Aug 11 2018 11:48:45 GMT+0200 (Midden-Europese zomertijd)
Testing configuration at /config
ERROR:homeassistant.scripts.check_config:BURB
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/homeassistant/scripts/check_config.py", line 207, in check
res['components'] = check_ha_config_file(hass)
File "/usr/local/lib/python3.6/site-packages/homeassistant/scripts/check_config.py", line 340, in check_ha_config_file
component = loader.get_component(hass, domain)
File "/usr/local/lib/python3.6/site-packages/homeassistant/loader.py", line 94, in get_component
module = importlib.import_module(path)
File "/usr/local/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 674, in exec_module
File "<frozen importlib._bootstrap_external>", line 781, in get_code
File "<frozen importlib._bootstrap_external>", line 741, in source_to_code
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/config/custom_components/nissan_leaf.py", line 142
self.nissan_connect = config[DOMAIN][CONF_NCONNECT]
^
TabError: inconsistent use of tabs and spaces in indentation
Fatal error while loading config: inconsistent use of tabs and spaces in indentation (nissan_leaf.py, line 142)
Failed config
General Errors:
- inconsistent use of tabs and spaces in indentation (nissan_leaf.py, line 142)
Successful config (partial)
It’s as it says, inconsistent use of tabs. That PR hasn’t been merged due to a number of reasons, most of all because it doesn’t followed convention nor does it follow the structure of the rest of the component
Been pretty busy which is why I haven’t had time to work on this. However I can’t build the device tracker for it as I have a pre-2016 Leaf that doesn’t send its GPS location. Someone did submit a PR for it but it wasn’t linted and didn’t follow the same structure so I had to decline it for now.
As for being part of Home Assistant, it’s mostly a restructuring and linting thing. I submitted it but was declined and basically just haven’t had any time to work on it as spare time is somewhat of an alien concept to me these days.
Would you be willing to review your code and share a working version of it (based on the latest Leaf addon by Ben) to the community? I tried the changes in your pull-request but it won’t work.