InventoCasa/ha-advanced-blueprints

script turning appliance off and trying to set the current to 0 results in error logs.

Vagabond80 opened this issue · 1 comments

I am using your excellent script together with my go-e charger to charge my EV. the go-e supports setting the current. What I can see in my logs is that everytime my PV does not produce enough power and the current would need to go below the minimum current of 6A the appliance will be switched off as expected but in addition the python script seems to try to set the current to 0 which results in the following errors in my log. I suppose it is cosmetic, but it is probably worth fixing.

2023-04-11 11:38:00.030 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] PV Excess (PV Power - Load Power) History: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1983.0, -1061.0000000000002, 799.9999999999997, 797.9999999999997, -1504.0000000000002, 1490.9999999999998, -956.9999999999999, 1551.0, -1158.0, -893.9999999999999, -69] 2023-04-11 11:38:00.030 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] Export History: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 22.99999999999992, 0, 460.0, 322.0000000000001, 322.0000000000001, 1947.0, 322.0000000000001, 0, 0] 2023-04-11 11:38:00.033 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] [switch.charge (Prio 1)] Home battery charge is sufficient (16.0/0.0 %). Calculated average excess power based on >> solar power - load power <<: -305 W 2023-04-11 11:38:00.035 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] [switch.charge (Prio 1)] Appliance is already switched on. 2023-04-11 11:38:00.037 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] [switch.charge (Prio 1)] Average Excess Power (-305 W) is less than minimum excess power (10 W). 2023-04-11 11:38:00.040 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] [switch.charge (Prio 1)] actual_current=6.2A | diff_current=-1.3A | target_current=6.0A 2023-04-11 11:38:00.043 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] [switch.charge (Prio 1)] Current power consumption: 1416.335 W 2023-04-11 11:38:00.045 INFO (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] [switch.charge (Prio 1)] Switched off appliance. **2023-04-11 11:38:00.050 ERROR (MainThread) [homeassistant.core] Error executing service: <ServiceCall number.set_value (c:01GXQTVS6CX9BHXEQ9W05RSDZJ): entity_id=['number.go_echarger_200030_amp'], value=0.0>** Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/core.py", line 1838, in catch_exceptions await coro_or_task File "/usr/src/homeassistant/homeassistant/core.py", line 1857, in _execute_service await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)( File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 216, in handle_service await service.entity_service_call( File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 798, in entity_service_call future.result() # pop exception if have File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 977, in async_request_call await coro File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 838, in _handle_entity_call await result File "/usr/src/homeassistant/homeassistant/components/number/__init__.py", line 96, in async_set_value raise ValueError( **ValueError: Value 0.0 for number.go_echarger_200030_amp is outside valid range 6 - 32** 2023-04-11 11:38:01.048 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] Adjusting power history by 1416.335. 2023-04-11 11:38:01.049 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] Export history: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 22.99999999999992, 0, 460.0, 322.0000000000001, 322.0000000000001, 1947.0, 322.0000000000001, 0, 0] 2023-04-11 11:38:01.052 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] Adjusted export history: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 22.99999999999992, 0, 460.0, 322.0000000000001, 1738.335, 3363.335, 1738.335, 1416.335, 1416.335] 2023-04-11 11:38:01.052 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] PV Excess (solar power - load power) history: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1983.0, -1061.0000000000002, 799.9999999999997, 797.9999999999997, -1504.0000000000002, 1490.9999999999998, -956.9999999999999, 1551.0, -1158.0, -893.9999999999999, -69] 2023-04-11 11:38:01.055 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] Adjusted PV Excess (solar power - load power) history: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1983.0, -1061.0000000000002, 799.9999999999997, 797.9999999999997, -1504.0000000000002, 1490.9999999999998, 459.33500000000015, 2967.335, 258.33500000000004, 522.3350000000002, 1347.335] 2023-04-11 11:38:01.057 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] [switch.charge (Prio 1)] Added power_consumption=1416.335 W to prev_consumption_sum, which is now 1416.335 W.

Hi there, thanks for reporting this! And also thanks for the coffee :)

I thought it would be a good idea to also set the current to 0 when switching an appliance off (my wallbox e.g. does this), however I did not think about consequences for appliances which do not allow setting something below the specified min. current.

I will implement another behaviour within the next few days, so that the current will not be set to zero when the appliance gets switched off.