jonasbkarlsson / ev_smart_charging

Electric vehicle smart charging for Home Assistant.
MIT License
171 stars 25 forks source link

component throws error at midnight #277

Closed hmmbob closed 2 months ago

hmmbob commented 3 months ago

Version of the custom_component

Version 1.11.0-dev2

Configuration

Standard setup, and using the template price sensor for Zonneplan (see wiki)

Describe the bug

I've seen the below error for a few days now, always at midnight

Debug log


2024-07-03 00:00:00.442 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
File "/config/custom_components/ev_smart_charging/coordinator.py", line 660, in update_sensors_new
await self.update_sensors(
File "/config/custom_components/ev_smart_charging/coordinator.py", line 823, in update_sensors
self.scheduler.create_base_schedule(scheduling_params, self.raw_two_days)
File "/config/custom_components/ev_smart_charging/helpers/coordinator.py", line 414, in create_base_schedule
lowest_hours = get_lowest_hours(
^^^^^^^^^^^^^^^^^
File "/config/custom_components/ev_smart_charging/helpers/coordinator.py", line 194, in get_lowest_hours
return get_lowest_hours_non_continuous(start_hour, ready_hour, raw_two_days, hours)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/ev_smart_charging/helpers/coordinator.py", line 225, in get_lowest_hours_non_continuous
if (time_end_index - time_start_index) < hours:
~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
TypeError: unsupported operand type(s) for -: 'int' and 'NoneType'

2024-07-03 00:00:00.447 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
File "/config/custom_components/ev_smart_charging/coordinator.py", line 229, in update_hourly
await self.update_sensors()
File "/config/custom_components/ev_smart_charging/coordinator.py", line 823, in update_sensors
self.scheduler.create_base_schedule(scheduling_params, self.raw_two_days)
File "/config/custom_components/ev_smart_charging/helpers/coordinator.py", line 414, in create_base_schedule
lowest_hours = get_lowest_hours(
^^^^^^^^^^^^^^^^^
File "/config/custom_components/ev_smart_charging/helpers/coordinator.py", line 194, in get_lowest_hours
return get_lowest_hours_non_continuous(start_hour, ready_hour, raw_two_days, hours)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/ev_smart_charging/helpers/coordinator.py", line 225, in get_lowest_hours_non_continuous
if (time_end_index - time_start_index) < hours:
~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
TypeError: unsupported operand type(s) for -: 'int' and 'NoneType'
jonasbkarlsson commented 3 months ago

Did it affect the actual charging?

hmmbob commented 3 months ago

Not sure, as our dynamic tariffs are lower during the day in this season, we're charging during the day instead of nights

jonasbkarlsson commented 3 months ago

I have made a v1.11.0-dev3 with the following changes:

Can you install this version, and see if you get the error next midnight?

hmmbob commented 3 months ago

Sure, I'll let you know tomorrow!

(FYI, the dev2 version threw the error again at midnight)

hmmbob commented 3 months ago

Jupz, the error is still there but with a lot more detail now indeed:

2024-07-05 00:00:00.436 ERROR (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] Is not able to calculate charging schedule!
2024-07-05 00:00:00.436 ERROR (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] start_hour = 2024-07-02 22:00:00+00:00
2024-07-05 00:00:00.438 ERROR (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] ready_hour = 2024-07-05 06:00:00+00:00
2024-07-05 00:00:00.438 ERROR (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] hours = 3
2024-07-05 00:00:00.438 ERROR (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] raw_two_days.data = [{'value': 0.2224329, 'start': datetime.datetime(2024, 7, 3, 22, 0, tzinfo=datetime.timezone.utc), 'end': datetime.datetime(2024, 7, 3, 23, 0, tzinfo=datetime.timezone.utc)}, {'value': 0.1939979, 'start': datetime.datetime(2024, 7, 3, 23, 0, tzinfo=datetime.timezone.utc), 'end': datetime.datetime(2024, 7, 4, 0, 0, tzinfo=datetime.timezone.utc)}, {'value': 0.1714314, 'start': datetime.datetime(2024, 7, 4, 0, 0, tzinfo=datetime.timezone.utc), 'end': datetime.datetime(2024, 7, 4, 1, 0, tzinfo=datetime.timezone.utc)}, {'value': 0.1637479, 'start': datetime.datetime(2024, 7, 4, 1, 0, tzinfo=datetime.timezone.utc), 'end': datetime.datetime(2024, 7, 4, 2, 0, tzinfo=datetime.timezone.utc)}, {'value': 0.1606382, 'start': datetime.datetime(2024, 7, 4, 2, 0, tzinfo=datetime.timezone.utc), 'end': datetime.datetime(2024, 7, 4, 3, 0, tzinfo=datetime.timezone.utc)}, {'value': 0.1605414, 'start': datetime.datetime(2024, 7, 4, 3, 0, tzinfo=datetime.timezone.utc), 'end': datetime.datetime(2024, 7, 4, 4, 0, tzinfo=datetime.timezone.utc)}, {'value': 0.1894604, 'start': datetime.datetime(2024, 7, 4, 4, 0, tzinfo=datetime.timezone.utc), 'end': datetime.datetime(2024, 7, 4, 5, 0, tzinfo=datetime.timezone.utc)}, {'value': 0.1938889, 'start': datetime.datetime(2024, 7, 4, 5, 0, tzinfo=datetime.timezone.utc), 'end': datetime.datetime(2024, 7, 4, 6, 0, tzinfo=datetime.timezone.utc)}, {'value': 0.1914085, 'start': datetime.datetime(2024, 7, 4, 6, 0, tzinfo=datetime.timezone.utc), 'end': datetime.datetime(2024, 7, 4, 7, 0, tzinfo=datetime.timezone.utc)}, {'value': 0.1785462, 'start': datetime.datetime(2024, 7, 4, 7, 0, tzinfo=datetime.timezone.utc), 'end': datetime.datetime(2024, 7, 4, 8, 0, tzinfo=datetime.timezone.utc)}, {'value': 0.1395479, 'start': datetime.datetime(2024, 7, 4, 8, 0, tzinfo=datetime.timezone.utc), 'end': datetime.datetime(2024, 7, 4, 9, 0, tzinfo=datetime.timezone.utc)}, {'value': 0.108463, 'start': datetime.datetime(2024, 7, 4, 9, 0, tzinfo=datetime.timezone.utc), 'end': datetime.datetime(2024, 7, 4, 10, 0, tzinfo=datetime.timezone.utc)}, {'value': 0.0669479, 'start': datetime.datetime(2024, 7, 4, 10, 0, tzinfo=datetime.timezone.utc), 'end': datetime.datetime(2024, 7, 4, 11, 0, tzinfo=datetime.timezone.utc)}, {'value': -0.01509, 'start': datetime.datetime(2024, 7, 4, 11, 0, tzinfo=datetime.timezone.utc), 'end': datetime.datetime(2024, 7, 4, 12, 0, tzinfo=datetime.timezone.utc)}, {'value': -0.028642, 'start': datetime.datetime(2024, 7, 4, 12, 0, tzinfo=datetime.timezone.utc), 'end': datetime.datetime(2024, 7, 4, 13, 0, tzinfo=datetime.timezone.utc)}, {'value': 0.0548479, 'start': datetime.datetime(2024, 7, 4, 13, 0, tzinfo=datetime.timezone.utc), 'end': datetime.datetime(2024, 7, 4, 14, 0, tzinfo=datetime.timezone.utc)}, {'value': 0.0895265, 'start': datetime.datetime(2024, 7, 4, 14, 0, tzinfo=datetime.timezone.utc), 'end': datetime.datetime(2024, 7, 4, 15, 0, tzinfo=datetime.timezone.utc)}, {'value': 0.1139201, 'start': datetime.datetime(2024, 7, 4, 15, 0, tzinfo=datetime.timezone.utc), 'end': datetime.datetime(2024, 7, 4, 16, 0, tzinfo=datetime.timezone.utc)}, {'value': 0.1455979, 'start': datetime.datetime(2024, 7, 4, 16, 0, tzinfo=datetime.timezone.utc), 'end': datetime.datetime(2024, 7, 4, 17, 0, tzinfo=datetime.timezone.utc)}, {'value': 0.2009796, 'start': datetime.datetime(2024, 7, 4, 17, 0, tzinfo=datetime.timezone.utc), 'end': datetime.datetime(2024, 7, 4, 18, 0, tzinfo=datetime.timezone.utc)}, {'value': 0.2506985, 'start': datetime.datetime(2024, 7, 4, 18, 0, tzinfo=datetime.timezone.utc), 'end': datetime.datetime(2024, 7, 4, 19, 0, tzinfo=datetime.timezone.utc)}, {'value': 0.2823037, 'start': datetime.datetime(2024, 7, 4, 19, 0, tzinfo=datetime.timezone.utc), 'end': datetime.datetime(2024, 7, 4, 20, 0, tzinfo=datetime.timezone.utc)}, {'value': 0.2518359, 'start': datetime.datetime(2024, 7, 4, 20, 0, tzinfo=datetime.timezone.utc), 'end': datetime.datetime(2024, 7, 4, 21, 0, tzinfo=datetime.timezone.utc)}, {'value': 0.2257846, 'start': datetime.datetime(2024, 7, 4, 21, 0, tzinfo=datetime.timezone.utc), 'end': datetime.datetime(2024, 7, 4, 22, 0, tzinfo=datetime.timezone.utc)}]

And the config:

image

jonasbkarlsson commented 3 months ago

Thanks fore the error log. I think I know what the problem is. The integration is recalculating it's state based on changes in input information (such as the price sensor) and once per hour. If the "once per hour" update happens a few milliseconds before the price sensor is updated at midnight, it might be reason why there are problems.

But if this is the case, it also means that a few milliseconds after the error, the price sensor will be updated, and then everything will work as normal.

If you have the possibilty to "Enable debug logging" for the integration around midnight, it could help confirming this theory.

I will try to recreate the problem and investigate what is exactly happening.

hmmbob commented 3 months ago

I'll see what this yields:

    - id: ev_enable_debug_logging
      alias: "Enable debug logging for ev_smart_charging component around midnight"
      description: "Enable debug logging for ev_smart_charging component around midnight"
      mode: single
      trigger:
        - platform: time
          at: "23:55:00"
          id: start_debug_logging
        - platform: time
          at: "00:05:00"
          id: stop_debug_logging
      action:
        - alias: "Choose to start or stop debug logging"
          choose:
            - conditions:
                - condition: trigger
                  id: start_debug_logging
              sequence:
                - alias: "Start debug logging for ev_smart_charging"
                  service: logger.set_level
                  data:
                    custom_components.ev_smart_charging: debug
                    # not sure if this also covers the next logger, so setting it explicitly
                    custom_components.ev_smart_charging.helpers.coordinator: debug
            - conditions:
                - condition: trigger
                  id: stop_debug_logging
              sequence:
                - alias: "Stop debug logging for ev_smart_charging"
                  service: logger.set_level
                  data:
                    custom_components.ev_smart_charging: warning
                    custom_components.ev_smart_charging.helpers.coordinator: warning
jonasbkarlsson commented 2 months ago

I might have been able to recreate the problem.

The following template:

template:
  - sensor:
      - name: "Nordpool template price sensor"
        unique_id: nordpool_template_price_sensor
        unit_of_measurement: "öre/kWh"
        state: "{{ states('sensor.nordpool_kwh_se3_sek_2_095_0') }}"
        availability: "{{ 'sensor.nordpool_kwh_se3_sek_2_095_0' | has_value }}"
        attributes:
            prices_today: >
                {%- set forecast_data = state_attr('sensor.nordpool_kwh_se3_sek_2_095_0', 'raw_today') %}
                {%- set forecast_data2 = state_attr('sensor.nordpool_kwh_se3_sek_2_095_0', 'raw_tomorrow') %}
                {%- set time_key = 'start' %}
                {%- set price_key = 'value' %}
                {%- set ns = namespace(data=[]) %}
                {%- for i in forecast_data | default([], true) if i[time_key].date() == now().date() %}
                  {%- set ns.data = ns.data + [dict(time = i[time_key].strftime('%Y-%m-%d %H:%M:%S%z'), price = i[price_key])] %}
                {%- endfor %}
                {%- for i in forecast_data2 | default([], true) if i[time_key].date() == now().date() %}
                  {%- set ns.data = ns.data + [dict(time = i[time_key].strftime('%Y-%m-%d %H:%M:%S%z'), price = i[price_key])] %}
                {%- endfor %}
                {{ ns.data }}
            prices_tomorrow: >
                {%- set forecast_data = state_attr('sensor.nordpool_kwh_se3_sek_2_095_0', 'raw_today') %}
                {%- set forecast_data2 = state_attr('sensor.nordpool_kwh_se3_sek_2_095_0', 'raw_tomorrow') %}
                {%- set time_key = 'start' %}
                {%- set price_key = 'value' %}
                {%- set ns = namespace(data=[]) %}
                {%- for i in forecast_data | default([], true) if i[time_key].date() == (now()+timedelta(days=1)).date() %}
                  {%- set ns.data = ns.data + [dict(time = i[time_key].strftime('%Y-%m-%d %H:%M:%S%z'), price = i[price_key])] %}
                {%- endfor %}
                {%- for i in forecast_data2 | default([], true) if i[time_key].date() == (now()+timedelta(days=1)).date() %}
                  {%- set ns.data = ns.data + [dict(time = i[time_key].strftime('%Y-%m-%d %H:%M:%S%z'), price = i[price_key])] %}
                {%- endfor %}
                {{ ns.data }}

Gave this log:

2024-07-07 00:00:00.078 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] EVSmartChargingCoordinator.update_sensors()
2024-07-07 00:00:00.079 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] entity_id = sensor.nordpool_template_price_sensor
2024-07-07 00:00:00.079 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] new_state = <state sensor.nordpool_template_price_sensor=7.7; prices_today=[{'time': '2024-07-06 00:00:00+0200', 'price': 17.46}, {'time': '2024-07-06 01:00:00+0200', 'price': 13.36}, {'time': '2024-07-06 02:00:00+0200', 'price': 14.94}, {'time': '2024-07-06 03:00:00+0200', 'price': 19.95}, {'time': '2024-07-06 04:00:00+0200', 'price': 22.26}, {'time': '2024-07-06 05:00:00+0200', 'price': 7.46}, {'time': '2024-07-06 06:00:00+0200', 'price': 6.35}, {'time': '2024-07-06 07:00:00+0200', 'price': 6.25}, {'time': '2024-07-06 08:00:00+0200', 'price': 3.96}, {'time': '2024-07-06 09:00:00+0200', 'price': 0.36}, {'time': '2024-07-06 10:00:00+0200', 'price': -0.04}, {'time': '2024-07-06 11:00:00+0200', 'price': -0.02}, {'time': '2024-07-06 12:00:00+0200', 'price': -0.03}, {'time': '2024-07-06 13:00:00+0200', 'price': -0.14}, {'time': '2024-07-06 14:00:00+0200', 'price': -2.48}, {'time': '2024-07-06 15:00:00+0200', 'price': -3.08}, {'time': '2024-07-06 16:00:00+0200', 'price': -0.68}, {'time': '2024-07-06 17:00:00+0200', 'price': 0.01}, {'time': '2024-07-06 18:00:00+0200', 'price': 2.21}, {'time': '2024-07-06 19:00:00+0200', 'price': 0.5}, {'time': '2024-07-06 20:00:00+0200', 'price': 7.61}, {'time': '2024-07-06 21:00:00+0200', 'price': 10.69}, {'time': '2024-07-06 22:00:00+0200', 'price': 19.97}, {'time': '2024-07-06 23:00:00+0200', 'price': 7.7}], prices_tomorrow=[], unit_of_measurement=öre/kWh, friendly_name=Nordpool template price sensor @ 2024-07-06T23:00:00.118806+02:00>
2024-07-07 00:00:00.081 DEBUG (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] charging_hours = 1
2024-07-07 00:00:00.081 DEBUG (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] ready_hour = 2024-07-07 13:00:00+00:00
2024-07-07 00:00:00.081 ERROR (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] Is not able to calculate charging schedule!
2024-07-07 00:00:00.081 ERROR (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] start_hour = 2024-07-06 19:00:00+00:00
2024-07-07 00:00:00.081 ERROR (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] ready_hour = 2024-07-07 13:00:00+00:00
2024-07-07 00:00:00.081 ERROR (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] hours = 1
2024-07-07 00:00:00.081 ERROR (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] raw_two_days.data = [{'value': 17.46, 'start': datetime.datetime(2024, 7, 5, 22, 0, tzinfo=datetime.timezone.utc), 'end': datetime.datetime(2024, 7, 5, 23, 0, tzinfo=datetime.timezone.utc)}, {'value': 13.36, 'start': datetime.datetime(2024, 7, 5, 23, 0, tzinfo=datetime.timezone.utc), 'end': datetime.datetime(2024, 7, 6, 0, 0, tzinfo=datetime.timezone.utc)}, {'value': 14.94, 'start': datetime.datetime(2024, 7, 6, 0, 0, tzinfo=datetime.timezone.utc), 'end': datetime.datetime(2024, 7, 6, 1, 0, tzinfo=datetime.timezone.utc)}, {'value': 19.95, 'start': datetime.datetime(2024, 7, 6, 1, 0, tzinfo=datetime.timezone.utc), 'end': datetime.datetime(2024, 7, 6, 2, 0, tzinfo=datetime.timezone.utc)}, {'value': 22.26, 'start': datetime.datetime(2024, 7, 6, 2, 0, tzinfo=datetime.timezone.utc), 'end': datetime.datetime(2024, 7, 6, 3, 0, tzinfo=datetime.timezone.utc)}, {'value': 7.46, 'start': datetime.datetime(2024, 7, 6, 3, 0, tzinfo=datetime.timezone.utc), 'end': datetime.datetime(2024, 7, 6, 4, 0, tzinfo=datetime.timezone.utc)}, {'value': 6.35, 'start': datetime.datetime(2024, 7, 6, 4, 0, tzinfo=datetime.timezone.utc), 'end': datetime.datetime(2024, 7, 6, 5, 0, tzinfo=datetime.timezone.utc)}, {'value': 6.25, 'start': datetime.datetime(2024, 7, 6, 5, 0, tzinfo=datetime.timezone.utc), 'end': datetime.datetime(2024, 7, 6, 6, 0, tzinfo=datetime.timezone.utc)}, {'value': 3.96, 'start': datetime.datetime(2024, 7, 6, 6, 0, tzinfo=datetime.timezone.utc), 'end': datetime.datetime(2024, 7, 6, 7, 0, tzinfo=datetime.timezone.utc)}, {'value': 0.36, 'start': datetime.datetime(2024, 7, 6, 7, 0, tzinfo=datetime.timezone.utc), 'end': datetime.datetime(2024, 7, 6, 8, 0, tzinfo=datetime.timezone.utc)}, {'value': -0.04, 'start': datetime.datetime(2024, 7, 6, 8, 0, tzinfo=datetime.timezone.utc), 'end': datetime.datetime(2024, 7, 6, 9, 0, tzinfo=datetime.timezone.utc)}, {'value': -0.02, 'start': datetime.datetime(2024, 7, 6, 9, 0, tzinfo=datetime.timezone.utc), 'end': datetime.datetime(2024, 7, 6, 10, 0, tzinfo=datetime.timezone.utc)}, {'value': -0.03, 'start': datetime.datetime(2024, 7, 6, 10, 0, tzinfo=datetime.timezone.utc), 'end': datetime.datetime(2024, 7, 6, 11, 0, tzinfo=datetime.timezone.utc)}, {'value': -0.14, 'start': datetime.datetime(2024, 7, 6, 11, 0, tzinfo=datetime.timezone.utc), 'end': datetime.datetime(2024, 7, 6, 12, 0, tzinfo=datetime.timezone.utc)}, {'value': -2.48, 'start': datetime.datetime(2024, 7, 6, 12, 0, tzinfo=datetime.timezone.utc), 'end': datetime.datetime(2024, 7, 6, 13, 0, tzinfo=datetime.timezone.utc)}, {'value': -3.08, 'start': datetime.datetime(2024, 7, 6, 13, 0, tzinfo=datetime.timezone.utc), 'end': datetime.datetime(2024, 7, 6, 14, 0, tzinfo=datetime.timezone.utc)}, {'value': -0.68, 'start': datetime.datetime(2024, 7, 6, 14, 0, tzinfo=datetime.timezone.utc), 'end': datetime.datetime(2024, 7, 6, 15, 0, tzinfo=datetime.timezone.utc)}, {'value': 0.01, 'start': datetime.datetime(2024, 7, 6, 15, 0, tzinfo=datetime.timezone.utc), 'end': datetime.datetime(2024, 7, 6, 16, 0, tzinfo=datetime.timezone.utc)}, {'value': 2.21, 'start': datetime.datetime(2024, 7, 6, 16, 0, tzinfo=datetime.timezone.utc), 'end': datetime.datetime(2024, 7, 6, 17, 0, tzinfo=datetime.timezone.utc)}, {'value': 0.5, 'start': datetime.datetime(2024, 7, 6, 17, 0, tzinfo=datetime.timezone.utc), 'end': datetime.datetime(2024, 7, 6, 18, 0, tzinfo=datetime.timezone.utc)}, {'value': 7.61, 'start': datetime.datetime(2024, 7, 6, 18, 0, tzinfo=datetime.timezone.utc), 'end': datetime.datetime(2024, 7, 6, 19, 0, tzinfo=datetime.timezone.utc)}, {'value': 10.69, 'start': datetime.datetime(2024, 7, 6, 19, 0, tzinfo=datetime.timezone.utc), 'end': datetime.datetime(2024, 7, 6, 20, 0, tzinfo=datetime.timezone.utc)}, {'value': 19.97, 'start': datetime.datetime(2024, 7, 6, 20, 0, tzinfo=datetime.timezone.utc), 'end': datetime.datetime(2024, 7, 6, 21, 0, tzinfo=datetime.timezone.utc)}, {'value': 7.7, 'start': datetime.datetime(2024, 7, 6, 21, 0, tzinfo=datetime.timezone.utc), 'end': datetime.datetime(2024, 7, 6, 22, 0, tzinfo=datetime.timezone.utc)}]
2024-07-07 00:00:00.082 DEBUG (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] lowest_hours = []
2024-07-07 00:00:00.082 DEBUG (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] charging_hours_min_soc = 0
2024-07-07 00:00:00.082 DEBUG (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] ready_hour = 2024-07-07 13:00:00+00:00
2024-07-07 00:00:00.082 DEBUG (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] lowest_hours_min_soc = []
2024-07-07 00:00:00.083 DEBUG (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] Raw(schedule).number_of_nonzero() = 0
2024-07-07 00:00:00.083 DEBUG (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] Raw(schedule_min_soc).number_of_nonzero() = 0
2024-07-07 00:00:00.083 DEBUG (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] Use schedule
2024-07-07 00:00:00.086 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] self._max_price = 50.0
2024-07-07 00:00:00.086 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] Current price = None
2024-07-07 00:00:00.086 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] EVSmartChargingCoordinator.update_state()
2024-07-07 00:00:00.086 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] charging_value = None
2024-07-07 00:00:00.086 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] turn_on_charging = False
2024-07-07 00:00:00.086 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] current_value = False
2024-07-07 00:00:00.086 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] Charging summary removed
2024-07-07 00:00:00.117 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] EVSmartChargingCoordinator.update_sensors()
2024-07-07 00:00:00.117 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] entity_id = sensor.nordpool_template_price_sensor
2024-07-07 00:00:00.117 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] new_state = <state sensor.nordpool_template_price_sensor=7.7; prices_today=[{'time': '2024-07-07 00:00:00+0200', 'price': -0.02}, {'time': '2024-07-07 01:00:00+0200', 'price': -0.11}, {'time': '2024-07-07 02:00:00+0200', 'price': -0.91}, {'time': '2024-07-07 03:00:00+0200', 'price': -0.55}, {'time': '2024-07-07 04:00:00+0200', 'price': -1.0}, {'time': '2024-07-07 05:00:00+0200', 'price': -2.0}, {'time': '2024-07-07 06:00:00+0200', 'price': -0.92}, {'time': '2024-07-07 07:00:00+0200', 'price': -0.67}, {'time': '2024-07-07 08:00:00+0200', 'price': -0.69}, {'time': '2024-07-07 09:00:00+0200', 'price': -7.35}, {'time': '2024-07-07 10:00:00+0200', 'price': -11.35}, {'time': '2024-07-07 11:00:00+0200', 'price': -13.69}, {'time': '2024-07-07 12:00:00+0200', 'price': -15.34}, {'time': '2024-07-07 13:00:00+0200', 'price': -17.08}, {'time': '2024-07-07 14:00:00+0200', 'price': -22.62}, {'time': '2024-07-07 15:00:00+0200', 'price': -13.87}, {'time': '2024-07-07 16:00:00+0200', 'price': -7.0}, {'time': '2024-07-07 17:00:00+0200', 'price': -2.83}, {'time': '2024-07-07 18:00:00+0200', 'price': -1.32}, {'time': '2024-07-07 19:00:00+0200', 'price': -0.91}, {'time': '2024-07-07 20:00:00+0200', 'price': -0.12}, {'time': '2024-07-07 21:00:00+0200', 'price': -0.17}, {'time': '2024-07-07 22:00:00+0200', 'price': -0.11}, {'time': '2024-07-07 23:00:00+0200', 'price': -0.11}], prices_tomorrow=[], unit_of_measurement=öre/kWh, friendly_name=Nordpool template price sensor @ 2024-07-06T23:00:00.118806+02:00>
2024-07-07 00:00:00.119 DEBUG (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] charging_hours = 1
2024-07-07 00:00:00.119 DEBUG (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] ready_hour = 2024-07-07 13:00:00+00:00
2024-07-07 00:00:00.119 DEBUG (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] lowest_hours = [14]
2024-07-07 00:00:00.120 DEBUG (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] charging_hours_min_soc = 0
2024-07-07 00:00:00.120 DEBUG (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] ready_hour = 2024-07-07 13:00:00+00:00
2024-07-07 00:00:00.120 DEBUG (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] lowest_hours_min_soc = []
2024-07-07 00:00:00.122 DEBUG (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] Raw(schedule).number_of_nonzero() = 0
2024-07-07 00:00:00.122 DEBUG (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] Raw(schedule_min_soc).number_of_nonzero() = 0
2024-07-07 00:00:00.122 DEBUG (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] Use schedule

There is something wrong/unexpected with the template sensor state at "2024-07-07 00:00:00.079".

And then the template sensor state is updated again at "2024-07-07 00:00:00.117", and now it is correct!

hmmbob commented 2 months ago

My logs for two nights:

2024-07-06 00:00:00.154 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] EVSmartChargingCoordinator.update_hourly()
2024-07-06 00:00:00.154 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] EVSmartChargingCoordinator.update_sensors()
2024-07-06 00:00:00.155 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] entity_id = None
2024-07-06 00:00:00.155 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] new_state = None
2024-07-06 00:00:00.163 DEBUG (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] charging_hours = 1
2024-07-06 00:00:00.163 DEBUG (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] ready_hour = 2024-07-06 08:00:00+00:00
2024-07-06 00:00:00.163 DEBUG (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] lowest_hours = [33]
2024-07-06 00:00:00.174 DEBUG (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] Raw(schedule).number_of_nonzero() = 1
2024-07-06 00:00:00.174 DEBUG (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] Raw(schedule_min_soc).number_of_nonzero() = 0
2024-07-06 00:00:00.175 DEBUG (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] Use schedule
2024-07-06 00:00:00.176 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] self._max_price = 0.32
2024-07-06 00:00:00.176 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] Current price = None
2024-07-06 00:00:00.177 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] EVSmartChargingCoordinator.update_state()
2024-07-06 00:00:00.177 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] charging_value = 0.0
2024-07-06 00:00:00.177 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] turn_on_charging = False
2024-07-06 00:00:00.177 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] current_value = False
2024-07-06 00:00:00.177 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] Charging summary shown
2024-07-06 00:01:40.905 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] EVSmartChargingCoordinator.update_sensors()
2024-07-06 00:01:40.905 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] entity_id = sensor.zonneplan_template_price_sensor
2024-07-06 00:01:40.905 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] new_state = <state sensor.zonneplan_template_price_sensor=0.2551271; prices_today=[{'time': '2024-07-06T00:00:00+02:00', 'price': 0.2551271}, {'time': '2024-07-06T01:00:00+02:00', 'price': 0.2315805}, {'time': '2024-07-06T02:00:00+02:00', 'price': 0.2229653}, {'time': '2024-07-06T03:00:00+02:00', 'price': 0.2041014}, {'time': '2024-07-06T04:00:00+02:00', 'price': 0.1949901}, {'time': '2024-07-06T05:00:00+02:00', 'price': 0.1698342}, {'time': '2024-07-06T06:00:00+02:00', 'price': 0.1588231}, {'time': '2024-07-06T07:00:00+02:00', 'price': 0.1581456}, {'time': '2024-07-06T08:00:00+02:00', 'price': 0.1557619}, {'time': '2024-07-06T09:00:00+02:00', 'price': 0.1516479}, {'time': '2024-07-06T10:00:00+02:00', 'price': 0.1395479}, {'time': '2024-07-06T11:00:00+02:00', 'price': 0.1165216}, {'time': '2024-07-06T12:00:00+02:00', 'price': 0.1101207}, {'time': '2024-07-06T13:00:00+02:00', 'price': 0.0878325}, {'time': '2024-07-06T14:00:00+02:00', 'price': 0.067202}, {'time': '2024-07-06T15:00:00+02:00', 'price': 0.0105498}, {'time': '2024-07-06T16:00:00+02:00', 'price': 0.0397955}, {'time': '2024-07-06T17:00:00+02:00', 'price': 0.0914988}, {'time': '2024-07-06T18:00:00+02:00', 'price': 0.1395479}, {'time': '2024-07-06T19:00:00+02:00', 'price': 0.1486229}, {'time': '2024-07-06T20:00:00+02:00', 'price': 0.159646}, {'time': '2024-07-06T21:00:00+02:00', 'price': 0.1632518}, {'time': '2024-07-06T22:00:00+02:00', 'price': 0.1739966}, {'time': '2024-07-06T23:00:00+02:00', 'price': 0.1697011}], prices_tomorrow=[], unit_of_measurement=€/kWh, friendly_name=Zonneplan template price sensor @ 2024-07-06T00:01:40.905518+02:00>
2024-07-06 00:01:40.911 DEBUG (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] charging_hours = 1
2024-07-06 00:01:40.911 DEBUG (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] ready_hour = 2024-07-06 08:00:00+00:00
2024-07-06 00:01:40.911 DEBUG (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] lowest_hours = [9]
2024-07-06 00:01:40.920 DEBUG (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] Raw(schedule).number_of_nonzero() = 1
2024-07-06 00:01:40.921 DEBUG (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] Raw(schedule_min_soc).number_of_nonzero() = 0
2024-07-06 00:01:40.921 DEBUG (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] Use schedule
2024-07-06 00:01:40.922 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] self._max_price = 0.32
2024-07-06 00:01:40.922 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] Current price = 0.2551271
2024-07-06 00:01:40.922 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] EVSmartChargingCoordinator.update_state()
2024-07-06 00:01:40.922 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] charging_value = 0.0
2024-07-06 00:01:40.922 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] turn_on_charging = False
2024-07-06 00:01:40.922 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] current_value = False
2024-07-06 00:01:40.922 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] Charging summary shown

2024-07-07 00:00:00.154 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] EVSmartChargingCoordinator.update_hourly()
2024-07-07 00:00:00.154 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] EVSmartChargingCoordinator.update_sensors()
2024-07-07 00:00:00.154 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] entity_id = None
2024-07-07 00:00:00.154 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] new_state = None
2024-07-07 00:00:00.159 DEBUG (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] charging_hours = 0
2024-07-07 00:00:00.163 DEBUG (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] ready_hour = 2024-07-09 22:00:00+00:00
2024-07-07 00:00:00.163 DEBUG (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] lowest_hours = []
2024-07-07 00:00:00.167 DEBUG (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] Raw(schedule).number_of_nonzero() = 0
2024-07-07 00:00:00.167 DEBUG (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] Raw(schedule_min_soc).number_of_nonzero() = 0
2024-07-07 00:00:00.167 DEBUG (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] Use schedule
2024-07-07 00:00:00.170 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] self._max_price = 0.32
2024-07-07 00:00:00.170 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] Current price = None
2024-07-07 00:00:00.170 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] EVSmartChargingCoordinator.update_state()
2024-07-07 00:00:00.170 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] charging_value = 0.0
2024-07-07 00:00:00.170 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] turn_on_charging = False
2024-07-07 00:00:00.170 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] current_value = False
2024-07-07 00:00:00.170 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] Charging summary removed
2024-07-07 00:01:48.888 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] EVSmartChargingCoordinator.update_sensors()
2024-07-07 00:01:48.891 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] entity_id = sensor.zonneplan_template_price_sensor
2024-07-07 00:01:48.891 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] new_state = <state sensor.zonneplan_template_price_sensor=0.1522045; prices_today=[{'time': '2024-07-07T00:00:00+02:00', 'price': 0.1522045}, {'time': '2024-07-07T01:00:00+02:00', 'price': 0.1520714}, {'time': '2024-07-07T02:00:00+02:00', 'price': 0.1512607}, {'time': '2024-07-07T03:00:00+02:00', 'price': 0.1516479}, {'time': '2024-07-07T04:00:00+02:00', 'price': 0.1520593}, {'time': '2024-07-07T05:00:00+02:00', 'price': 0.1519504}, {'time': '2024-07-07T06:00:00+02:00', 'price': 0.1516963}, {'time': '2024-07-07T07:00:00+02:00', 'price': 0.1516479}, {'time': '2024-07-07T08:00:00+02:00', 'price': 0.150922}, {'time': '2024-07-07T09:00:00+02:00', 'price': 0.1436498}, {'time': '2024-07-07T10:00:00+02:00', 'price': 0.1394269}, {'time': '2024-07-07T11:00:00+02:00', 'price': 0.1360148}, {'time': '2024-07-07T12:00:00+02:00', 'price': 0.1351314}, {'time': '2024-07-07T13:00:00+02:00', 'price': 0.1242777}, {'time': '2024-07-07T14:00:00+02:00', 'price': 0.1262379}, {'time': '2024-07-07T15:00:00+02:00', 'price': 0.1368738}, {'time': '2024-07-07T16:00:00+02:00', 'price': 0.1440491}, {'time': '2024-07-07T17:00:00+02:00', 'price': 0.149724}, {'time': '2024-07-07T18:00:00+02:00', 'price': 0.2225055}, {'time': '2024-07-07T19:00:00+02:00', 'price': 0.256083}, {'time': '2024-07-07T20:00:00+02:00', 'price': 0.2956984}, {'time': '2024-07-07T21:00:00+02:00', 'price': 0.3053784}, {'time': '2024-07-07T22:00:00+02:00', 'price': 0.2901203}, {'time': '2024-07-07T23:00:00+02:00', 'price': 0.2688485}], prices_tomorrow=[], unit_of_measurement=€/kWh, friendly_name=Zonneplan template price sensor @ 2024-07-07T00:01:48.888771+02:00>
2024-07-07 00:01:48.894 DEBUG (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] charging_hours = 0
2024-07-07 00:01:48.894 DEBUG (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] ready_hour = 2024-07-09 22:00:00+00:00
2024-07-07 00:01:48.895 DEBUG (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] lowest_hours = []
2024-07-07 00:01:48.898 DEBUG (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] Raw(schedule).number_of_nonzero() = 0
2024-07-07 00:01:48.898 DEBUG (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] Raw(schedule_min_soc).number_of_nonzero() = 0
2024-07-07 00:01:48.899 DEBUG (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] Use schedule
2024-07-07 00:01:48.900 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] self._max_price = 0.32
2024-07-07 00:01:48.901 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] Current price = 0.1522045
2024-07-07 00:01:48.901 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] EVSmartChargingCoordinator.update_state()
2024-07-07 00:01:48.901 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] charging_value = 0.0
2024-07-07 00:01:48.901 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] turn_on_charging = False
2024-07-07 00:01:48.901 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] current_value = False
2024-07-07 00:01:48.901 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] Charging summary removed
jonasbkarlsson commented 2 months ago

So the error didn't happen the last two nights for you. It seems a little odd that your price is updated 00:01:40 and 00:01:48, but it's not a problem for my integration. So no need to do anything about that.

Anyhow, with your logs from three nights ago, and with my own logs, I now know what to do in order to fix this. There will be an update coming soon.

jonasbkarlsson commented 2 months ago

Should be fixed in v1.11.0-dev4. Please check.

hmmbob commented 2 months ago

Installed, will report back tomorrow

hmmbob commented 2 months ago

here you are (-dev4):

2024-07-09 00:00:00.218 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] EVSmartChargingCoordinator.update_hourly()
2024-07-09 00:00:00.218 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] EVSmartChargingCoordinator.update_sensors()
2024-07-09 00:00:00.218 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] entity_id = None
2024-07-09 00:00:00.218 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] new_state = None
2024-07-09 00:00:00.218 DEBUG (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] Less than 12 valid prices for today found in [{'value': 0.2504686, 'start': datetime.datetime(2024, 7, 8, 0, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=7200))), 'end': datetime.datetime(2024, 7, 8, 1, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=7200)))}, {'value': 0.2443944, 'start': datetime.datetime(2024, 7, 8, 1, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=7200))), 'end': datetime.datetime(2024, 7, 8, 2, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=7200)))}, {'value': 0.2403409, 'start': datetime.datetime(2024, 7, 8, 2, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=7200))), 'end': datetime.datetime(2024, 7, 8, 3, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=7200)))}, {'value': 0.2443218, 'start': datetime.datetime(2024, 7, 8, 3, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=7200))), 'end': datetime.datetime(2024, 7, 8, 4, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=7200)))}, {'value': 0.2429908, 'start': datetime.datetime(2024, 7, 8, 4, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=7200))), 'end': datetime.datetime(2024, 7, 8, 5, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=7200)))}, {'value': 0.2477703, 'start': datetime.datetime(2024, 7, 8, 5, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=7200))), 'end': datetime.datetime(2024, 7, 8, 6, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=7200)))}, {'value': 0.2847479, 'start': datetime.datetime(2024, 7, 8, 6, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=7200))), 'end': datetime.datetime(2024, 7, 8, 7, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=7200)))}, {'value': 0.3009135, 'start': datetime.datetime(2024, 7, 8, 7, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=7200))), 'end': datetime.datetime(2024, 7, 8, 8, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=7200)))}, {'value': 0.2741483, 'start': datetime.datetime(2024, 7, 8, 8, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=7200))), 'end': datetime.datetime(2024, 7, 8, 9, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=7200)))}, {'value': 0.2458585, 'start': datetime.datetime(2024, 7, 8, 9, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=7200))), 'end': datetime.datetime(2024, 7, 8, 10, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=7200)))}, {'value': 0.2172299, 'start': datetime.datetime(2024, 7, 8, 10, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=7200))), 'end': datetime.datetime(2024, 7, 8, 11, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=7200)))}, {'value': 0.1988136, 'start': datetime.datetime(2024, 7, 8, 11, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=7200))), 'end': datetime.datetime(2024, 7, 8, 12, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=7200)))}, {'value': 0.1905373, 'start': datetime.datetime(2024, 7, 8, 12, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=7200))), 'end': datetime.datetime(2024, 7, 8, 13, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=7200)))}, {'value': 0.1877906, 'start': datetime.datetime(2024, 7, 8, 13, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=7200))), 'end': datetime.datetime(2024, 7, 8, 14, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=7200)))}, {'value': 0.1878269, 'start': datetime.datetime(2024, 7, 8, 14, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=7200))), 'end': datetime.datetime(2024, 7, 8, 15, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=7200)))}, {'value': 0.1967446, 'start': datetime.datetime(2024, 7, 8, 15, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=7200))), 'end': datetime.datetime(2024, 7, 8, 16, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=7200)))}, {'value': 0.2283861, 'start': datetime.datetime(2024, 7, 8, 16, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=7200))), 'end': datetime.datetime(2024, 7, 8, 17, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=7200)))}, {'value': 0.2501056, 'start': datetime.datetime(2024, 7, 8, 17, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=7200))), 'end': datetime.datetime(2024, 7, 8, 18, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=7200)))}, {'value': 0.2744871, 'start': datetime.datetime(2024, 7, 8, 18, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=7200))), 'end': datetime.datetime(2024, 7, 8, 19, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=7200)))}, {'value': 0.3149979, 'start': datetime.datetime(2024, 7, 8, 19, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=7200))), 'end': datetime.datetime(2024, 7, 8, 20, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=7200)))}, {'value': 0.45295, 'start': datetime.datetime(2024, 7, 8, 20, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=7200))), 'end': datetime.datetime(2024, 7, 8, 21, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=7200)))}, {'value': 0.3564162, 'start': datetime.datetime(2024, 7, 8, 21, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=7200))), 'end': datetime.datetime(2024, 7, 8, 22, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=7200)))}, {'value': 0.2892612, 'start': datetime.datetime(2024, 7, 8, 22, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=7200))), 'end': datetime.datetime(2024, 7, 8, 23, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=7200)))}, {'value': 0.2628226, 'start': datetime.datetime(2024, 7, 8, 23, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=7200))), 'end': datetime.datetime(2024, 7, 9, 0, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=7200)))}]
2024-07-09 00:00:00.219 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] Price sensor not valid directly after midnight. Can usually be ignored.
2024-07-09 00:00:00.219 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] Price state: <state sensor.zonneplan_template_price_sensor=0.2628226; prices_today=[{'time': '2024-07-08T00:00:00+02:00', 'price': 0.2504686}, {'time': '2024-07-08T01:00:00+02:00', 'price': 0.2443944}, {'time': '2024-07-08T02:00:00+02:00', 'price': 0.2403409}, {'time': '2024-07-08T03:00:00+02:00', 'price': 0.2443218}, {'time': '2024-07-08T04:00:00+02:00', 'price': 0.2429908}, {'time': '2024-07-08T05:00:00+02:00', 'price': 0.2477703}, {'time': '2024-07-08T06:00:00+02:00', 'price': 0.2847479}, {'time': '2024-07-08T07:00:00+02:00', 'price': 0.3009135}, {'time': '2024-07-08T08:00:00+02:00', 'price': 0.2741483}, {'time': '2024-07-08T09:00:00+02:00', 'price': 0.2458585}, {'time': '2024-07-08T10:00:00+02:00', 'price': 0.2172299}, {'time': '2024-07-08T11:00:00+02:00', 'price': 0.1988136}, {'time': '2024-07-08T12:00:00+02:00', 'price': 0.1905373}, {'time': '2024-07-08T13:00:00+02:00', 'price': 0.1877906}, {'time': '2024-07-08T14:00:00+02:00', 'price': 0.1878269}, {'time': '2024-07-08T15:00:00+02:00', 'price': 0.1967446}, {'time': '2024-07-08T16:00:00+02:00', 'price': 0.2283861}, {'time': '2024-07-08T17:00:00+02:00', 'price': 0.2501056}, {'time': '2024-07-08T18:00:00+02:00', 'price': 0.2744871}, {'time': '2024-07-08T19:00:00+02:00', 'price': 0.3149979}, {'time': '2024-07-08T20:00:00+02:00', 'price': 0.45295}, {'time': '2024-07-08T21:00:00+02:00', 'price': 0.3564162}, {'time': '2024-07-08T22:00:00+02:00', 'price': 0.2892612}, {'time': '2024-07-08T23:00:00+02:00', 'price': 0.2628226}], prices_tomorrow=[{'time': '2024-07-09T00:00:00+02:00', 'price': 0.2746928}, {'time': '2024-07-09T01:00:00+02:00', 'price': 0.2618426}, {'time': '2024-07-09T02:00:00+02:00', 'price': 0.2568937}, {'time': '2024-07-09T03:00:00+02:00', 'price': 0.2527071}, {'time': '2024-07-09T04:00:00+02:00', 'price': 0.2486536}, {'time': '2024-07-09T05:00:00+02:00', 'price': 0.2592048}, {'time': '2024-07-09T06:00:00+02:00', 'price': 0.2749711}, {'time': '2024-07-09T07:00:00+02:00', 'price': 0.2727931}, {'time': '2024-07-09T08:00:00+02:00', 'price': 0.2626049}, {'time': '2024-07-09T09:00:00+02:00', 'price': 0.2327421}, {'time': '2024-07-09T10:00:00+02:00', 'price': 0.2080702}, {'time': '2024-07-09T11:00:00+02:00', 'price': 0.192437}, {'time': '2024-07-09T12:00:00+02:00', 'price': 0.1782074}, {'time': '2024-07-09T13:00:00+02:00', 'price': 0.1595976}, {'time': '2024-07-09T14:00:00+02:00', 'price': 0.1568993}, {'time': '2024-07-09T15:00:00+02:00', 'price': 0.1651636}, {'time': '2024-07-09T16:00:00+02:00', 'price': 0.2113251}, {'time': '2024-07-09T17:00:00+02:00', 'price': 0.2478066}, {'time': '2024-07-09T18:00:00+02:00', 'price': 0.2744508}, {'time': '2024-07-09T19:00:00+02:00', 'price': 0.3254039}, {'time': '2024-07-09T20:00:00+02:00', 'price': 0.3248352}, {'time': '2024-07-09T21:00:00+02:00', 'price': 0.2831507}, {'time': '2024-07-09T22:00:00+02:00', 'price': 0.2573898}, {'time': '2024-07-09T23:00:00+02:00', 'price': 0.2726479}], unit_of_measurement=€/kWh, friendly_name=Zonneplan template price sensor @ 2024-07-08T23:01:29.773523+02:00>
2024-07-09 00:00:00.219 DEBUG (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] charging_hours = 1
2024-07-09 00:00:00.220 DEBUG (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] ready_hour = 2024-07-11 22:00:00+00:00
2024-07-09 00:00:00.220 DEBUG (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] lowest_hours = [38]
2024-07-09 00:00:00.227 DEBUG (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] Raw(schedule).number_of_nonzero() = 1
2024-07-09 00:00:00.227 DEBUG (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] Raw(schedule_min_soc).number_of_nonzero() = 0
2024-07-09 00:00:00.228 DEBUG (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] Use schedule
2024-07-09 00:00:00.229 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] self._max_price = 0.32
2024-07-09 00:00:00.230 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] Current price = 0.2628226
2024-07-09 00:00:00.230 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] EVSmartChargingCoordinator.update_state()
2024-07-09 00:00:00.230 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] charging_value = 0.0
2024-07-09 00:00:00.230 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] turn_on_charging = False
2024-07-09 00:00:00.230 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] current_value = False
2024-07-09 00:00:00.231 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] Charging summary shown
2024-07-09 00:01:29.777 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] EVSmartChargingCoordinator.update_sensors()
2024-07-09 00:01:29.777 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] entity_id = sensor.zonneplan_template_price_sensor
2024-07-09 00:01:29.777 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] new_state = <state sensor.zonneplan_template_price_sensor=0.2746928; prices_today=[{'time': '2024-07-09T00:00:00+02:00', 'price': 0.2746928}, {'time': '2024-07-09T01:00:00+02:00', 'price': 0.2618426}, {'time': '2024-07-09T02:00:00+02:00', 'price': 0.2568937}, {'time': '2024-07-09T03:00:00+02:00', 'price': 0.2527071}, {'time': '2024-07-09T04:00:00+02:00', 'price': 0.2486536}, {'time': '2024-07-09T05:00:00+02:00', 'price': 0.2592048}, {'time': '2024-07-09T06:00:00+02:00', 'price': 0.2749711}, {'time': '2024-07-09T07:00:00+02:00', 'price': 0.2727931}, {'time': '2024-07-09T08:00:00+02:00', 'price': 0.2626049}, {'time': '2024-07-09T09:00:00+02:00', 'price': 0.2327421}, {'time': '2024-07-09T10:00:00+02:00', 'price': 0.2080702}, {'time': '2024-07-09T11:00:00+02:00', 'price': 0.192437}, {'time': '2024-07-09T12:00:00+02:00', 'price': 0.1782074}, {'time': '2024-07-09T13:00:00+02:00', 'price': 0.1595976}, {'time': '2024-07-09T14:00:00+02:00', 'price': 0.1568993}, {'time': '2024-07-09T15:00:00+02:00', 'price': 0.1651636}, {'time': '2024-07-09T16:00:00+02:00', 'price': 0.2113251}, {'time': '2024-07-09T17:00:00+02:00', 'price': 0.2478066}, {'time': '2024-07-09T18:00:00+02:00', 'price': 0.2744508}, {'time': '2024-07-09T19:00:00+02:00', 'price': 0.3254039}, {'time': '2024-07-09T20:00:00+02:00', 'price': 0.3248352}, {'time': '2024-07-09T21:00:00+02:00', 'price': 0.2831507}, {'time': '2024-07-09T22:00:00+02:00', 'price': 0.2573898}, {'time': '2024-07-09T23:00:00+02:00', 'price': 0.2726479}], prices_tomorrow=[], unit_of_measurement=€/kWh, friendly_name=Zonneplan template price sensor @ 2024-07-09T00:01:29.777199+02:00>
2024-07-09 00:01:29.784 DEBUG (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] charging_hours = 1
2024-07-09 00:01:29.784 DEBUG (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] ready_hour = 2024-07-11 22:00:00+00:00
2024-07-09 00:01:29.784 DEBUG (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] lowest_hours = [14]
2024-07-09 00:01:29.788 DEBUG (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] Raw(schedule).number_of_nonzero() = 1
2024-07-09 00:01:29.789 DEBUG (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] Raw(schedule_min_soc).number_of_nonzero() = 0
2024-07-09 00:01:29.789 DEBUG (MainThread) [custom_components.ev_smart_charging.helpers.coordinator] Use schedule
2024-07-09 00:01:29.790 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] self._max_price = 0.32
2024-07-09 00:01:29.790 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] Current price = 0.2746928
2024-07-09 00:01:29.790 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] EVSmartChargingCoordinator.update_state()
2024-07-09 00:01:29.790 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] charging_value = 0.0
2024-07-09 00:01:29.790 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] turn_on_charging = False
2024-07-09 00:01:29.790 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] current_value = False
2024-07-09 00:01:29.790 DEBUG (MainThread) [custom_components.ev_smart_charging.coordinator] Charging summary shown
jonasbkarlsson commented 2 months ago

That looks good! Thanks for providing the logs! There will be an offical release towards the end of the week.

jonasbkarlsson commented 2 months ago

Fixed in v1.11.0.