springfall2008 / batpred

Home battery prediction and charging automation for Home Assistant, supporting many inverter types
https://springfall2008.github.io/batpred/
129 stars 44 forks source link

Unable to find service template for discharge_start_service #1425

Open JohanAlvedal opened 2 months ago

JohanAlvedal commented 2 months ago

Describe the bug

1248 | 2024-09-02 15:51:38.979404: Info: record_status Discharging target 7%-6%
1247 | 2024-09-02 15:51:38.969206: Completed run status Discharging
1246 | 2024-09-02 15:51:38.876680: Inverter 0 Wrote 6 to charge_limit, successfully now 6
1245 | 2024-09-02 15:51:34.844783: Inverter 0 Current charge limit is 5% and new target is 6%
1244 | 2024-09-02 15:51:34.844715: Warn: Inverter 0 unable to find service template for discharge_start_service
1243 | 2024-09-02 15:51:34.844549: Warn: Failed to decode response from http://supervisor/core/api/services/huawei_solar/forcible_discharge_soc
1242 | 2024-09-02 15:51:34.836734: Inverter 0 Call service huawei_solar/forcible_discharge_soc with data {'device_id': '6893ee838a0972bd3e50d9e0faa0ba5a', 'target_soc': 6, 'power': 3500}

Expected behavior Call action (service) charge an dischage missing template?

Predbat version

8.4.4

Environment details

Log file

1248 | 2024-09-02 15:51:38.979404: Info: record_status Discharging target 7%-6%
1247 | 2024-09-02 15:51:38.969206: Completed run status Discharging
1246 | 2024-09-02 15:51:38.876680: Inverter 0 Wrote 6 to charge_limit, successfully now 6
1245 | 2024-09-02 15:51:34.844783: Inverter 0 Current charge limit is 5% and new target is 6%
1244 | 2024-09-02 15:51:34.844715: Warn: Inverter 0 unable to find service template for discharge_start_service
1243 | 2024-09-02 15:51:34.844549: Warn: Failed to decode response from http://supervisor/core/api/services/huawei_solar/forcible_discharge_soc
1242 | 2024-09-02 15:51:34.836734: Inverter 0 Call service huawei_solar/forcible_discharge_soc with data {'device_id': '6893ee838a0972bd3e50d9e0faa0ba5a', 'target_soc': 6, 'power': 3500}
springfall2008 commented 2 months ago

1244 | 2024-09-02 15:51:34.844715: Warn: Inverter 0 unable to find service template for discharge_start_service

This is a spurious warning and can be ignored (typo)

1243 | 2024-09-02 15:51:34.844549: Warn: Failed to decode response from http://supervisor/core/api/services/huawei_solar/forcible_discharge_soc 1242 | 2024-09-02 15:51:34.836734: Inverter 0 Call service huawei_solar/forcible_discharge_soc with data {'device_id': '6893ee838a0972bd3e50d9e0faa0ba5a', 'target_soc': 6, 'power': 3500}

This implies home assistant didnt like your sevice call. Is the service name and device_id correct, can you call this service in HA in developer tools and does it work?

JohanAlvedal commented 2 months ago

ok could it be that earlier I ran charge_start_service: huawei_solar/forcible_charge_soc and so you and I had a discussion about running on time instead of %? You said I could change the time in the config file but I was unsure how The new formatting for in time is

charge_start_service: huawei_solar/forcible_charge charge_stop_service: huawei_solar/stop_forcible_charge discharge_start_service: huawei_solar/forcible_discharge discharge_stop_service: huawei_solar/stop_forcible_charge

To run in time instead of %, duration:XX must be added, but I'm not sure how it should look in the apps.yaml file

Action call in Home assistant in time that works action: huawei_solar.forcible_charge data: duration: 60 # time in minutes power: 2500 # power in W device_id: 6893ee838a0972bd3e50d9e0faa0ba5a

action: huawei_solar.forcible_discharge data: duration: 60 # time in minutes power: 2500 # power in W device_id: 6893ee838a0972bd3e50d9e0faa0ba5a

And to % action: huawei_solar.forcible_charge_soc data: device_id: 6893ee838a0972bd3e50d9e0faa0ba5a target_soc: 50 # target in % power: "1000"

springfall2008 commented 2 months ago

So you need to change your service templates e.g:

charge_start_service:
   duration: 60
   power:  {power}
   device_id: 6893ee838a0972bd3e50d9e0faa0ba5a

This should work.

nargotik commented 2 months ago

Where this template is put ?