Git Product home page Git Product logo

ha-indrav2h's Issues

Missing SensorDeviceClass prevents HA from graphing sensors

Version of the custom_component

0.0.3

Configuration

Add your logs here.

Describe the bug

Sensors with numeric values are not able to be graphed by HA.

Need to add appropriate SensorDeviceClass for relevant sensors in sensor.py

e.g.
from homeassistant.const import BATTERY
...
...
    sensors.append(
        IndraV2hSensor(
            coordinator,
            entry,
            create_meta("Vehicle State Of Charge", "soc", icon="mdi:car-electric", device_class=BATTERY),
        )
    )

Likely that unit will also need to be specifically stated as per: https://developers.home-assistant.io/docs/core/entity/sensor/

If specifying a device class, your sensor entity will need to also return the correct unit of measurement.

Debug log


Add your logs here.

Error with lastOn response from API.

Version of the custom_component

0.0.2

Configuration

Using config flow and entered my V2H smart portal log in.

Describe the bug

I get the following errors when setting up the integration whilst the vehicle isn't connected. Probably need some sort of error handling when vehicle isn't connected.

Debug log


2024-04-08 15:18:32.111 CRITICAL (MainThread) [custom_components.indrav2h] Test Indra credentials
2024-04-08 15:18:32.361 INFO (MainThread) [homeassistant.setup] Setting up indrav2h
2024-04-08 15:18:32.361 INFO (MainThread) [homeassistant.setup] Setup of domain indrav2h took 0.0 seconds
2024-04-08 15:18:32.362 INFO (MainThread) [custom_components.indrav2h]
-------------------------------------------------------------------
Indra V2H
Version: 0.0.2
This is a custom integration!
If you have any issues with this you need to open an issue here:
https://github.com/creatingwake/ha-indrav2h/issues
-------------------------------------------------------------------
2024-04-08 15:18:32.889 ERROR (MainThread) [custom_components.indrav2h] Traceback (most recent call last):
File "/config/custom_components/indrav2h/__init__.py", line 91, in _async_update_data
return await self.api.refresh()
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pyindrav2h/v2hclient.py", line 19, in refresh
await self._device.refresh_stats()
File "/usr/local/lib/python3.12/site-packages/pyindrav2h/v2hdevice.py", line 44, in refresh_stats
a = await self.connection.get("/transactions/" + self.serial +
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pyindrav2h/connection.py", line 72, in get
return await self.send("GET", url, data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pyindrav2h/connection.py", line 68, in send
raise V2HException(response.status_code)
pyindrav2h.exceptions.V2HException
2024-04-08 15:18:32.889 ERROR (MainThread) [custom_components.indrav2h] Error fetching indrav2h data:
File "/config/custom_components/indrav2h/__init__.py", line 91, in _async_update_data
return await self.api.refresh()
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pyindrav2h/v2hclient.py", line 19, in refresh
await self._device.refresh_stats()
File "/usr/local/lib/python3.12/site-packages/pyindrav2h/v2hdevice.py", line 44, in refresh_stats
a = await self.connection.get("/transactions/" + self.serial +
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pyindrav2h/connection.py", line 72, in get
return await self.send("GET", url, data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pyindrav2h/connection.py", line 68, in send
raise V2HException(response.status_code)
pyindrav2h.exceptions.V2HException
2024-04-08 15:18:38.826 ERROR (MainThread) [custom_components.indrav2h] Error fetching indrav2h data:
2024-04-08 15:18:49.627 ERROR (MainThread) [custom_components.indrav2h] Traceback (most recent call last):
File "/config/custom_components/indrav2h/__init__.py", line 91, in _async_update_data
return await self.api.refresh()
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pyindrav2h/v2hclient.py", line 19, in refresh
await self._device.refresh_stats()
File "/usr/local/lib/python3.12/site-packages/pyindrav2h/v2hdevice.py", line 44, in refresh_stats
a = await self.connection.get("/transactions/" + self.serial +
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pyindrav2h/connection.py", line 72, in get
return await self.send("GET", url, data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pyindrav2h/connection.py", line 68, in send
raise V2HException(response.status_code)
pyindrav2h.exceptions.V2HException
2024-04-08 15:18:49.627 ERROR (MainThread) [custom_components.indrav2h] Error fetching indrav2h data:
2024-04-08 15:19:10.552 ERROR (MainThread) [custom_components.indrav2h] Traceback (most recent call last):
File "/config/custom_components/indrav2h/__init__.py", line 91, in _async_update_data
return await self.api.refresh()
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pyindrav2h/v2hclient.py", line 19, in refresh
await self._device.refresh_stats()
File "/usr/local/lib/python3.12/site-packages/pyindrav2h/v2hdevice.py", line 44, in refresh_stats
a = await self.connection.get("/transactions/" + self.serial +
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pyindrav2h/connection.py", line 72, in get
return await self.send("GET", url, data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pyindrav2h/connection.py", line 68, in send
raise V2HException(response.status_code)
pyindrav2h.exceptions.V2HException
2024-04-08 15:19:10.553 ERROR (MainThread) [custom_components.indrav2h] Error fetching indrav2h data:
2024-04-08 15:19:51.589 ERROR (MainThread) [custom_components.indrav2h] Traceback (most recent call last):
File "/config/custom_components/indrav2h/__init__.py", line 91, in _async_update_data
return await self.api.refresh()
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pyindrav2h/v2hclient.py", line 19, in refresh
await self._device.refresh_stats()
File "/usr/local/lib/python3.12/site-packages/pyindrav2h/v2hdevice.py", line 44, in refresh_stats
a = await self.connection.get("/transactions/" + self.serial +
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pyindrav2h/connection.py", line 72, in get
return await self.send("GET", url, data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pyindrav2h/connection.py", line 68, in send
raise V2HException(response.status_code)
pyindrav2h.exceptions.V2HException
2024-04-08 15:19:51.589 ERROR (MainThread) [custom_components.indrav2h] Error fetching indrav2h data: 

Charge/Discharge rate entity

Is your feature request related to a problem? Please describe.
Is there any chance that you could include the charge/discharge rate entity please? It would be useful for me to be able to set a lower discharge rate to avoid going over my export power limit.

Describe the solution you'd like
A rate entity to set the charge & discharge parameters applicable to the CHARGE and DISCHARGE modes.

Describe alternatives you've considered
n/a

Additional context
Add any other context or screenshots about the feature request here.

Auth failures when BearerToken is not available or suffers Token Auth issues are not handled well

Version of the custom_component

v 0.0.0

Describe the bug

Calling a refresh method when a BearerToken has not been requested results in an auth failure. The system should handle this exception gracefully and request a BearerToken.

Calling a refresh method when a BearerToken has expired results in an auth failure. The system should handle this gracefully and attempt to request a new BearerToken.

Failed setup will retry

I have added integration. Then put my password for indra portal is that correct but keeps saying failed setup will try again? I am on v2h but using the original v2g is that the reason wont work? Or am i using a wrong email and password? Its ok its now sorted itself many thanks

HA Traceback due to KeyError: 'mode' within select.py entity

Version of the custom_component

0.0.3

Configuration

Add your logs here.

Describe the bug

Traceback and KeyError thrown periodically throughout the day.

Car has remained plugged in throughout.

Failures do not correlate with any automations firing or manual configuration changes.

Suspect periodic missing data in Indra API response, although the python lib is not firing a Traceback or exception so likely we are getting a 200 OK back from Indra API, just with missing data points.

Might need additional error logging to be added temporarily in pyindrav2h

Debug log


Logger: homeassistant
Source: custom_components/indrav2h/select.py:52
Integration: Indra V2H ([documentation](https://github.com/creatingwake/ha-indrav2h), [issues](https://github.com/creatingwake/ha-indrav2h/issues))
First occurred: 8 April 2024 at 21:51:46 (21 occurrences)
Last logged: 15:36:15

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 243, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 399, in _async_refresh
    self.async_update_listeners()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 182, in async_update_listeners
    update_callback()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 479, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 941, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1062, in _async_write_ha_state
    state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 999, in __async_calculate_state
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 947, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/select/__init__.py", line 151, in state
    current_option = self.current_option
                     ^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/indrav2h/select.py", line 52, in current_option
    return self.device.mode
           ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pyindrav2h/v2hdevice.py", line 74, in mode
    return self.stats["mode"]
           ~~~~~~~~~~^^^^^^^^
KeyError: 'mode'

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.