Code Monkey home page Code Monkey logo

ha-leafspy's Introduction

leafspy

GitHub Release GitHub Activity License

hacs Project Maintenance

Discord Community Forum

Component to integrate with leafspy.

This component will set up the following platforms.

Platform Description
device_tracker Track a Nissan Leaf using the Leaf Spy app.

leafspy

Installation

  1. Using the tool of choice open the directory (folder) for your HA configuration (where you find configuration.yaml).
  2. If you do not have a custom_components directory (folder) there, you need to create it.
  3. In the custom_components directory (folder) create a new folder called leafspy.
  4. Download all the files from the custom_components/leafspy/ directory (folder) in this repository.
  5. Place the files you downloaded in the new directory (folder) you created.
  6. Restart Home Assistant
  7. In the HA UI go to "Configuration" -> "Integrations" click "+" and search for "Leaf Spy"

Using your HA configuration directory (folder) as a starting point you should now also have this:

custom_components/leafspy/translations/en.json
custom_components/leafspy/__init__.py
custom_components/leafspy/config_flow.py
custom_components/leafspy/const.py
custom_components/leafspy/device_tracker.py
custom_components/leafspy/manifest.json
custom_components/leafspy/strings.json

Configuration is done in the UI

Android app configuration

Open the Leaf Spy app, go to Menu -> Settings and scroll down to Server. Change the following settings:

  • Enable: Yes
  • Send Interval can be whatever you prefer.
  • ID: <Car Name>
  • PW: secret generated when the integration was installed
  • Http or Https depending on the access to your Home Assistant install.
  • URL: webhook url generated when the integration was installed
    • Note: Do not add http or https to the URL.

Contributions are welcome!

If you want to contribute to this please read the Contribution guidelines


ha-leafspy's People

Contributors

dodther avatar jesserockz avatar wtadler avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ha-leafspy's Issues

Error trying to set up

Version of the custom_component

Configuration

Add your logs here.

Describe the bug

A clear and concise description of what the bug is.

Debug log


Add your logs here.

Logger: aiohttp.server
Source: helpers/network.py:201
First occurred: 5:34:53 AM (2 occurrences)
Last logged: 5:34:55 AM

Error handling request
Traceback (most recent call last):
File “/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py”, line 435, in _handle_request
resp = await request_handler(request)
File “/usr/local/lib/python3.9/site-packages/aiohttp/web_app.py”, line 504, in _handle
resp = await handler(request)
File “/usr/local/lib/python3.9/site-packages/aiohttp/web_middlewares.py”, line 117, in impl
return await handler(request)
File “/usr/src/homeassistant/homeassistant/components/http/security_filter.py”, line 60, in security_filter_middleware
return await handler(request)
File “/usr/src/homeassistant/homeassistant/components/http/forwarded.py”, line 100, in forwarded_middleware
return await handler(request)
File “/usr/src/homeassistant/homeassistant/components/http/request_context.py”, line 28, in request_context_middleware
return await handler(request)
File “/usr/src/homeassistant/homeassistant/components/http/ban.py”, line 79, in ban_middleware
return await handler(request)
File “/usr/src/homeassistant/homeassistant/components/http/auth.py”, line 219, in auth_middleware
return await handler(request)
File “/usr/src/homeassistant/homeassistant/components/http/view.py”, line 137, in handle
result = await result
File “/usr/src/homeassistant/homeassistant/components/config/config_entries.py”, line 206, in post
return await super().post(request, flow_id)
File “/usr/src/homeassistant/homeassistant/components/http/data_validator.py”, line 62, in wrapper
result = await method(view, request, *args, **kwargs)
File “/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py”, line 110, in post
result = await self._flow_mgr.async_configure(flow_id, data)
File “/usr/src/homeassistant/homeassistant/data_entry_flow.py”, line 260, in async_configure
result = await self._async_handle_step(
File “/usr/src/homeassistant/homeassistant/data_entry_flow.py”, line 335, in _async_handle_step
result: FlowResult = await getattr(flow, method)(user_input)
File “/config/custom_components/leafspy/config_flow.py”, line 29, in async_step_user
url = get_url(self.hass, prefer_external = True, prefer_cloud = True)
File “/usr/src/homeassistant/homeassistant/helpers/network.py”, line 201, in get_url
raise NoURLAvailableError
homeassistant.helpers.network.NoURLAvailableError

Just removed leaf spy from hacs, reinstalled, and then hit restart, and tried again and got the same error

No config flow

Version of the custom_component

v.0.1.0

Configuration

Installed via HACS

Describe the bug

After the intergration is added, there is no config flow, and no device_tracker is added.
asyncio is not defined, see log.

Debug log

2020-09-03 08:06:40 ERROR (MainThread) [homeassistant.config_entries] Error unloading entry Leaf Spy for leafspy
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 309, in async_unload
    result = await component.async_unload_entry(  # type: ignore
  File "/config/custom_components/leafspy/__init__.py", line 54, in async_unload_entry
    await asyncio.gather(
NameError: name 'asyncio' is not defined
2020-09-03 08:06:57 INFO (MainThread) [homeassistant.components.device_tracker] Setting up device_tracker.leafspy

Instructions for configuration of android app

Is your feature request related to a problem? Please describe.
It is unclear how to configure the leafspy app to use this integration.

Describe the solution you'd like
Can you provide some basic instructions on how to configure the app to report back to this integration?

Other parameters

Hello
Where are other parameters like i.e SOH, SOC number of L1/L2 charges, QC and etc, start and end trip date and time? Number of kilometers?

compatible with last HA 2021.12.3 ?

hi, i have tried to install ha-leafspy on two way :
create leafspy folder , download all files
or by hacs and download leafspy

after reboot, i have not found leaf spy a the 7. configuration ( In the HA UI go to "Configuration" -> "Integrations" click "+" and search for "Leaf Spy" ) no "leaf spy" found , so i can't continue ...

[BUG] deprecated async_get_registry

Version of the custom_component

Configuration

Add your logs here.

Describe the bug

A clear and concise description of what the bug is.

Debug log

Logger: homeassistant.helpers.frame
Source: helpers/frame.py:77
First occurred: 18:15:37 (1 occurrences)
Last logged: 18:15:37

Detected integration that uses deprecated `async_get_registry` to access device registry, use async_get instead. Please report issue to the custom integration author for leafspy using this method at custom_components/leafspy/device_tracker.py, line 53: dev_reg = await device_registry.async_get_registry(hass)



Problem setting up Nabu Casa for Remote Access

Ok, signed up for the trial with NC and got the URL to use remotely. To get the secret again, I removed and re-added the integration, then took a screenshot of the info.

I plug that into Leaf Spy though and the URL does not resolve ...

From the debug log saved to DropBox:

02/20/2022 14:40:03 41 510 100 0 URL = https://****64li4928mrkydv.ui.nabu.casa/api/leafspy/update, Error = java.net.UnknownHostException: Unable to resolve host "****64li4928mrkydv.ui.nabu.casa": No address associated with hostname
02/20/2022 15:16:38 06 025 0 0 URL = https://****64li4928mrkydv.ui.nabu.casa/api/leafspy/update, Error = java.net.UnknownHostException: Unable to resolve host "****64li4928mrkydv.ui.nabu.casa": No address associated with hostname

That URL looks odd to me, the domain name is weird. Is that what others are using? It comes from the Accounts page on NC for my account.

WARNING hass.helpers.dispatcher is deprecated and will stop working in HA 2024.11 - __init__.py line 46

I'm a new user. Just installed the LeafSpy integration. Thank you.

I see a warning that a HA service/function is deprecated and will stop working later this year:

2024-07-01 16:17:07.730 WARNING (MainThread) [homeassistant.helpers.frame] Detected that custom integration 'leafspy' accesses hass.helpers.dispatcher. This is deprecated and will stop working in Home Assistant 2024.11, it should be updated to import functions used from dispatcher directly at custom_components/leafspy/init.py, line 46: hass.helpers.dispatcher.async_dispatcher_connect(, please create a bug report at https://github.com/jesserockz/ha-leafspy/issues

Not parsing properly

Describe the bug

My device_tracker entity seems not to update reliably. And when it does update it is only updated with the attributes source_type, battery_level, latitude, longitude, gps_accuracy, and friendly_name. I can see from the logs that the other attributes (like odometer), with proper values, are indeed making it to HA, but that something is going wrong with the parsing.

This change might be related to 2022.4, but I'm not totally sure.

Debug log

Exception in async_handle_message when dispatching 'leafspy': (<homeassistant.core.HomeAssistant object at 0x7f8ee69e80>, <custom_components.leafspy.LeafSpyContext object at 0x7f854f1b50>, <MultiDictProxy('user': '<CarName>', 'pass': 'xxxxx', 'DevBat': 'xxxxx', 'Gids': 'xxxxx', 'Lat': 'xxxxx', 'Long': 'xxxxx', 'Elv': 'xxxxx', 'Seq': 'xxxxx', 'Trip': 'xxxxx', 'Odo': '3741.14', 'SOC': 'xxxxx', 'AHr': 'xxxxx', 'BatTemp': 'xxxxx', 'Amb': 'xxxxx', 'Wpr': 'xxxxx', 'PlugState': 'xxxxx', 'ChrgMode': 'xxxxx', 'ChrgPwr': 'xxxxx', 'VIN': 'xxxxx', 'PwrSw': 'xxxxx', 'Tunits': 'xxxxx', 'RPM': 'xxxxx', 'SOH': 'xxxxx')>) Traceback (most recent call last): File "/config/custom_components/leafspy/device_tracker.py", line 196, in async_handle_message args = _parse_see_args(message) File "/config/custom_components/leafspy/device_tracker.py", line 173, in _parse_see_args 'odometer': int(message['Odo']), ValueError: invalid literal for int() with base 10: '3741.14'

[Actual values censored or fictionalized]

Non-secure Leaf Spy API Blocked

First off, my apologies for bringing up a Leaf Spy issue. I was hoping this would still be acceptable because it's preventing me from using this integration.

My HA runs completely locally, and when I put in the endpoint given by this integration, Leaf Spy throws error "UnknownServiceException: CLEARTEXT communication to (local IP) not permitted by network security policy". In other words, we have to use HTTPS, which doesn't make sense for LAN communication.

Anyone hit this too? Did you just end up making an HTTPS endpoint? I don't want to expose my HA to the world. Whoever decided to disallow insecure traffic appears to have forgotten about local usage.

The integration doesn't work

I installed the integration using the documentation and in my HA I'm able to show the leaf spy icon in integrations panel, but there is no other info or component shown in the ha interface, I have to insert something in configuration,yaml file? There is no documention about that.

What is the webhook to insert in leaf spy pro app?

Thanks

Integration for the Idiot (me)

Assume I'm an idiot, mostly. :)

  1. I have the integration installed.
  2. I bought Leaf Spy Pro and a dongle.
  3. I can see all the values in the app.
  4. I configured the server.

How do I get my first Card showing values in HA? I created a new desktop and added a card, but I do not see a device_tracker Entity for my car. Does it not get created until the first push of data from the App into HA?

This is where I get stuck, sorry.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.