Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New laadpaal sensors #140

Closed
Arnoudd opened this issue Sep 14, 2024 · 13 comments
Closed

New laadpaal sensors #140

Arnoudd opened this issue Sep 14, 2024 · 13 comments
Labels

Comments

@Arnoudd
Copy link
Contributor

Arnoudd commented Sep 14, 2024

Since the introduction of powerplay for the laadpaal there could be some new sensors added. Like the desired added km's, desired km's, the time it should be ready, the powerplay earnings and so on.

This is how it looks on screen
image

Is there a chance these could be added? I could send some logging if needed.


@fsaris
Copy link
Owner

fsaris commented Sep 14, 2024

Please enable debug logging and provide some logs. Then I should be able to find the correct value and add the sensors

@Arnoudd
Copy link
Contributor Author

Arnoudd commented Sep 14, 2024

Please enable debug logging and provide some logs. Then I should be able to find the correct value and add the sensors

Here's some logging. I believe it's all in here:

2024-09-14 15:27:13.896 DEBUG (MainThread) [custom_components.zonneplan_one.api] ZonneplanAPI response body: {'data': {'contracts': [{'uuid': 'xxxxx-xxxx-xxxx-xxxx-xxxx ', 'label': 'Charge laadpaal', 'type': 'charge_point_installation', 'start_date': '2023-01-04T23:00:00.000000Z', 'end_date': None, 'meta': {'serial_number': 'X', 'identifier': 'X', 'first_measured_at': '2023-10-20T08:00:01.000000Z', 'last_measured_at': '2024-09-14T13:25:00.000000Z', 'show_in_contract_screen': True, 'session_charging_cost_total': 3116086, 'session_flex_result': None, 'session_charged_energy': 2046, 'session_average_cost_in_cents': 1523013, 'charging_cost_total': 3116086, 'flex_result': None, 'charged_energy': 2046, 'average_cost_in_cents': 1523013}, 'state': {'connectivity_state': True, 'state': 'Charging', 'power_actual': 10467, 'energy_delivered_session': 2046, 'can_charge': True, 'can_schedule': True, 'charging_manually': False, 'charging_automatically': False, 'plug_and_charge': False, 'overload_protection_active': False, 'dynamic_charging_enabled': True, 'dynamic_charging_flex_enabled': True, 'dynamic_charging_flex_suppressed': False, 'dynamic_load_balancing_health': 'HEALTHY', 'charge_schedules': [], 'dynamic_charging_user_constraints': {'desired_distance_in_kilometers': 65, 'desired_end_time': '2024-09-15T10:00:00.000000Z'}, 'charge_point_session': {'start_time': '2024-09-14T13:11:11.000000Z', 'charged_distance_in_kilometers': 10, 'active_vehicle_uuid': 'xxxxx-xxxx-xxxx-xxxx-xxxx'}, 'last_known_vehicle_uuid': 'eb28ea85-xxxx-xxx-xxx-xxxx', 'start_mode': 'AlwaysFlex'}, 'charge_schedules': []}], 'powerplay': None, 'vehicles': [{'uuid': 'xxxx-xxxx-xxxx-xxx-xxx', 'label': 'Peugeot e-208', 'logo_url': 'https://assets.zonneplan.nl/vehicles/logos/xxxxx-xxxxx-676-777-bae3d528baac.svg', 'consumption_wh_per_km': 200, 'charge_standard_power_in_w': 11000, 'battery_capacity_useable_wh': 50000}]}}
2024-09-14 15:27:13.896 INFO (MainThread) [custom_components.zonneplan_one.api] fetch: connections/xxxx-xxxx-xxxx-xxxx-xxxx/home-battery-installation/xxxxx-xxxx-xxx-xxx-xxxx
2024-09-14 15:27:13.896 DEBUG (MainThread) [custom_components.zonneplan_one.api] ZonneplanAPI request header: {'content-type': 'application/json;charset=utf-8', 'x-app-version': '4.12.1', 'x-api-version': 'v2', 'x-app-environment': 'production', 'x-ha-integration': '2024.6.0', 'If-None-Match': 'W/"xxxxxx"'}
2024-09-14 15:27:13.965 DEBUG (MainThread) [custom_components.zonneplan_one.api] ZonneplanAPI response header: <CIMultiDictProxy('Server': 'nginx', 'Date': 'Sat, 14 Sep 2024 13:27:13 GMT', 'Content-Type': 'application/json', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'Cache-Control': 'no-cache, private', 'Etag': 'W/"xxxxx"', 'x-ratelimit-limit': '60', 'x-ratelimit-remaining': '54', 'Strict-Transport-Security': 'max-age=63072000', 'Content-Encoding': 'gzip')>
2024-09-14 15:27:13.965 DEBUG (MainThread) [custom_components.zonneplan_one.api] ZonneplanAPI response status: 200
2024-

fsaris added a commit that referenced this issue Sep 15, 2024
Added the sensors:

- Charge point session cost (eur)
- Charge point cost total (eur)
- Charge point session average costs (eur/kWh)
- Charge point start mode
- Charge point dynamic load desired distance (km)
- Charge point dynamic load desired end time (datetime)
- Charge point session start time (datetime)
- Charge point session charged distance (km)
- Charge point dynamic charging enabled (true/false)
- Charge point dynamic charging flex enabled (true/false)
- Charge point dynamic charging flex suppressed (true/false)
@fsaris
Copy link
Owner

fsaris commented Sep 15, 2024

@Arnoudd I added some extra sensors, can you check the main version (beta) and verify if the values are correctly shown.

Added the sensors:

- Charge point session cost (eur)
- Charge point cost total (eur)
- Charge point session average costs (eur/kWh)
- Charge point start mode
- Charge point dynamic load desired distance (km)
- Charge point dynamic load desired end time (datetime)
- Charge point session start time (datetime)
- Charge point session charged distance (km)
- Charge point dynamic charging enabled (true/false)
- Charge point dynamic charging flex enabled (true/false)
- Charge point dynamic charging flex suppressed (true/false)

@fsaris fsaris added the Waiting for release part of beta label Sep 15, 2024
@Arnoudd
Copy link
Contributor Author

Arnoudd commented Sep 15, 2024

@Arnoudd I added some extra sensors, can you check the main version (beta) and verify if the values are correctly shown.

Added the sensors:

- Charge point session cost (eur)
- Charge point cost total (eur)
- Charge point session average costs (eur/kWh)
- Charge point start mode
- Charge point dynamic load desired distance (km)
- Charge point dynamic load desired end time (datetime)
- Charge point session start time (datetime)
- Charge point session charged distance (km)
- Charge point dynamic charging enabled (true/false)
- Charge point dynamic charging flex enabled (true/false)
- Charge point dynamic charging flex suppressed (true/false)

Is the const.py the only file I needed to update?
Because I get this error afterwards:

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 361, in _async_setup_platform
await asyncio.shield(awaitable)
File "/config/custom_components/zonneplan_one/sensor.py", line 118, in async_setup_entry
ZonneplanChargePointSensor(
File "/config/custom_components/zonneplan_one/sensor.py", line 163, in init
self._attr_native_value = self._value_from_coordinator()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/zonneplan_one/sensor.py", line 275, in _value_from_coordinator
raw_value = value = self.coordinator.getConnectionValue(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/zonneplan_one/coordinator.py", line 215, in getConnectionValue
elif not key in rv:
^^^^^^^^^
TypeError: argument of type 'NoneType' is not iterable

The weird thing is that initially all the added values loaded fine but them somethong broke. Maybe a value change from Zonneplan?

@fsaris
Copy link
Owner

fsaris commented Sep 15, 2024

Is the const.py the only file I needed to update

For this last change yes, but easiest to install is to enable beta in hacs and select the main version

The weird thing is that initially all the added values loaded fine but them somethong broke. Maybe a value change from Zonneplan?

Need to check. Maybe the sensor value isn't published when not charging.

Can you charge some log data ?

@Arnoudd
Copy link
Contributor Author

Arnoudd commented Sep 15, 2024

Is the const.py the only file I needed to update

For this last change yes, but easiest to install is to enable beta in hacs and select the main version

The weird thing is that initially all the added values loaded fine but them somethong broke. Maybe a value change from Zonneplan?

Need to check. Maybe the sensor value isn't published when not charging.

Can you charge some log data ?

Had another try but same result. After installation the integration starts fine thow some values don't properly load.
After a reload of the integration more then half of the values fail with this in logging:

 File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 361, in _async_setup_platform
    await asyncio.shield(awaitable)
  File "/config/custom_components/zonneplan_one/sensor.py", line 118, in async_setup_entry
    ZonneplanChargePointSensor(
  File "/config/custom_components/zonneplan_one/sensor.py", line 163, in __init__
    self._attr_native_value = self._value_from_coordinator()
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/zonneplan_one/sensor.py", line 275, in _value_from_coordinator
    raw_value = value = self.coordinator.getConnectionValue(
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/zonneplan_one/coordinator.py", line 215, in getConnectionValue
    elif not key in rv:
             ^^^^^^^^^

Don't see much more than this. If this isn't enough I'll do some more searching.

@fsaris
Copy link
Owner

fsaris commented Sep 15, 2024

Can you enable debug logging again?

I'm interested in the same log as you provided earlier.

2024-09-14 15:27:13.896 DEBUG (MainThread) [custom_components.zonneplan_one.api] ZonneplanAPI response body: {'data': {'contracts': [{'uuid': 'xxxxx-xxxx-xxxx-xxxx-xxxx ', 'label': 'Charge laadpaal', 'type': 'charge_point_installation', 'start_date': '2023-01-04T23:00:00.000000Z', 'end_date': None, 'meta': {'serial_number': 'X', 'identifier': 'X', 'first_measured_at': '2023-10-....

@Arnoudd
Copy link
Contributor Author

Arnoudd commented Sep 15, 2024

Can you enable debug logging again?

I'm interested in the same log as you provided earlier.

2024-09-14 15:27:13.896 DEBUG (MainThread) [custom_components.zonneplan_one.api] ZonneplanAPI response body: {'data': {'contracts': [{'uuid': 'xxxxx-xxxx-xxxx-xxxx-xxxx ', 'label': 'Charge laadpaal', 'type': 'charge_point_installation', 'start_date': '2023-01-04T23:00:00.000000Z', 'end_date': None, 'meta': {'serial_number': 'X', 'identifier': 'X', 'first_measured_at': '2023-10-....

I think I found it:
2024-09-15 19:53:48.626 DEBUG (MainThread) [custom_components.zonneplan_one.sensor] Value Charge point next schedule end: None [None] 2024-09-15 19:53:48.626 DEBUG (MainThread) [custom_components.zonneplan_one.sensor] Value Charge point dynamic load balancing health: HEALTHY [HEALTHY] 2024-09-15 19:53:48.626 DEBUG (MainThread) [custom_components.zonneplan_one.sensor] Value Charge point start mode: AlwaysFlex [AlwaysFlex] 2024-09-15 19:53:48.626 DEBUG (MainThread) [custom_components.zonneplan_one.sensor] Value Charge point dynamic load desired distance: 20 [20] 2024-09-15 19:53:48.626 DEBUG (MainThread) [custom_components.zonneplan_one.sensor] Value Charge point dynamic load desired end time: 2024-09-17 15:00:00+00:00 [2024-09-17T15:00:00.000000Z] 2024-09-15 19:53:48.628 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up zonneplan_one platform for sensor Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 361, in _async_setup_platform await asyncio.shield(awaitable) File "/config/custom_components/zonneplan_one/sensor.py", line 118, in async_setup_entry ZonneplanChargePointSensor( File "/config/custom_components/zonneplan_one/sensor.py", line 163, in __init__ self._attr_native_value = self._value_from_coordinator() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/zonneplan_one/sensor.py", line 275, in _value_from_coordinator raw_value = value = self.coordinator.getConnectionValue( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/zonneplan_one/coordinator.py", line 215, in getConnectionValue elif not key in rv: ^^^^^^^^^ TypeError: argument of type 'NoneType' is not iterable

fsaris added a commit that referenced this issue Sep 16, 2024
Added the sensors:

- Charge point session cost (eur)
- Charge point cost total (eur)
- Charge point session average costs (eur/kWh)
- Charge point start mode
- Charge point dynamic load desired distance (km)
- Charge point dynamic load desired end time (datetime)
- Charge point session start time (datetime)
- Charge point session charged distance (km)
- Charge point dynamic charging enabled (true/false)
- Charge point dynamic charging flex enabled (true/false)
- Charge point dynamic charging flex suppressed (true/false)
@fsaris
Copy link
Owner

fsaris commented Sep 16, 2024

@Arnoudd I added a check to prevent this error when charge_point_session isn't given by the API. Can you check if this works for you?

@Arnoudd
Copy link
Contributor Author

Arnoudd commented Sep 16, 2024

Yes, now it's working! Thanks for the addition!

I did take a look at the debug logging again and noticed these thow. Not all of them are related to the fix but thought you might wanna know.

2024-09-16 20:36:58.168 WARNING (MainThread) [homeassistant.components.sensor] Entity sensor.zonneplan_one_omvormer_expected_surplus (<class 'custom_components.zonneplan_one.sensor.ZonneplanPvSensor'>) is using state class 'measurement' which is impossible considering device class ('energy') it is using; expected None or one of 'total_increasing', 'total'; Please update your configuration if your entity is manually configured, otherwise create a bug report at https://github.com/fsaris/home-assistant-zonneplan-one/issues
2024-09-16 20:36:58.180 WARNING (MainThread) [homeassistant.components.sensor] Entity sensor.charge_laadpaal_charge_point_session_cost (<class 'custom_components.zonneplan_one.sensor.ZonneplanChargePointSensor'>) is using state class 'total_increasing' which is impossible considering device class ('monetary') it is using; expected None or one of 'total'; Please update your configuration if your entity is manually configured, otherwise create a bug report at https://github.com/fsaris/home-assistant-zonneplan-one/issues
2024-09-16 20:36:58.180 WARNING (MainThread) [homeassistant.components.sensor] Entity sensor.charge_laadpaal_charge_point_cost_total (<class 'custom_components.zonneplan_one.sensor.ZonneplanChargePointSensor'>) is using state class 'total_increasing' which is impossible considering device class ('monetary') it is using; expected None or one of 'total'; Please update your configuration if your entity is manually configured, otherwise create a bug report at https://github.com/fsaris/home-assistant-zonneplan-one/issues
2024-09-16 20:36:58.984 WARNING (MainThread) [homeassistant.components.sensor] Entity sensor.zonneplan_nexus_reactive_power (<class 'homeassistant.components.mqtt.sensor.MqttSensor'>) is using native unit of measurement 'Var' which is not a valid unit for the device class ('reactive_power') it is using; expected one of ['var']; Please update your configuration if your entity is manually configured, otherwise create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue+label%3A%22integration%3A+mqtt%22

Thanks again for your work! :)

fsaris added a commit that referenced this issue Sep 16, 2024
@fsaris
Copy link
Owner

fsaris commented Sep 16, 2024

The first 3 warnings should be resolved now if you use the latest const.py file.

The 4th warning is from a different component

@Arnoudd
Copy link
Contributor Author

Arnoudd commented Sep 16, 2024

The first 3 warnings should be resolved now if you use the latest const.py file.

The 4th warning is from a different component

You're right. Looks good to me now. 👍

fsaris added a commit that referenced this issue Sep 29, 2024
@fsaris
Copy link
Owner

fsaris commented Sep 29, 2024

@fsaris fsaris closed this as completed Sep 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants