batpred icon indicating copy to clipboard operation
batpred copied to clipboard

Please add support for Huawei inverters.

Open JohanAlvedal opened this issue 1 year ago • 83 comments

Please add support for Huawei inverters.

I use https://github.com/wlcrs/huawei_solar. This integration exposes the information and functions made available by Huawei Solar inverters directly via one of its Modbus interfaces in Home Assistant.

And not to forget Nordpool https://github.com/custom-components/nordpool/

example of sensors in HA

PV power W = sensor.inverter_input_power Battery SOC = sensor.battery_state_of_capacity Battery charge/discharge in W = sensor.battery_charge_discharge_power Export sensor KWh = sensor.power_meter_exported (total) Import (Grid) kWh = sensor.power_meter_consumption (total)

number.battery_maximum_charging_power number.battery_maximum_discharging_power select.battery_working_mode number.battery_end_of_discharge_soc number.battery_end_of_charge_soc

JohanAlvedal avatar Feb 01 '24 18:02 JohanAlvedal

Can you attempt to take a sample configuration from 'templates' and try it with your sensors? I suspect you will need my help to control charging and discharging, its not obvious to me how these are triggered

springfall2008 avatar Feb 05 '24 18:02 springfall2008

Taken from the github link above: The integration offers multiple services that you can call to dynamically change the behavior of the battery:

forcible_charge: Forcible Charge forcible_charge_soc: Forcible Charge to a SoC level forcible_discharge: Forcible Discharge forcible_discharge_soc: Forcible Discharge to a SoC level stop_forcible_charge: Stop the forcible charge or discharge Forcible Charge

This allows you to forcibly charge your battery for a given duration or to a given SoC level of your battery. While a forcible charge is active, it will direct all power received from the solar panels to your battery instead of covering your home electricity usage.

If the "Charge from grid" toggle is set, it will also draw power from the grid until the given charge power level is reached.

Forcible Discharge

This allows you to forcibly discharge your battery for a given duration or to a given SoC level of your battery. This forces the inverter to inject more power to the AC-side than your home electricity usage, which will consequently be pushed onto the grid.

Stop Forcible charge or discharge

Calling this service will cancel any running forcible charge of forcible discharge command.

I have a reasonably functioning config. there will be no direct errors in the log as far as I can see. then of course it could be the wrong sensors I have, etc.

https://pastebin.pl/view/a70a067e

JohanAlvedal avatar Feb 05 '24 19:02 JohanAlvedal

I've made some changes on a branch:

  1. Updated template - https://github.com/springfall2008/batpred/blob/huawei/templates/huawei.yaml

This has a new inverter type select HU and the services for charge/discharge defined

  1. Update predbat.py - https://github.com/springfall2008/batpred/blob/huawei/apps/predbat/predbat.py

Added code for the new inverter type and using the services.

Please give this a try, however for it to work you need to fix your load sensor otherwise its not going to do anything useful

springfall2008 avatar Feb 05 '24 20:02 springfall2008

Thank you very much, I will double check and get back to you.

JohanAlvedal avatar Feb 05 '24 20:02 JohanAlvedal

`2024-02-05 21:50:03.612180 INFO pred_bat: Inverter 0 Stop charge via Service 2024-02-05 21:50:03.616484 INFO pred_bat: Inverter 0 Stop discharge via Service 2024-02-05 21:50:03.627270 WARNING HASS: Error calling Home Assistant service default/huawei_solar/stop_forcible_charge 2024-02-05 21:50:03.627592 WARNING HASS: Code: 500, error: 500 Internal Server Error

Server got itself in trouble 2024-02-05 21:50:03.637760 WARNING HASS: Error calling Home Assistant service default/huawei_solar/stop_forcible_charge 2024-02-05 21:50:03.638070 WARNING HASS: Code: 500, error: 500 Internal Server Error

Server got itself in trouble 2024-02-05 21:50:03.647732 INFO pred_bat: Will not recompute the plan, it is 5.0 minutes old and max age is 10 minutes 2024-02-05 21:50:03.648596 INFO pred_bat: IBoost model today updated to 0.364 2024-02-05 21:50:03.649539 INFO pred_bat: Completed run status Idle`

JohanAlvedal avatar Feb 05 '24 20:02 JohanAlvedal

I must have the service name wrong, you can change it in apps.yaml if you can figure out the correct name

springfall2008 avatar Feb 05 '24 20:02 springfall2008

Okay I think I might know the issue, the service needs a device_id to be set.

Can you:

  1. Update predbat.py from the latest on the branch (https://github.com/springfall2008/batpred/blob/main/apps/predbat/predbat.py)
  2. add 'device_id: xxxxx' to your apps.yaml where the xxxxx is the device_id that Home Assistant reports. The best way to find it is to go into developer tools, services and try to trigger the stop charge service, then once it works to go to YAML mode and copy the device_id from there. Also please snapshot what you see there in case my attempt still doesn't work.

springfall2008 avatar Feb 06 '24 08:02 springfall2008

Did you remove "HU" from the latest predbat.py ?

I added it and then the errors in the log disappeared, kinda.

2024-02-06 10:49:00.459610 WARNING pred_bat: pred_bat: Entity sensor.predbat_HU_scheduled_charge_enable not found in namespace default 2024-02-06 10:49:00.459997 INFO AppDaemon: pred_bat: Entity sensor.predbat_HU_scheduled_charge_enable created in namespace: default 2024-02-06 10:49:00.466792 WARNING pred_bat: pred_bat: Entity sensor.predbat_HU_scheduled_discharge_enable not found in namespace default 2024-02-06 10:49:00.467225 INFO AppDaemon: pred_bat: Entity sensor.predbat_HU_scheduled_discharge_enable created in namespace: default 2024-02-06 10:49:00.473172 WARNING pred_bat: pred_bat: Entity sensor.predbat_HU_reserve not found in namespace default 2024-02-06 10:49:00.473689 INFO AppDaemon: pred_bat: Entity sensor.predbat_HU_reserve created in namespace: default 2024-02-06 10:49:00.479548 WARNING pred_bat: pred_bat: Entity sensor.predbat_HU_charge_limit not found in namespace default 2024-02-06 10:49:00.480066 INFO AppDaemon: pred_bat: Entity sensor.predbat_HU_charge_limit created in namespace: default 2024-02-06 10:49:00.485759 WARNING pred_bat: pred_bat: Entity sensor.predbat_HU_charge_rate not found in namespace default 2024-02-06 10:49:00.486206 INFO AppDaemon: pred_bat: Entity sensor.predbat_HU_charge_rate created in namespace: default 2024-02-06 10:49:00.491926 WARNING pred_bat: pred_bat: Entity sensor.predbat_HU_discharge_rate not found in namespace default 2024-02-06 10:49:00.492366 INFO AppDaemon: pred_bat: Entity sensor.predbat_HU_discharge_rate created in namespace: default 2024-02-06 10:49:00.498661 WARNING pred_bat: pred_bat: Entity sensor.predbat_HU_inverter_mode not found in namespace default 2024-02-06 10:49:00.499134 INFO AppDaemon: pred_bat: Entity sensor.predbat_HU_inverter_mode created in namespace: default 2024-02-06 10:49:00.504829 WARNING pred_bat: pred_bat: Entity sensor.predbat_HU_charge_start_time not found in namespace default 2024-02-06 10:49:00.505279 INFO AppDaemon: pred_bat: Entity sensor.predbat_HU_charge_start_time created in namespace: default 2024-02-06 10:49:00.511097 WARNING pred_bat: pred_bat: Entity sensor.predbat_HU_charge_end_time not found in namespace default 2024-02-06 10:49:00.511613 INFO AppDaemon: pred_bat: Entity sensor.predbat_HU_charge_end_time created in namespace: default 2024-02-06 10:49:00.517356 WARNING pred_bat: pred_bat: Entity sensor.predbat_HU_discharge_start_time not found in namespace default 2024-02-06 10:49:00.517861 INFO AppDaemon: pred_bat: Entity sensor.predbat_HU_discharge_start_time created in namespace: default 2024-02-06 10:49:00.523877 WARNING pred_bat: pred_bat: Entity sensor.predbat_HU_discharge_end_time not found in namespace default 2024-02-06 10:49:00.524444 INFO AppDaemon: pred_bat: Entity sensor.predbat_HU_discharge_end_time created in namespace: default

JohanAlvedal avatar Feb 06 '24 09:02 JohanAlvedal

Sorry I gave you the wrong link you need to take predbat from the Huawei branch and not From main

springfall2008 avatar Feb 06 '24 10:02 springfall2008

however for it to work you need to fix your load sensor otherwise its not going to do anything useful

@JohanAlvedal if you don't have a native 'home load' sensor easily available in HA, there's the code for custom template to calculate home load from import, export, solar and battery data in the HA docs you could utilise https://springfall2008.github.io/batpred/apps-yaml#data-from-givtcp

gcoan avatar Feb 06 '24 13:02 gcoan

however for it to work you need to fix your load sensor otherwise its not going to do anything useful

@JohanAlvedal if you don't have a native 'home load' sensor easily available in HA, there's the code for custom template to calculate home load from import, export, solar and battery data in the HA docs you could utilise https://springfall2008.github.io/batpred/apps-yaml#data-from-givtcp

Made one now so I have to wait for some history.

JohanAlvedal avatar Feb 06 '24 14:02 JohanAlvedal

@JohanAlvedal did you try the correct code here? with device_id set https://github.com/springfall2008/batpred/blob/huawei/apps/predbat/predbat.py

springfall2008 avatar Feb 06 '24 19:02 springfall2008

@JohanAlvedal did you try the correct code here? with device_id set https://github.com/springfall2008/batpred/blob/huawei/apps/predbat/predbat.py

Result of newest prebat.py

https://pastebin.pl/view/9a7685c4

JohanAlvedal avatar Feb 06 '24 20:02 JohanAlvedal

You would need to move away from monitor mode and into control charge to see if it does anything

springfall2008 avatar Feb 06 '24 20:02 springfall2008

You would need to move away from monitor mode and into control charge to see if it does anything

https://pastebin.pl/view/025b0676

JohanAlvedal avatar Feb 06 '24 20:02 JohanAlvedal

Hmm, odd error - can you go to 'settings, system, logfiles' and select appdeamon (or adddeamon-predbat) and then check for the full error at the end of this log and paste it here please?

springfall2008 avatar Feb 06 '24 20:02 springfall2008

         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/usr/lib/python3.11/concurrent/futures/_base.py", line 456, in result return self.__get_result() ^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result raise self._exception File "/usr/lib/python3.11/site-packages/appdaemon/adapi.py", line 1752, in call_service self._check_service(service) File "/usr/lib/python3.11/site-packages/appdaemon/adapi.py", line 1579, in _check_service if service.find("/") == -1: ^^^^^^^^^^^^ AttributeError: 'dict' object has no attribute 'find'

2024-02-06 21:35:03.822087 WARNING pred_bat: ------------------------------------------------------------ 2024-02-06 21:40:03.724586 WARNING pred_bat: ------------------------------------------------------------ 2024-02-06 21:40:03.724732 WARNING pred_bat: Unexpected error in worker for App pred_bat: 2024-02-06 21:40:03.724837 WARNING pred_bat: Worker Ags: {'id': '2f9cb91f26b34c9f8125f68e37b1abdf', 'name': 'pred_bat', 'objectid': '52bbd711c5934b25b04ddaff81ad2496', 'type': 'scheduler', 'function': <bound method PredBat.run_time_loop of <predbat.PredBat object at 0x7f3af340f910>>, 'pin_app': True, 'pin_thread': 0, 'kwargs': {'interval': 300, 'random_start': 0, 'random_end': 0, '__thread_id': 'thread-0'}} 2024-02-06 21:40:03.724926 WARNING pred_bat: ------------------------------------------------------------ 2024-02-06 21:40:03.726075 WARNING pred_bat: Traceback (most recent call last): File "/usr/lib/python3.11/site-packages/appdaemon/threading.py", line 1022, in worker funcref(self.AD.sched.sanitize_timer_kwargs(app, args["kwargs"])) File "/usr/lib/python3.11/site-packages/appdaemon/adbase.py", line 35, in f_app_lock return f(*args, **kw) ^^^^^^^^^^^^^^ File "/config/apps/predbat.py", line 12003, in run_time_loop raise e File "/config/apps/predbat.py", line 11999, in run_time_loop self.update_pred(scheduled=True) File "/usr/lib/python3.11/site-packages/appdaemon/adbase.py", line 35, in f_app_lock return f(*args, **kw) ^^^^^^^^^^^^^^ File "/config/apps/predbat.py", line 11037, in update_pred status, status_extra = self.execute_plan() ^^^^^^^^^^^^^^^^^^^ File "/config/apps/predbat.py", line 9841, in execute_plan inverter.adjust_charge_immediate(self.charge_limit_percent_best[0]) File "/config/apps/predbat.py", line 2452, in adjust_charge_immediate self.base.call_service(self.base.get_arg("charge_start_service"), device_id=self.base.get_arg("device_id", index=self.id), target_soc=target_soc) File "/usr/lib/python3.11/site-packages/appdaemon/utils.py", line 231, in inner_sync_wrapper f = run_coroutine_threadsafe(self, coro(self, *args, **kwargs)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/appdaemon/utils.py", line 313, in run_coroutine_threadsafe result = future.result(self.AD.internal_function_timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/concurrent/futures/_base.py", line 456, in result return self.__get_result() ^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result raise self._exception File "/usr/lib/python3.11/site-packages/appdaemon/adapi.py", line 1752, in call_service self._check_service(service) File "/usr/lib/python3.11/site-packages/appdaemon/adapi.py", line 1579, in _check_service if service.find("/") == -1: ^^^^^^^^^^^^ AttributeError: 'dict' object has no attribute 'find'

2024-02-06 21:40:03.726209 WARNING pred_bat: ------------------------------------------------------------ 2024-02-06 21:45:03.762781 WARNING pred_bat: ------------------------------------------------------------ 2024-02-06 21:45:03.763146 WARNING pred_bat: Unexpected error in worker for App pred_bat: 2024-02-06 21:45:03.763319 WARNING pred_bat: Worker Ags: {'id': '2f9cb91f26b34c9f8125f68e37b1abdf', 'name': 'pred_bat', 'objectid': '52bbd711c5934b25b04ddaff81ad2496', 'type': 'scheduler', 'function': <bound method PredBat.run_time_loop of <predbat.PredBat object at 0x7f3af340f910>>, 'pin_app': True, 'pin_thread': 0, 'kwargs': {'interval': 300, 'random_start': 0, 'random_end': 0, '__thread_id': 'thread-0'}} 2024-02-06 21:45:03.763519 WARNING pred_bat: ------------------------------------------------------------ 2024-02-06 21:45:03.764956 WARNING pred_bat: Traceback (most recent call last): File "/usr/lib/python3.11/site-packages/appdaemon/threading.py", line 1022, in worker funcref(self.AD.sched.sanitize_timer_kwargs(app, args["kwargs"])) File "/usr/lib/python3.11/site-packages/appdaemon/adbase.py", line 35, in f_app_lock return f(*args, **kw) ^^^^^^^^^^^^^^ File "/config/apps/predbat.py", line 12003, in run_time_loop raise e File "/config/apps/predbat.py", line 11999, in run_time_loop self.update_pred(scheduled=True) File "/usr/lib/python3.11/site-packages/appdaemon/adbase.py", line 35, in f_app_lock return f(*args, **kw) ^^^^^^^^^^^^^^ File "/config/apps/predbat.py", line 11037, in update_pred status, status_extra = self.execute_plan() ^^^^^^^^^^^^^^^^^^^ File "/config/apps/predbat.py", line 9841, in execute_plan inverter.adjust_charge_immediate(self.charge_limit_percent_best[0]) File "/config/apps/predbat.py", line 2452, in adjust_charge_immediate self.base.call_service(self.base.get_arg("charge_start_service"), device_id=self.base.get_arg("device_id", index=self.id), target_soc=target_soc) File "/usr/lib/python3.11/site-packages/appdaemon/utils.py", line 231, in inner_sync_wrapper f = run_coroutine_threadsafe(self, coro(self, *args, **kwargs)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/appdaemon/utils.py", line 313, in run_coroutine_threadsafe result = future.result(self.AD.internal_function_timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/concurrent/futures/_base.py", line 456, in result return self.__get_result() ^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result raise self._exception File "/usr/lib/python3.11/site-packages/appdaemon/adapi.py", line 1752, in call_service self._check_service(service) File "/usr/lib/python3.11/site-packages/appdaemon/adapi.py", line 1579, in _check_service if service.find("/") == -1: ^^^^^^^^^^^^ AttributeError: 'dict' object has no attribute 'find'

2024-02-06 21:45:03.765711 WARNING pred_bat: ------------------------------------------------------------

JohanAlvedal avatar Feb 06 '24 20:02 JohanAlvedal

What do you have in apps.yaml for 'charge_start_service' ?

springfall2008 avatar Feb 06 '24 20:02 springfall2008

charge_start_service: service: huawei_solar/forcible_charge_soc data: target_soc: 100 power: "3000"

JohanAlvedal avatar Feb 06 '24 20:02 JohanAlvedal

IMG_0322

JohanAlvedal avatar Feb 06 '24 20:02 JohanAlvedal

No sorry in apps.yaml it should say:

charge_start_service: service: huawei_solar/forcible_charge_soc device_id: XXXX

And you need to replace the XXXX with your device ID as per the above template

springfall2008 avatar Feb 06 '24 21:02 springfall2008

https://pastebin.pl/view/9172ef45

apps.yaml code

#Services to charge/discharge charge_start_service: service: huawei_solar/forcible_charge_soc device_id: 6893ee838a0972bd3e50d9e0faa0ba5a

charge_stop_service: service: huawei_solar/stop_forcible_charge device_id: 6893ee838a0972bd3e50d9e0faa0ba5a

discharge_start_service: service: huawei_solar/forcible_discharge_soc device_id: 6893ee838a0972bd3e50d9e0faa0ba5a

discharge_stop_service: service: huawei_solar/stop_forcible_charge device_id: 6893ee838a0972bd3e50d9e0faa0ba5a

#Predbat, HA log

` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/concurrent/futures/_base.py", line 456, in result return self.__get_result() ^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result raise self._exception File "/usr/lib/python3.11/site-packages/appdaemon/adapi.py", line 1752, in call_service self._check_service(service) File "/usr/lib/python3.11/site-packages/appdaemon/adapi.py", line 1579, in _check_service if service.find("/") == -1: ^^^^^^^^^^^^ AttributeError: 'dict' object has no attribute 'find'

2024-02-06 22:12:55.709484 WARNING pred_bat: ------------------------------------------------------------ 2024-02-06 22:13:30.822254 WARNING pred_bat: ------------------------------------------------------------ 2024-02-06 22:13:30.822428 WARNING pred_bat: Unexpected error in worker for App pred_bat: 2024-02-06 22:13:30.822533 WARNING pred_bat: Worker Ags: {'id': 'ac684c787a14409cafd0896086e6776f', 'name': 'pred_bat', 'objectid': 'e1f704e86c354964a1212ad9e1b4e6b9', 'type': 'scheduler', 'function': <bound method PredBat.update_time_loop of <predbat.PredBat object at 0x7f23ac9af690>>, 'pin_app': True, 'pin_thread': 0, 'kwargs': {'interval': 15, 'random_start': 0, 'random_end': 0, '__thread_id': 'thread-0'}} 2024-02-06 22:13:30.822620 WARNING pred_bat: ------------------------------------------------------------ 2024-02-06 22:13:30.823769 WARNING pred_bat: Traceback (most recent call last): File "/usr/lib/python3.11/site-packages/appdaemon/threading.py", line 1022, in worker funcref(self.AD.sched.sanitize_timer_kwargs(app, args["kwargs"])) File "/usr/lib/python3.11/site-packages/appdaemon/adbase.py", line 35, in f_app_lock return f(*args, **kw) ^^^^^^^^^^^^^^ File "/config/apps/predbat.py", line 11981, in update_time_loop raise e File "/config/apps/predbat.py", line 11976, in update_time_loop self.update_pred(scheduled=False) File "/usr/lib/python3.11/site-packages/appdaemon/adbase.py", line 35, in f_app_lock return f(*args, **kw) ^^^^^^^^^^^^^^ File "/config/apps/predbat.py", line 11037, in update_pred status, status_extra = self.execute_plan() ^^^^^^^^^^^^^^^^^^^ File "/config/apps/predbat.py", line 9841, in execute_plan inverter.adjust_charge_immediate(self.charge_limit_percent_best[0]) File "/config/apps/predbat.py", line 2452, in adjust_charge_immediate self.base.call_service(self.base.get_arg("charge_start_service"), device_id=self.base.get_arg("device_id", index=self.id), target_soc=target_soc) File "/usr/lib/python3.11/site-packages/appdaemon/utils.py", line 231, in inner_sync_wrapper f = run_coroutine_threadsafe(self, coro(self, *args, **kwargs)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/appdaemon/utils.py", line 313, in run_coroutine_threadsafe result = future.result(self.AD.internal_function_timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/concurrent/futures/_base.py", line 456, in result return self.__get_result() ^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result raise self._exception File "/usr/lib/python3.11/site-packages/appdaemon/adapi.py", line 1752, in call_service self._check_service(service) File "/usr/lib/python3.11/site-packages/appdaemon/adapi.py", line 1579, in _check_service if service.find("/") == -1: ^^^^^^^^^^^^ AttributeError: 'dict' object has no attribute 'find'

2024-02-06 22:13:30.823890 WARNING pred_bat: ------------------------------------------------------------ 2024-02-06 22:15:03.818652 WARNING pred_bat: ------------------------------------------------------------ 2024-02-06 22:15:03.818856 WARNING pred_bat: Unexpected error in worker for App pred_bat: 2024-02-06 22:15:03.819021 WARNING pred_bat: Worker Ags: {'id': 'a325f77312ec4a40a42917bbda943697', 'name': 'pred_bat', 'objectid': 'e1f704e86c354964a1212ad9e1b4e6b9', 'type': 'scheduler', 'function': <bound method PredBat.run_time_loop of <predbat.PredBat object at 0x7f23ac9af690>>, 'pin_app': True, 'pin_thread': 0, 'kwargs': {'interval': 300, 'random_start': 0, 'random_end': 0, '__thread_id': 'thread-0'}} 2024-02-06 22:15:03.819152 WARNING pred_bat: ------------------------------------------------------------ 2024-02-06 22:15:03.820364 WARNING pred_bat: Traceback (most recent call last): File "/usr/lib/python3.11/site-packages/appdaemon/threading.py", line 1022, in worker funcref(self.AD.sched.sanitize_timer_kwargs(app, args["kwargs"])) File "/usr/lib/python3.11/site-packages/appdaemon/adbase.py", line 35, in f_app_lock return f(*args, **kw) ^^^^^^^^^^^^^^ File "/config/apps/predbat.py", line 12003, in run_time_loop raise e File "/config/apps/predbat.py", line 11999, in run_time_loop self.update_pred(scheduled=True) File "/usr/lib/python3.11/site-packages/appdaemon/adbase.py", line 35, in f_app_lock return f(*args, **kw) ^^^^^^^^^^^^^^ File "/config/apps/predbat.py", line 11037, in update_pred status, status_extra = self.execute_plan() ^^^^^^^^^^^^^^^^^^^ File "/config/apps/predbat.py", line 9841, in execute_plan inverter.adjust_charge_immediate(self.charge_limit_percent_best[0]) File "/config/apps/predbat.py", line 2452, in adjust_charge_immediate self.base.call_service(self.base.get_arg("charge_start_service"), device_id=self.base.get_arg("device_id", index=self.id), target_soc=target_soc) File "/usr/lib/python3.11/site-packages/appdaemon/utils.py", line 231, in inner_sync_wrapper f = run_coroutine_threadsafe(self, coro(self, *args, **kwargs)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/appdaemon/utils.py", line 313, in run_coroutine_threadsafe result = future.result(self.AD.internal_function_timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/concurrent/futures/_base.py", line 456, in result return self.__get_result() ^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result raise self._exception File "/usr/lib/python3.11/site-packages/appdaemon/adapi.py", line 1752, in call_service self._check_service(service) File "/usr/lib/python3.11/site-packages/appdaemon/adapi.py", line 1579, in _check_service if service.find("/") == -1: ^^^^^^^^^^^^ AttributeError: 'dict' object has no attribute 'find'

2024-02-06 22:15:03.820551 WARNING pred_bat: ------------------------------------------------------------`

JohanAlvedal avatar Feb 06 '24 21:02 JohanAlvedal

Sorry I'm maybe not being specific, the apps.yaml should say:

#Services to charge/discharge device_id: 6893ee838a0972bd3e50d9e0faa0ba5a

charge_start_service: huawei_solar/forcible_charge_soc charge_stop_service: huawei_solar/stop_forcible_charge discharge_start_service: huawei_solar/forcible_discharge_soc discharge_stop_service: huawei_solar/stop_forcible_charge

springfall2008 avatar Feb 06 '24 21:02 springfall2008

predbat.log https://pastebin.pl/view/06a3d469

Addon log. s6-rc: info: service s6rc-oneshot-runner: starting s6-rc: info: service s6rc-oneshot-runner successfully started s6-rc: info: service base-addon-banner: starting


Add-on: appdaemon-predbat Predbat pre-install in AppDaemon

Add-on version: 1.0.6 You are running the latest version of this add-on. System: Home Assistant OS 11.5 (amd64 / generic-x86-64) Home Assistant Core: 2024.1.6 Home Assistant Supervisor: 2024.01.1

Please, share the above information when looking for help or support in, e.g., GitHub, forums or the Discord chat.

s6-rc: info: service base-addon-banner successfully started s6-rc: info: service fix-attrs: starting s6-rc: info: service base-addon-log-level: starting s6-rc: info: service fix-attrs successfully started s6-rc: info: service base-addon-log-level successfully started s6-rc: info: service legacy-cont-init: starting s6-rc: info: service legacy-cont-init successfully started s6-rc: info: service init-appdaemon: starting s6-rc: info: service init-appdaemon successfully started s6-rc: info: service appdaemon: starting s6-rc: info: service appdaemon successfully started s6-rc: info: service legacy-services: starting [00:49:32] INFO: Starting AppDaemon... s6-rc: info: service legacy-services successfully started

HA core log Logger: homeassistant.helpers.service Source: helpers/service.py:246 First occurred: 01:17:09 (8 occurrences) Last logged: 06:00:41

Referenced entities switch.predbat_load_filter_modal are missing or not currently available Referenced entities switch.predbat_set_status_notify are missing or not currently available Referenced entities switch.predbat_set_inverter_notify are missing or not currently available Referenced entities switch.predbat_set_reserve_enable are missing or not currently available

JohanAlvedal avatar Feb 07 '24 05:02 JohanAlvedal

Can you actually try trigger a force charge and a force discharge to a target SOC in Developer Tools/Services and then send me the YAML for both of them (if they actually work)?

springfall2008 avatar Feb 07 '24 17:02 springfall2008

I think I might have to add 'power', if so what value?

springfall2008 avatar Feb 07 '24 18:02 springfall2008

I think I might have to add 'power', if so what value?

Charge night time 4500w Charge day 2500w Discharge 1500-2000w

JohanAlvedal avatar Feb 07 '24 19:02 JohanAlvedal

IMG_0327 IMG_0326 IMG_0325 IMG_0324 IMG_0323

JohanAlvedal avatar Feb 07 '24 19:02 JohanAlvedal

Do the above all work okay when you hit 'call service'?

It seems that we need to add power, what's the maximum power?

springfall2008 avatar Feb 07 '24 20:02 springfall2008

Updated to include power setting here: https://raw.githubusercontent.com/springfall2008/batpred/huawei/apps/predbat/predbat.py

springfall2008 avatar Feb 07 '24 20:02 springfall2008