GithubHelp home page GithubHelp logo

mattrayner / pod-point-home-assistant-component Goto Github PK

View Code? Open in Web Editor NEW
35.0 6.0 6.0 6.18 MB

A simple Home Assistant integration that shows basic information from Pod Point and allows the control of charging schedules to disable and enable the pod.

License: MIT License

Python 99.10% Makefile 0.46% Shell 0.43%
home-assistant energy-consumption ev-charging

pod-point-home-assistant-component's Introduction

Pod Point Home Assistant Component

GitHub Release GitHub Activity License

hacs Project Maintenance BuyMeCoffee

Community Forum

Unofficial component to integrate with Pod Point Solo/Solo 3 charging points.

NOTE: PodPoint have made changes to their authentication system in June 2023 which may result in existing connections reporting Invalid Credentials, and users being unable to log in again with their existing password. This can be fixed by going to https://charge.pod-point.com/login and reseting your password, and then re-authenticate with the integration.

This component will set up the following platforms and services.

Platform Description
binary_sensor Shows if the pod is connected to a vehicle.
sensor Show info from Pod Point API.
sensor (Total Energy) Show a combined KWh value from all charges for a given pod.
sensor (Current Charge Energy) Show the KWh for the current charge session (or 0).
sensor (*Total Cost) Show the total cost of all **completed charges.
sensor (Last **Completed Charge Cost) Show the total cost of the last **completed charge.
sensor (Completed charge time) Show a combined 'charge time' value from all charges for a given pod.
sensor (Balance) Shows the balance on your PodPoint account.
sensor (Charge Mode) Shows the charge mode your pod is currently in/
sensor (***Charge Override End Time) Shows the end time for any configured 'charge now' override.
sensor (Signal Strength) Shows WiFi signal strength of a given pod.
sensor (Last message received) When was a message last received from a given pod.
sensor (Cloud connection status) Status of pods connection to the cloud.
switch (****Allow Charging) Enable/disable charging by enabling/disabling a schedule.
switch (Smart Charge Mode) Enable the switch for 'Smart' charge mode, disable it for 'Manual' charge mode.
update (Firmware Update) Shows the current firmware version for your device and alerts if an update is available

*Total cost is based on the energy provider and kWh cost set in Pod Point.

**Charges are considered complete by Pod Point when you disconnect the vehicle, not when power delivery stops.

***Charge override end time will be 'Unknown' if there is no charge override ('charge now') set. Or, the time when the charge override ends.

****When in either Manual or Override charge mode, the Allow Charging switch is inactive. This is because setting a schedule will not affect the charge in these modes.

Service Params
charge_now - Set a charge override for a time period account - Pod Point account we're setting charge_now for.
  hours (0-24) - How many hours should the charge override last for?
  minutes (0-59) - How many minutes should the charge override last for?
  seconds (0-59) - How many seconds should the charge override last for?

example example

Installation

NOTE: Due to a breaking change in version 1.0.0, upgrading from previous versions (<= 0.4.4) will cause devices to be duplicated. This can be fixed by removing the configuration and then re-adding.

HACS (recommended)

You can install this component via HACS by searching for 'Pod Point' and then install it from the main HACS integration screen.

Note: You will need to restart before you can install Pod Point via the UI. Within Home Assistant go to "Configuration" -> "Integrations" click "+" and search for "Pod Point".

Manually

  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 pod_point.
  4. Download all the files from the custom_components/pod_point/ 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 "Pod Point"

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

custom_compoenets/pod_point/static/...
custom_components/pod_point/translations/en.json
custom_components/pod_point/translations/sensor.en.json
custom_components/pod_point/__init__.py
custom_components/pod_point/api.py
custom_components/pod_point/binary_sensor.py
custom_components/pod_point/config_flow.py
custom_components/pod_point/const.py
custom_components/pod_point/entity.py
custom_components/pod_point/errors.py
custom_components/pod_point/manifest.json
custom_components/pod_point/sensor.py
custom_components/pod_point/switch.py

Configuration is done in the UI

NOTE: Due to a breaking change in version 1.0.0, upgrading from previous versions (<= 0.4.4) will cause devices to be duplicated. This can be fixed by removing the configuration and then re-adding.

Once you have installed either manually or via HACS, restart your home assistant instance and then setup the component by either choosing 'Add integration' and search for 'Pod Point', or through using an auto-discovered Pod on the integrations screen.

Auto-discovered Pods

Pods are auto-discovered based on their DHCP host and client MAC address. Any device who's host starts with 'podpoint-*' whilst having a MAC address assigned to Espressif will trigger the auto-discovery feature.

Statuses

Multiple statuses are reported by the main pod sensor. The statuses and their meaning are shown below:

status display value description
available Available Pod is available to charge, may now be replace with "idle"
unavailable Unavailable Pod is unavailable
charging Charging Pod is charging an EV
suspended-ev Charged Connected EV has suspended charging. Can mean 'Charged', or 'EV has a schedule set'. Will show as 'Charged' to align with the Pod Point app.
suspended-evse Charging Paused Charging has been paused by the Pod, could be a schedule, or the key at the bottom has been turned off, or the charger is balanging house power
idle Ready Pod is ready to charge when an EV is connected
pending Pending An action has been requested (disable charging, charge now, delete charge now, enable charging) but the Pod has not yet acknowledged it. Can take 10 minutes to update.
out-of-service Out of service This pod is not in service. Reach out to Pod Point for more information.
waiting-for-schedule Waiting for schedule Pod charging is currently blocked by schedule. Connecting your vehicle will not begin charging.
connected-waiting-for-schedule Connected but waiting for schedule Pod is connected to an EV but schedule is preventing charging
charge-override Charging now (schedule override) 'Charge now' has been used to override your pods schedule and start a charging session now.

## Charge Modes

Charge modes can be one of the following values, their meanings can be found below:

mode description
smart This is your pods 'default' option, charging will follow your schedule, along with other smart functionality including randomly offsetting start and end times to help prevent grid shock.
override Your pod is in 'smart' mode, but you have set an override (a time period where your pod will ignore the schedule and charge). This is designed to be used when you need to charge ourside your normal schedule, and dont want to modify the underlying schedule.
manual This mode means your pod is not set to a schedule, and does not follow the offsets for start and end times, when you plug it in, it will charge.

Energy sensors

We populate two energy sensors for each pod connected to your account. These are for the total energy you have charged on a given pod and the current energy if you are connected and have a charge session ongoing.

If you want to add Pod Point stats to the built in energy dashboard, you should add the Current Charge Energy sensor as a device. This sensor reports when the value is reset and should allow you to track the energy usage of your pod.

Note: The Pod Point APIs perform some rounding on the kWh values returned meaning they may be sightly lower than the true energy consumed. We are unable to address this within the component.

Cost sensors

In order to provide the Total Cost and Last Completed Charge Cost sensors, we are using energy_cost values provided from Pod Point per **completed charge. There are some caveats to bare in mind here:

  • Energy use for each charge is rounded by Pod Point (see Energy sensors above) and energy costs are calculated on this rounded value.
  • You must set an accurate kWh cost within the Pod Point app (and keep this up to date if your provider/cost per kWh changes

Given the above rounding, in my opinion the cost values should be used as a guide rather than taken as gospel

**Charges are considered complete by Pod Point when you disconnect the vehicle, not when power delivery stops.

## Firmware update notifications

If an update is detected for your device, a new repair entry will be created within Home Assistant, prompting you to update using the mobile app. Unforrunately, at this time it is not possible to trigger the firmware update from outside of the Pod Point app but to restrictions with the Pod Point APIs.

Lovelace examples

Header images

In the example below, and for the sensors created by this integration, there are a number of pod 'images' that are included for use in the UI, each image and model is listed below.

For the sensor that comes installed we will add the image based on your pod model number.

Pod Model Image Link
Solo Universal /api/pod_point/static/uc.png
Solo Tethered /api/pod_point/static/2c.png
Solo 3 Universal /api/pod_point/static/uc-03.png
Solo 3 Tethered /api/pod_point/static/2c-03.png

Which pod do I have?

which pod

Entities YAML example:

type: entities
entities:
  - entity: sensor.psl_xxxxxx_status
    name: Pod Status
  - entity: sensor.psl_xxxxxx_charge_mode
    name: Charge Mode
  - entity: sensor.psl_xxxxxx_charge_override_end_time
    name: Charge Override Time Ends
  - entity: binary_sensor.psl_xxxxxx_cable_status
    name: Cable Status
  - entity: switch.psl_xxxxxx_charging_allowed
    name: Charging Allowed
  - entity: switch.psl_xxxxxx_smart_charge_mode
    name: Smart Charge Mode
  - entity: sensor.psl_xxxxxx_current_energy
    name: Current Energy
  - entity: sensor.psl_xxxxxx_total_energy
    name: Total Energy
  - entity: sensor.psl_xxxxxx_last_completed_charge_cost
    name: Last Completed Charge Cost
  - entity: sensor.psl_xxxxxx_total_cost
    name: Total Cost (completed charges)
title: Pod Point
header:
  type: picture
  image: /api/pod_point/static/uc-03.png # See above for options per-model
  tap_action:
    action: none
  hold_action:
    action: none
state_color: true

Entity YAML examples:

Long format charge time

type: entity
entity: sensor.psl_xxxxxx_completed_charge_time
attribute: long
name: Completed Charge Time (long)

Standard format charge time

type: entity
entity: sensor.psl_xxxxxx_completed_charge_time
name: Completed Charge Time
attribute: formatted

Contributions are welcome!

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

Development setup

If you want to develop with this locally and test within the devcontainer, ensure you follow the below setups (within the devcontainer):

make setup-debian
make setup

Once you have setup the environment with all of the dependencies, try running the tests:

make test

pod-point-home-assistant-component's People

Contributors

blundell avatar mattrayner avatar mmillmor avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

pod-point-home-assistant-component's Issues

PodPoint didn’t load on 2022.12.6

Upgraded HASS to 2022.12.6. HACS says podpoint hasn’t loaded.

HASS log

Logger: homeassistant.setup
Source: setup.py:338
First occurred: 15:24:15 (1 occurrences)
Last logged: 15:24:15

Unable to prepare setup for platform pod_point.sensor: Platform not found (cannot import name 'UnitOfTime' from 'homeassistant.const' (/usr/src/homeassistant/homeassistant/const.py)).

Podpoint values not updating

Since updating to 1.2.1 values don't update and you have to reload the integration to get the values to change then they don't update again

Unable to login due to invalid credentials - fix detailed inside

Version 1.2.0

Configuration

Status: 401
Code: Unauthorised
Title: Authentication is required 
Detail: the user credentials were incorrect

Describe the bug

Tried to turn off charging to be displayed with an error saying it could not perform the action and needed to be Authenticated.

Reloaded the extension via hacs which then required a reboot of Home Assistant. After this was successful Home Assistant said we needed to re-configure it to which I tried to find it would not longer accept my correct user name and password leaving me to revert to the Podpoint app.

Debug log


Add your logs here.

Schedule Reset

Version of the custom_component

Latest

Configuration

Add your logs here.

Describe the bug

A clear and concise description of what the bug is.

I have a schedule to run charging at the cheapest times. 00:30 - 06:30. I noticed it I toggle the charging allowed switch to ON the schedule is disabled in the pod point app. When the switch is OFF the schedule is enabled however my custom times are also reset to 00:00 which means charging doesn't happen at all.

Is there a way to restore my settings and just toggle the schedule on/off?

Debug log


Add your logs here.

Total energy keeps incrementing

Version of the custom_component

0.3.0-beta2

Configuration

Using a Pod Point Solo charger

Describe the bug

Every 5 minutes I see the "total energy" sensor increment by the total energy amount (e.g. if the reported total energy was 500 kWh, then I see 500, then 5min later 1000, then 1500 etc)

Debug log

PodPoint Current Energy Sensor

I have installed your PP HA component and everything seems to be working fine - except...

The sensor.current_energy displays the current charge energy fine whilst the charger is plugged in.

However as soon as I unplug the charger is seems to create a significant negative value which then negates the previous data.

IMG_0786

The attached shows three charging sessions and the huge negative spike. It doesn't seem to make any difference when I unplug - 1,2 or 3 hrs after charge complete it's all the same.

Any idea why this should be? Or what am I doing wrong?

Regards
David

Add a switch to set Charge Mode

Is your feature request related to a problem? Please describe.
Currently we can only display the charge mode set for a pod, it would be helpful to set one.

Describe the solution you'd like
We should create a switch there 'on' is smart mode and 'off' is manual mode.

Describe alternatives you've considered
We could use a service to do so, but as there are only two options, a switch seems both easier for a user to manage, and the appropriate options.

I think that the best way to handle this is with a switch that does not respond to is_on, this will show both on and off states without the toggle indicator

PSL- Cable Status shows plugged in, but it is not (when the Pod Point is in Smart mode)

Version of the custom_component

2.0.1
(This issue was not seen previously in the 1.X versions)

Configuration

I have the original big round Pod Point, firmware A22P-2.35.0-00002 reported by this integration.

My whole configuration.yaml? Not relevant here.

Describe the bug

Since I updated to the new 2.0.1 PodPoint integration my "Cable Status" shows Plugged In, but it is not. I have a Solo 1

I have "Smart Charge" mode turned on (schedules set via the Pod Point mobile app).

Plugging the connector in to my car, wating 5 minutes the state remains Plugged In.

Removing the Pod Point connector from my car and waiting another 5 minutes, the Cable Status remains Plugged In.

I expect Connection Pod Point and Connection Car history to be approximately the same (bar 2 and 3 below)
Screenshot_20240411_162845_Home Assistant

I updated the Pod Point integration around 10 am on the screenshot above.

Starting a Schedule Override puts the Cable Status to "Unplugged" for this time.

Stopping the Schedule Override using the Stop Pod Point Charge Now service puts the Cable Status back to "Plugged In"

Debug log

Selected Cable Status attributes from the Home Assistant Developer Tools tab:


statuses:
  - id: 1
    name: Available
    key_name: available
    label: Available
    door: A
    door_id: 1
  - id: 99
    name: SUSPENDED_EVSE
    key_name: SUSPENDED_EVSE
    label: SUSPENDED_EVSE
    door: A
    door_id: 1
unit_connectors:
  - connector:
      id: 102
      door: A
      door_id: 1
      power: 7
      current: 32
      voltage: 230
      charge_method: Single Phase AC
      has_cable: true
      socket:
        type: IEC 62196-2 Type 2
        description: Type 2 socket
        ocpp_name: sType2
        ocpp_code: 3


  version_info:
    manifest_id: A22P-2.35.0-00002
  update_status:
    is_update_available: false
charge_override: null
offering_energy: false
last_message_at: "2024-04-11T15:40:44+00:00"
charging_state: SUSPENDED_EVSE
connectivity_status:
  ppid: PSL-16XXXX
  connected_components:
    - evses
  evses:
    - id: 1
      architecture: arch2
      connectivityState:
        protocol: PPCP
        connectivityStatus: ONLINE
        signalStrength: -75
        lastMessageAt: "2024-04-11T15:40:44+00:00"
        connectionStartedAt: null
        connectionQuality: 2
      connectors:
        - id: 1
          door: A
          chargingState: SUSPENDED_EVSE
      energyOfferStatus:
        isOfferingEnergy: false
        reason: CHARGE_SCHEDULE
        until: "2024-04-12T00:00:00+00:00"
        randomDelay: null
        doNotCache: false
state: suspended-evse
device_class: plug
friendly_name: PSL-166021 Cable Status


Install on Home assistant 2022.8.7

I am new to HA and this is likely a duffer question, but it might be worth updating the readme for the newbee's !

Github readme says

"Once you have installed either manually or via HACS, restart your home assistant instance and then setup the component by choosing 'Add integration' and search for 'Pod Point' "

I've installed through HACS and 'Pod Point' is available in the HACS/Integrations/Pod Point as shown in the screenshot.
But I am stuck on the next step in bold ? Where do I 'Add integration' ?
I can't find anything in 'Developer Tools' or 'Settings' menu that reference Pod Point.

I'm running HA on Virtual Box with the latest HA version
Home Assistant 2022.8.7
Supervisor 2022.08.3
Operating System 8.5
Frontend 20220802.0 - latest

pod point

Current Energy doesn't drop to zero

Version of the custom_component

Current version

Configuration

N/A

Describe the bug

Current Energy doesn't drop to zero after charging complete, stays at top level until car is unplugged.

Stop Charge Now - Clearer/cleaner way to cancel a schedule override

Is your feature request related to a problem? Please describe.

I want to be able to cancel any schedule override that might be set on my Pod Point, which I might have started using the Charge Now button on the Pod Point app or the Charge Now service in the HA integration.

Describe the solution you'd like

I'd like an extra service, "Stop Charge Now" named like the Pod Point app button; or allow 0 seconds in the Charge Now service call.

Or mention in the documentation what the recommended way to cancel a schedule override is.

Describe alternatives you've considered

Configuring a 5 second override to overwite anything that might be running.

`
if:

  • condition: state
    entity_id: sensor.psl_166021_charge_override_end_time
    state: unknown
    then: []
    else:
  • service: pod_point.charge_now
    data:
    seconds: 5
    `

Additional context

Integration is using deprecated `DEVICE_CLASS_*` constants

Version of the custom_component

All

Configuration

n/a

Describe the bug

This custom integration uses deprecated DEVICE_CLASS_* constants in its codebase.

The DEVICE_CLASS_* constants have been deprecated and replaced in Home Assistant Core 2021.12 (over a year ago). I would highly suggest updating/migrating this integration to the new enums.

For example, for the device classes supported by the sensor platform, there is now a SensorDeviceClass enum. So if a sensor previously used the DEVICE_CLASS_ENERGY constant, it should now use SensorDeviceClass.ENERGY. Other platforms (like binary_sensor, and number) provide similar enumerations for their supported device classes.

The migration thus only consists of replacing constants with an enumeration member and is, therefore, very low impact and should be fairly straightforward.

If I can help resolve any questions regarding this change or migration, feel free to ask or respond to this issue. I'm happy to help!

Kindest regards,

../Frenck

Debug log


n/a

Average Power

It it possible to have a kW or Amp sensor which shows what the average(mean) kW or Amp output of the Pod Point was since the last period of kWh increase?

basically:

0.9kWh passed since last output 15mins ago = 0.9/0.25 = 3.6kW Charge Power
1.4kWh passed since last output 15mins ago = 1.4/0.25 = 5.6kW Charge Power

Average Speed over charge period:

start timer from charge passed increases to 0.1kWh to point where value no longer increases.

then take that value of time say 50kWh was passed and the charger ran for 7hrs 30mins so = 50/7.5 = 6.67kW Average Charge Power

Add support for custom voice intents and sentences

Is your feature request related to a problem? Please describe.
Using the new features in 2023.2 I'd like to be able to find out information about my pods and enable/disable charging using my voice.

Describe the solution you'd like
I should Be able to use the built-in voice assistant to find out information about my pod(s) and turn charging on/off

Describe alternatives you've considered
We could NOT do this, but then we wouldnt be good home assistant citizens

Additional context
N/A

Unable to prepare setup for platform pod_point.*: Platform not found (No module named 'podpointclient.charge_mode')

Version of the custom_component

1.2.0

Configuration

Add your logs here.

Describe the bug

Unable to install the custom component through HACS 1.32.1 on a Generic x86-64 hardware

Debug log


Logger: homeassistant.setup
Source: setup.py:379 
First occurred: 13:22:28 (4 occurrences) 
Last logged: 13:22:28

Unable to prepare setup for platform pod_point.binary_sensor: Platform not found (No module named 'podpointclient.charge_mode').
Unable to prepare setup for platform pod_point.sensor: Platform not found (No module named 'podpointclient.charge_mode').
Unable to prepare setup for platform pod_point.switch: Platform not found (No module named 'podpointclient.charge_mode').
Unable to prepare setup for platform pod_point.update: Platform not found (No module named 'podpointclient.charge_mode').

Add Vehicle information from Pod Point

Is your feature request related to a problem? Please describe.
Pod Point provides information about the user's vehicle including make, model, and a picture. It would be great to have this into HA. You could use automations to detect when the charge delivered is equal to the capacity of the vehicle you are using, or calculate how many 'full charges' have been delivered.

Describe the solution you'd like
It would be great to have a new entity which contains the image of the car, name of it, make and some additional attributes which may be useful for users

Expose a "Charged" status like the PodPoint app does

Is your feature request related to a problem? Please describe.
I'd like to set the colour of a lamp inside my house to show when my Pod Point is actually delivering power.

Describe the solution you'd like
Mirror the current Pod Point app and show a status change from Charging to Charged.

Describe alternatives you've considered
Using the status from my car, but it is not sent reliably - I'd rather be polling the mains powered PodPoint.

Additional context
I've seen that you have considered this feature before, but seeing it in the Pod Point app, perhaps the API reports this state now?

Charged
Your battery is charged or there is a charge schedule set on your vehicle.

PodPoint app Screenshot:
Screenshot_20240331_173758_Pod Point

Invalid handler on install

image

I have installed the integration via HACS, but just get this message. I have also followed the manual installation instructions to the letter, but that doesn't work either.

Am I doing something wrong?

Integration status does not reflect actual status of pod point

Hi,
Great integration !! I am not sure if this would be described as a bug or a feature request, but my problem is as follows :
As soon as I enable "Charging Allowed" the pod point status changes in HA to "Charging" within a few seconds.
However this does not reflect the actual status of the pod point. It can take up to 5 minutes for the pod-point servers to connect to my pod point and enable it.

Why is this important ?
My pod point is really sensitive to my solar inverter and during daytime (when my inverter is running) it can't handle charging more than 8A. Any higher the pod-point detects a fault, trips and goes out of service. This requires a manual reset from the circuit breaker. [problem has been reported to pod-point but it appears from forums that this is a known hardware issue and pod point can't do anything about it, they are currently ignoring my e-mails !]

So I need to know when the pod-point has successfully received the enable command so during daytime I can then quickly communicate with my vehicle and set the charge current to 8A to avoid a trip. Setting the charge current has to be done after the pod-point is enabled as upon vehicle/pod-point initialisation the charging current always defaults to the previous charge session (This is usually 30A following an overnight charge which is possible at this current because the solar inverter is off).

I currently use timers to manage this sequencing, but timely integration status would make the entire sequencing a whole lot easier !
Is this possible ?

Charging Allowed switch failing

Version of the custom_component

1.2.1
this also occurred after updating homeassistant core to 2024.2.0. I can see the .1 minor update available so will try that update next...

Configuration

alias: Car charge off peak start
description: ""
trigger:
  - platform: state
    entity_id:
      - schedule.off_peak_electricity
    to: "on"
condition:
  - condition: state
    entity_id: device_tracker.car_device_tracker
    state: home
action:
  - service: switch.turn_on
    metadata: {}
    data: {}
    target:
      entity_id: switch.podpoint_charging_allowed
mode: single

Add your logs here.

Logger: homeassistant.components.automation.car_charge_off_peak_start
Source: components/automation/__init__.py:666
Integration: Automation (documentation, issues)
First occurred: 9 February 2024 at 00:00:00 (5 occurrences)
Last logged: 07:36:31

While executing automation automation.car_charge_off_peak_start
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/automation/__init__.py", line 666, in async_trigger
    return await self.action_script.async_run(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1600, in async_run
    return await asyncio.shield(run.async_run())
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 435, in async_run
    await self._async_step(log_exceptions=False)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 487, in _async_step
    self._handle_exception(
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 512, in _handle_exception
    raise exception
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 485, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 723, in _async_call_service_step
    response_data = await self._async_run_long_action(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 685, in _async_run_long_action
    return long_task.result()
           ^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2279, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2316, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 892, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 962, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/config/custom_components/pod_point/switch.py", line 43, in async_turn_on
    await api.async_set_schedule(enabled=False, pod=self.pod)
  File "/usr/local/lib/python3.12/site-packages/podpointclient/client.py", line 123, in async_set_schedule
    await self.auth.async_update_access_token()
  File "/usr/local/lib/python3.12/site-packages/podpointclient/helpers/auth.py", line 63, in async_update_access_token
    access_token_updated: bool = await self.__update_access_token()
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/podpointclient/helpers/auth.py", line 95, in __update_access_token
    response = await wrapper.post(
               ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/podpointclient/helpers/api_wrapper.py", line 67, in post
    return await self.__wrapper(
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/podpointclient/helpers/api_wrapper.py", line 183, in __wrapper
    raise exception
  File "/usr/local/lib/python3.12/site-packages/podpointclient/helpers/api_wrapper.py", line 128, in __wrapper
    response = await self._session.post(
                     ^^^^^^^^^^^^^^^^^^
AttributeError: 'Session' object has no attribute 'post'

Describe the bug

I have an automation to enable charging during off-peak electricity (midnight to 5am). This has failed the last two nights in a row. Come the morning, if I 'reload' the integration the switch works (for a time).

Status Incorrect if using Charge Now in new Pod Point App

Status shows as: "Connected but waiting for schedule" if you use charge now, which allows you to bypass the charge schedule to instant charging, without disabling a schedule.

Attachments showing, Power being pulled, Charge being passed, and status from Integration.

Screenshot 2023-04-26 at 17 35 11
234643782-4155bea3-5982-4c49-9039-f6fdf834dd28
234643805-f45ef6d5-86d9-4b7c-b451-6f9b31d3eb5e
234643832-cc7f80b0-9c33-41db-9c3f-f2920e4e2bd2

Error on home assistant startup

Version of the custom_component

0.2.0

Card Configuration

type: entities
entities:
  - entity: sensor.pod_status
    name: Status
  - entity: binary_sensor.cable_status
    name: Cable
title: Pod Point
header:
  type: picture
  image: /api/pod_point/static/2c.png
  tap_action:
    action: none
  hold_action:
    action: none
state_color: true
show_header_toggle: true

Logs

Logger: homeassistant.components.sensor
Source: custom_components/pod_point/sensor.py:50
Integration: Sensor (documentation, issues)
First occurred: 22:33:20 (2 occurrences)
Last logged: 22:33:20

Error adding entities for domain sensor with platform pod_point
Error while setting up pod_point platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 382, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 614, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 801, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 553, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 590, in _async_write_ha_state
    state = self._stringify_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 559, in _stringify_state
    if (state := self.state) is None:
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 372, in state
    value = self.native_value
  File "/config/custom_components/pod_point/sensor.py", line 50, in native_value
    _LOGGER.info(self.extra_state_attributes[ATTR_STATE])
KeyError: 'state'

Describe the bug

When I restart home assistant, I notice this error in the logs, and the status of the device and sensors are incorrect. After a few minutes the state of the sensors and device corrects itself, I assume on next reload of data from API?

Frequency of polling

Hi

How frequently does this poll the podpoint to see if a status has changed and can this be increased to more frequently? I'm particularly interested in if the cable is plugged in or unplugged. It appears to check approximately every five minutes. This may however be podpoint doing this and not the integration.

Stewart

Unable to log in

I appear to be unable to log into my podpoint account any more. It was fine last night, but after restarting Home Assistant I get told the integration needs to log back in, but all I get is an authentication failure.

I changed my password and can log into the app fine. Trying to log in with the integration gives this.

Have they just changed anything, or is there anything else I can try?

This error originated from a custom integration.

Logger: podpointclient.helpers
Source: custom_components/pod_point/config_flow.py:127
integration: Pod Point (documentation, issues)
First occurred: 23:04:56 (16 occurrences)
Last logged: 23:09:23

Authentication error when creating auth or session. (<class 'podpointclient.errors.AuthError'>)
Error updating access token. Auth Error (403) - Access denied

Cable Status sensor is unreliable since last update

I had based all of my charging automations off this sensor because it was the quickest to update and most reliable.
Now this sensor can go an entire charging session without changing state from "unplugged" even if status is "charging" and it sais it is connected to the cloud

Update cost currency to load dynamically from the user's Pod Point account

Is your feature request related to a problem? Please describe.
I would like to automatically define the currency of our cost sensors based on the return from Pod Point rather than defaulting to GBP and allowing the user to set it.

Its un-necessary logic in the integration and should be cleaned up

Describe the solution you'd like
Looking at the user data returned from podpointclient, we should use the attributes returned from the Pod Point APIs to drive the currency data in PodPointTotalCostSensor and it's children

Describe alternatives you've considered
N/A

Additional context
This has become possible thanks to the changes in podpointclient

Multiple Accounts Breaks Integration

When I add multiple integrations it breaks with the error below. We have 2 charge points across 2 accounts.

Looking at the logs it looks like it could be as simple as the integration not generating a unique ID. It seems to work properly with a single account. I appreciate I'm using a beta version.

Happy to help with debugging if required.

Version of the custom_component

v0.3.0-beta2

Configuration

N/A

Describe the bug

When adding a second integration on a different account Home Assistant throws an error about duplicate sensors.

Debug log


2022-04-12 16:39:10 ERROR (MainThread) [homeassistant.components.binary_sensor] Platform pod_point does not generate unique IDs. ID pod_point_8377_PSL-118776 already exists - ignoring binary_sensor.cable_status
2022-04-12 16:39:10 ERROR (MainThread) [homeassistant.components.sensor] Platform pod_point does not generate unique IDs. ID pod_point_8377_PSL-118776 already exists - ignoring sensor.pod_status
2022-04-12 16:39:10 ERROR (MainThread) [homeassistant.components.sensor] Platform pod_point does not generate unique IDs. ID pod_point_8377_PSL-118776_total_energy already exists - ignoring sensor.psl_118776_total_energy
2022-04-12 16:39:10 ERROR (MainThread) [homeassistant.components.sensor] Platform pod_point does not generate unique IDs. ID pod_point_8377_PSL-118776_total_energy_current_charge_energy already exists - ignoring sensor.psl_118776_current_energy
2022-04-12 16:39:10 ERROR (MainThread) [homeassistant.components.switch] Platform pod_point does not generate unique IDs. ID pod_point_8377_PSL-118776 already exists - ignoring switch.charging_allowed
2022-04-12 16:39:17 WARNING (MainThread) [homeassistant.components.sensor] Entity sensor.psl_118776_total_energy_2 (<class 'custom_components.pod_point.sensor.PodPointTotalEnergySensor'>) with state_class total_increasing has set last_reset. Setting last_reset for entities with state_class other than 'total' is not supported. Please update your configuration if state_class is manually configured, otherwise report it to the custom component author.
2022-04-12 16:39:17 WARNING (MainThread) [homeassistant.components.sensor] Entity sensor.psl_118776_current_energy_2 (<class 'custom_components.pod_point.sensor.PodPointCurrentEnergySensor'>) with state_class total_increasing has set last_reset. Setting last_reset for entities with state_class other than 'total' is not supported. Please update your configuration if state_class is manually configured, otherwise report it to the custom component author.

Should the new "Pending" state be on the Charge Mode instead of Status?

Is your feature request related to a problem? Please describe.
Release 2.0.x has just added a new Pending state for the main Status, and I've been reviewing my automation triggers to see what needs to change.

Adding Pending to the main Status makes it harder to be specific about transitions like from "Connected Waiting" to "Charging" because the Pending state could interrupt that transition.

Describe the solution you'd like
The Pending state is intended to show when API requests are waiting to be actioned, and these affect the charge scheduling - isn't Pending more relevant to the Charge Mode than the status of the cable and charge delivery?

Describe alternatives you've considered
I can ignore the "From" transition when triggering on states, and can use "not_from" and "not_to" in the trigger if I edit the yaml.

I can use the Cable Status for Unplugged vs Plugged In.

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

Pod Point CT reading output

Hi Matt

Is there anyway to get the output from the CT the pod point uses for Load limiting? As this reports back to pod point according to their documentation and privacy agreement, and is also used as part of CarbonSync for national grid.

As this would be a great addition for real-time property load detailing.

Cable status in 0.1.0

Hi @mattrayner, seem to have a bug in the latest release 0.1.0 in that the cable status is incorrectly showing as unplugged when it is plugged in (however the Pod status is correctly showing "Connected - waiting for schedule").

Screenshot of 0.0.5
CleanShot 2022-03-02 at 16 26 58@2x

Screenshot of 0.1.0 after restarting to reload integration
CleanShot 2022-03-02 at 16 21 21@2x

Cosmetic Issues in 1.0

Missing Label

One of the labels for an option is not showing
image

Two devices

I now have two devices (one has no entities)
image
image

Functionally seems fine

Error adding entities for domain sensor with platform pod_point

New to this Integration. Don't have Current and Total Charge sensors present,
Found the below errors in the logs. Have deleted and reconfigured the integration, no change.
Integration installed via HACS.

Edit: I've just realised that there are Beta versions specifying "Totals broken". However, I'm not using one of these. Should the totals be working in the latest Release?

Version: v0.2.0

System Health

version core-2022.4.7
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.9.9
os_name Linux
os_version 5.10.108
arch x86_64
timezone Europe/London
Home Assistant Community Store
GitHub API ok
GitHub Content ok
GitHub Web ok
GitHub API Calls Remaining 4889
Installed Version 1.24.5
Stage running
Available Repositories 1030
Downloaded Repositories 17
Home Assistant Cloud
logged_in false
can_reach_cert_server ok
can_reach_cloud_auth ok
can_reach_cloud ok
Home Assistant Supervisor
host_os Home Assistant OS 7.6
update_channel stable
supervisor_version supervisor-2022.04.0
docker_version 20.10.9
disk_total 11.1 GB
disk_used 7.0 GB
healthy true
supported true
board ova
supervisor_api ok
version_api ok
installed_addons File editor (5.3.3), Samba share (9.6.1), Nginx Proxy Manager (0.11.0), MariaDB (2.4.0), Duck DNS (1.14.0), Check Home Assistant configuration (3.10.0), Mosquitto broker (6.0.2)
Dashboards
dashboards 4
resources 8
views 10
mode storage

Error in Logs:

`Logger: homeassistant.components.sensor
Source: custom_components/pod_point/sensor.py:50
Integration: Sensor (documentation, issues)
First occurred: 16:16:52 (4 occurrences)
Last logged: 18:32:22

-Error adding entities for domain sensor with platform pod_point
-Error while setting up pod_point platform for sensor

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 382, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 614, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 799, in add_to_platform_finish
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 532, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 570, in _async_write_ha_state
state = self._stringify_state(available)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 538, in _stringify_state
if (state := self.state) is None:
File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 410, in state
value = self.native_value
File "/config/custom_components/pod_point/sensor.py", line 50, in native_value
_LOGGER.info(self.extra_state_attributes[ATTR_STATE])
KeyError: 'state'
`

Charge times and costs are incorrect if a user upgrades/changes their pod device

Version of the custom_component

All current versions

Configuration

N/A

Describe the bug

If a user has previously had a 'home' pod on their account and upgrades/changes their pod device, charge times are mis-calculated.

This is because we attribute time for each charge to a device, but total energy as all 'home' pod devices a user has had.

This can lead to weird stats such as '2500kWh charged over 50 hours' which would give a charging rate of 50kWh from a pod device (far more than possible).

We should update how we are calculating both TIME charged, and ENERGY to be either scoped per-device, or to add additional entities which are 'all' charge across all pods.

Reported on the HA community forums here: https://community.home-assistant.io/t/pod-point-ev-charger-integration/307702/99?u=mattrayner

Debug log

N/A

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.