Code Monkey home page Code Monkey logo

pv_opt's People

Contributors

fboundy avatar szosszenet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

alz41

pv_opt's Issues

Log formatting bug

Describe the bug
File "/homeassistant/appdaemon/apps/Github/pv_opt/apps/pv_opt/inverters.py", line 484, in _solis_write_holding_register
self.log(f"Inverter value already set to {value:d}.")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: Unknown format code 'd' for object of type 'float'

Agile Pricing Not Updating at Midnight

Describe the bug
There appears to be a (intermittent?) bug where Agile prices aren't properly updating at midnight so the previous day's rates are erroneously used by default.

If users have the Octopus Energy app they will see a discrepancy between the OE price (yellow) and the PV_OPt (white) price on this chart:
image

Restarting AppDaemin fixes the problem but obviously that's not a long terms fix. I have added some additional checks and logging in 3.5.2 to hopefully correct this but I am still diagnosing the root cause.

Prediction / charge accuracy

Happy New Year!

  • This may not be a bug - probably my lack of understanding *

v 3.5.1
Yesterday I switched out from Read Only mode so early days with my understanding of how the logic works. Today at 16:00 when the new Agile import rates were published, the PV_Opt has chosen the following time slots to charge the battery:

image

I can't work out why it wouldn't select the cheapest time and you can see it will be charging (or holding, still charging?) until 06:00. Why not charge earlier and upto the 05:30 slot?

I don't fully understand the Threshold per pass (currently 4.0) & per slot (1.0), guess that affects things.

Also, tomorrow's solar forecast is good (11kWh - believe it when I see it!), but perhaps the charging forecast is skewed based on consumption over Christmas. Does the optimiser work out the battery change required to clear the expensive peak rates based on consumption history and expected solar forecast? This would explain charging later into the morning but not if 11kWh PV is predicted.

image

Regards

Redact Personal Data from log file by default.

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

export tariff OUTGOING-LITE-FIX-12M-23-09-12 causes 400 error

Describe the bug
Im currently on the above export tariff. When I use this tariff pv_opt fails.

I suspect this is because the tariff has no end date.

To Reproduce

  1. Select the above tariff in the config
  2. Initialisation fails with 400 error

Expected behavior
Tariff to be treated as valid

Logs
The config:

  octopus_import_tariff_code: E-1R-GO-18-06-12-F                                                                                                                                                                                                  
  octopus_export_tariff_code: E-1R-OUTGOING-LITE-FIX-12M-23-09-12-F  

Detecting the config in the logs:

2024-02-04 15:31:46.858473 INFO pv_opt: Starting Opimisation with discharge enabled
2024-02-04 15:31:46.859185 INFO pv_opt: -------------------------------------------
2024-02-04 15:31:46.859864 INFO pv_opt: 
2024-02-04 15:31:46.860571 INFO pv_opt: Checking tariffs:
2024-02-04 15:31:46.861282 INFO pv_opt: -----------------
2024-02-04 15:31:46.866274 INFO pv_opt:   Import: E-1R-GO-18-06-12-F                       Start: 2023-05-31 23:30:00+0000 End: 2024-02-06 00:30:00+0000 
2024-02-04 15:31:46.867082 INFO pv_opt:   Export: E-1R-OUTGOING-LITE-FIX-12M-23-09-12-F    Start: 2023-09-11 23:00:00+0000 End: N/A 
2024-02-04 15:31:46.867813 INFO pv_opt:   - Tariffs OK
2024-02-04 15:31:46.868516 INFO pv_opt: 

The error:

2024-02-04 15:31:51.337563 WARNING HASS: Error setting Home Assistant state default.sensor.pvopt_opt_cost, {'state': 0.0, 'attributes': {'friendly_name': 'PV Opt Optimised Cost', 'device_class': 'monetary', 'state_class': 'measurement', 'unit_of_measurement': 'GBP', 'cost_today': 0.0, 'cost_tomorrow': 0.0, 'soc': [{'period_start': '2024-02-04T15:30:00+00:00', 'soc': 9.0}, {'period_start': '2024-02-04T16:00:00+00:00', 'soc': 10.0}, {'period_start': '2024-02-04T16:30:00+00:00', 'soc': 10.0}, {'period_start': '2024-02-04T17:00:00+00:00', 'soc': 10.0}, {'period_start': '2024-02-04T17:30:00+00:00', 'soc': 10.0}, {'period_start': '2024-02-04T18:00:00+00:00', 'soc': 10.0}, {'period_start': '2024-02-04T18:30:00+00:00', 'soc': 10.0}, {'period_start': '2024-02-04T19:00:00+00:00', 'soc': 10.0}, {'period_start': '2024-02-04T19:30:00+00:00', 'soc': 10.0}, {'period_start': '2024-02-04T20:00:00+00:00', 'soc': 10.0}, {'period_start': '2024-02-04T20:30:00+00:00', 'soc': 10.0}, {'period_start': '2024-02-04T21:00:00+00:00', 'soc': 10.0}, {'period_start': '2024-02-04T21:30:00+00:00', 'soc': 10.0}, {'period_start': '2024-02-04T22:00:00+00:00', 'soc': 10.0}, {'period_start': '2024-02-04T22:30:00+00:00', 'soc': 10.0}, {'period_start': '2024-02-04T23:00:00+00:00', 'soc': 10.0}, {'period_start': '2024-02-04T23:30:00+00:00', 'soc': 10.0}, {'period_start': '2024-02-05T00:00:00+00:00', 'soc': 10.0}, {'period_start': '2024-02-05T00:30:00+00:00', 'soc': 10.0}, {'period_start': '2024-02-05T01:00:00+00:00', 'soc': 21.35}, {'period_start': '2024-02-05T01:30:00+00:00', 'soc': 32.7}, {'period_start': '2024-02-05T02:00:00+00:00', 'soc': 44.04}, {'period_start': '2024-02-05T02:30:00+00:00', 'soc': 55.39}, {'period_start': '2024-02-05T03:00:00+00:00', 'soc': 66.74}, {'period_start': '2024-02-05T03:30:00+00:00', 'soc': 78.09}, {'period_start': '2024-02-05T04:00:00+00:00', 'soc': 89.44}, {'period_start': '2024-02-05T04:30:00+00:00', 'soc': 88.73}, {'period_start': '2024-02-05T05:00:00+00:00', 'soc': 86.46}, {'period_start': '2024-02-05T05:30:00+00:00', 'soc': 83.91}, {'period_start': '2024-02-05T06:00:00+00:00', 'soc': 81.78}, {'period_start': '2024-02-05T06:30:00+00:00', 'soc': 81.21}, {'period_start': '2024-02-05T07:00:00+00:00', 'soc': 80.65}, {'period_start': '2024-02-05T07:30:00+00:00', 'soc': 79.37}, {'period_start': '2024-02-05T08:00:00+00:00', 'soc': 76.96}, {'period_start': '2024-02-05T08:30:00+00:00', 'soc': 71.53}, {'period_start': '2024-02-05T09:00:00+00:00', 'soc': 67.04}, {'period_start': '2024-02-05T09:30:00+00:00', 'soc': 64.11}, {'period_start': '2024-02-05T10:00:00+00:00', 'soc': 62.37}, {'period_start': '2024-02-05T10:30:00+00:00', 'soc': 63.45}, {'period_start': '2024-02-05T11:00:00+00:00', 'soc': 64.35}, {'period_start': '2024-02-05T11:30:00+00:00', 'soc': 66.26}, {'period_start': '2024-02-05T12:00:00+00:00', 'soc': 67.61}, {'period_start': '2024-02-05T12:30:00+00:00', 'soc': 68.5}, {'period_start': '2024-02-05T13:00:00+00:00', 'soc': 68.85}, {'period_start': '2024-02-05T13:30:00+00:00', 'soc': 71.06}, {'period_start': '2024-02-05T14:00:00+00:00', 'soc': 71.34}, {'period_start': '2024-02-05T14:30:00+00:00', 'soc': 70.12}, {'period_start': '2024-02-05T15:00:00+00:00', 'soc': 70.63}, {'period_start': '2024-02-05T15:30:00+00:00', 'soc': 60.39}, {'period_start': '2024-02-05T16:00:00+00:00', 'soc': 48.5}, {'period_start': '2024-02-05T16:30:00+00:00', 'soc': 37.47}, {'period_start': '2024-02-05T17:00:00+00:00', 'soc': 34.28}, {'period_start': '2024-02-05T17:30:00+00:00', 'soc': 29.6}, {'period_start': '2024-02-05T18:00:00+00:00', 'soc': 22.23}, {'period_start': '2024-02-05T18:30:00+00:00', 'soc': 16.98}, {'period_start': '2024-02-05T19:00:00+00:00', 'soc': 10.0}, {'period_start': '2024-02-05T19:30:00+00:00', 'soc': 10.0}, {'period_start': '2024-02-05T20:00:00+00:00', 'soc': 10.0}, {'period_start': '2024-02-05T20:30:00+00:00', 'soc': 10.0}, {'period_start': '2024-02-05T21:00:00+00:00', 'soc': 10.0}, {'period_start': '2024-02-05T21:30:00+00:00', 'soc': 10.0}, {'period_start': '2024-02-05T22:00:00+00:00', 'soc': 10.0}, {'period_start': '2024-02-05T22:30:00+00:00', 'soc': 10.0}, {'period_start': '2024-02-05T23:00:00+00:00', 'soc': 10.0}, {'period_start': '2024-02-05T23:30:00+00:00', 'soc': 10.0}], 'forced': [{'period_start': '2024-02-04T15:30:00+00:00', 'forced': 0}, {'period_start': '2024-02-04T16:00:00+00:00', 'forced': 0}, {'period_start': '2024-02-04T16:30:00+00:00', 'forced': 0}, {'period_start': '2024-02-04T17:00:00+00:00', 'forced': 0}, {'period_start': '2024-02-04T17:30:00+00:00', 'forced': 0}, {'period_start': '2024-02-04T18:00:00+00:00', 'forced': 0}, {'period_start': '2024-02-04T18:30:00+00:00', 'forced': 0}, {'period_start': '2024-02-04T19:00:00+00:00', 'forced': 0}, {'period_start': '2024-02-04T19:30:00+00:00', 'forced': 0}, {'period_start': '2024-02-04T20:00:00+00:00', 'forced': 0}, {'period_start': '2024-02-04T20:30:00+00:00', 'forced': 0}, {'period_start': '2024-02-04T21:00:00+00:00', 'forced': 0}, {'period_start': '2024-02-04T21:30:00+00:00', 'forced': 0}, {'period_start': '2024-02-04T22:00:00+00:00', 'forced': 0}, {'period_start': '2024-02-04T22:30:00+00:00', 'forced': 0}, {'period_start': '2024-02-04T23:00:00+00:00', 'forced': 0}, {'period_start': '2024-02-04T23:30:00+00:00', 'forced': 0}, {'period_start': '2024-02-05T00:00:00+00:00', 'forced': 0}, {'period_start': '2024-02-05T00:30:00+00:00', 'forced': 2494}, {'period_start': '2024-02-05T01:00:00+00:00', 'forced': 2494}, {'period_start': '2024-02-05T01:30:00+00:00', 'forced': 2494}, {'period_start': '2024-02-05T02:00:00+00:00', 'forced': 2494}, {'period_start': '2024-02-05T02:30:00+00:00', 'forced': 2494}, {'period_start': '2024-02-05T03:00:00+00:00', 'forced': 2494}, {'period_start': '2024-02-05T03:30:00+00:00', 'forced': 2494}, {'period_start': '2024-02-05T04:00:00+00:00', 'forced': 0}, {'period_start': '2024-02-05T04:30:00+00:00', 'forced': 0}, {'period_start': '2024-02-05T05:00:00+00:00', 'forced': 0}, {'period_start': '2024-02-05T05:30:00+00:00', 'forced': 0}, {'period_start': '2024-02-05T06:00:00+00:00', 'forced': 0}, {'period_start': '2024-02-05T06:30:00+00:00', 'forced': 0}, {'period_start': '2024-02-05T07:00:00+00:00', 'forced': 0}, {'period_start': '2024-02-05T07:30:00+00:00', 'forced': 0}, {'period_start': '2024-02-05T08:00:00+00:00', 'forced': 0}, {'period_start': '2024-02-05T08:30:00+00:00', 'forced': 0}, {'period_start': '2024-02-05T09:00:00+00:00', 'forced': 0}, {'period_start': '2024-02-05T09:30:00+00:00', 'forced': 0}, {'period_start': '2024-02-05T10:00:00+00:00', 'forced': 0}, {'period_start': '2024-02-05T10:30:00+00:00', 'forced': 0}, {'period_start': '2024-02-05T11:00:00+00:00', 'forced': 0}, {'period_start': '2024-02-05T11:30:00+00:00', 'forced': 0}, {'period_start': '2024-02-05T12:00:00+00:00', 'forced': 0}, {'period_start': '2024-02-05T12:30:00+00:00', 'forced': 0}, {'period_start': '2024-02-05T13:00:00+00:00', 'forced': 0}, {'period_start': '2024-02-05T13:30:00+00:00', 'forced': 0}, {'period_start': '2024-02-05T14:00:00+00:00', 'forced': 0}, {'period_start': '2024-02-05T14:30:00+00:00', 'forced': 0}, {'period_start': '2024-02-05T15:00:00+00:00', 'forced': 0}, {'period_start': '2024-02-05T15:30:00+00:00', 'forced': 0}, {'period_start': '2024-02-05T16:00:00+00:00', 'forced': 0}, {'period_start': '2024-02-05T16:30:00+00:00', 'forced': 0}, {'period_start': '2024-02-05T17:00:00+00:00', 'forced': 0}, {'period_start': '2024-02-05T17:30:00+00:00', 'forced': 0}, {'period_start': '2024-02-05T18:00:00+00:00', 'forced': 0}, {'period_start': '2024-02-05T18:30:00+00:00', 'forced': 0}, {'period_start': '2024-02-05T19:00:00+00:00', 'forced': 0}, {'period_start': '2024-02-05T19:30:00+00:00', 'forced': 0}, {'period_start': '2024-02-05T20:00:00+00:00', 'forced': 0}, {'period_start': '2024-02-05T20:30:00+00:00', 'forced': 0}, {'period_start': '2024-02-05T21:00:00+00:00', 'forced': 0}, {'period_start': '2024-02-05T21:30:00+00:00', 'forced': 0}, {'period_start': '2024-02-05T22:00:00+00:00', 'forced': 0}, {'period_start': '2024-02-05T22:30:00+00:00', 'forced': 0}, {'period_start': '2024-02-05T23:00:00+00:00', 'forced': 0}, {'period_start': '2024-02-05T23:30:00+00:00', 'forced': 0}], 'import': [{'period_start': '2024-02-04T15:30:00+00:00', 'import': 12.93}, {'period_start': '2024-02-04T16:00:00+00:00', 'import': 12.93}, {'period_start': '2024-02-04T16:30:00+00:00', 'import': 12.93}, {'period_start': '2024-02-04T17:00:00+00:00', 'import': 12.93}, {'period_start': '2024-02-04T17:30:00+00:00', 'import': 12.93}, {'period_start': '2024-02-04T18:00:00+00:00', 'import': 12.93}, {'period_start': '2024-02-04T18:30:00+00:00', 'import': 12.93}, {'period_start': '2024-02-04T19:00:00+00:00', 'import': 12.93}, {'period_start': '2024-02-04T19:30:00+00:00', 'import': 12.93}, {'period_start': '2024-02-04T20:00:00+00:00', 'import': 12.93}, {'period_start': '2024-02-04T20:30:00+00:00', 'import': 12.93}, {'period_start': '2024-02-04T21:00:00+00:00', 'import': 12.93}, {'period_start': '2024-02-04T21:30:00+00:00', 'import': 12.93}, {'period_start': '2024-02-04T22:00:00+00:00', 'import': 12.93}, {'period_start': '2024-02-04T22:30:00+00:00', 'import': 12.93}, {'period_start': '2024-02-04T23:00:00+00:00', 'import': 12.93}, {'period_start': '2024-02-04T23:30:00+00:00', 'import': 12.93}, {'period_start': '2024-02-05T00:00:00+00:00', 'import': 12.93}, {'period_start': '2024-02-05T00:30:00+00:00', 'import': 5.0}, {'period_start': '2024-02-05T01:00:00+00:00', 'import': 5.0}, {'period_start': '2024-02-05T01:30:00+00:00', 'import': 5.0}, {'period_start': '2024-02-05T02:00:00+00:00', 'import': 5.0}, {'period_start': '2024-02-05T02:30:00+00:00', 'import': 5.0}, {'period_start': '2024-02-05T03:00:00+00:00', 'import': 5.0}, {'period_start': '2024-02-05T03:30:00+00:00', 'import': 5.0}, {'period_start': '2024-02-05T04:00:00+00:00', 'import': 5.0}, {'period_start': '2024-02-05T04:30:00+00:00', 'import': 12.93}, {'period_start': '2024-02-05T05:00:00+00:00', 'import': 12.93}, {'period_start': '2024-02-05T05:30:00+00:00', 'import': 12.93}, {'period_start': '2024-02-05T06:00:00+00:00', 'import': 12.93}, {'period_start': '2024-02-05T06:30:00+00:00', 'import': 12.93}, {'period_start': '2024-02-05T07:00:00+00:00', 'import': 12.93}, {'period_start': '2024-02-05T07:30:00+00:00', 'import': 12.93}, {'period_start': '2024-02-05T08:00:00+00:00', 'import': 12.93}, {'period_start': '2024-02-05T08:30:00+00:00', 'import': 12.93}, {'period_start': '2024-02-05T09:00:00+00:00', 'import': 12.93}, {'period_start': '2024-02-05T09:30:00+00:00', 'import': 12.93}, {'period_start': '2024-02-05T10:00:00+00:00', 'import': 12.93}, {'period_start': '2024-02-05T10:30:00+00:00', 'import': 12.93}, {'period_start': '2024-02-05T11:00:00+00:00', 'import': 12.93}, {'period_start': '2024-02-05T11:30:00+00:00', 'import': 12.93}, {'period_start': '2024-02-05T12:00:00+00:00', 'import': 12.93}, {'period_start': '2024-02-05T12:30:00+00:00', 'import': 12.93}, {'period_start': '2024-02-05T13:00:00+00:00', 'import': 12.93}, {'period_start': '2024-02-05T13:30:00+00:00', 'import': 12.93}, {'period_start': '2024-02-05T14:00:00+00:00', 'import': 12.93}, {'period_start': '2024-02-05T14:30:00+00:00', 'import': 12.93}, {'period_start': '2024-02-05T15:00:00+00:00', 'import': 12.93}, {'period_start': '2024-02-05T15:30:00+00:00', 'import': 12.93}, {'period_start': '2024-02-05T16:00:00+00:00', 'import': 12.93}, {'period_start': '2024-02-05T16:30:00+00:00', 'import': 12.93}, {'period_start': '2024-02-05T17:00:00+00:00', 'import': 12.93}, {'period_start': '2024-02-05T17:30:00+00:00', 'import': 12.93}, {'period_start': '2024-02-05T18:00:00+00:00', 'import': 12.93}, {'period_start': '2024-02-05T18:30:00+00:00', 'import': 12.93}, {'period_start': '2024-02-05T19:00:00+00:00', 'import': 12.93}, {'period_start': '2024-02-05T19:30:00+00:00', 'import': 12.93}, {'period_start': '2024-02-05T20:00:00+00:00', 'import': 12.93}, {'period_start': '2024-02-05T20:30:00+00:00', 'import': 12.93}, {'period_start': '2024-02-05T21:00:00+00:00', 'import': 12.93}, {'period_start': '2024-02-05T21:30:00+00:00', 'import': 12.93}, {'period_start': '2024-02-05T22:00:00+00:00', 'import': 12.93}, {'period_start': '2024-02-05T22:30:00+00:00', 'import': 12.93}, {'period_start': '2024-02-05T23:00:00+00:00', 'import': 12.93}, {'period_start': '2024-02-05T23:30:00+00:00', 'import': 12.93}], 'export': [{'period_start': '2024-02-04T15:30:00+00:00', 'export': 0.0}, {'period_start': '2024-02-04T16:00:00+00:00', 'export': 0.0}, {'period_start': '2024-02-04T16:30:00+00:00', 'export': 0.0}, {'period_start': '2024-02-04T17:00:00+00:00', 'export': 0.0}, {'period_start': '2024-02-04T17:30:00+00:00', 'export': 0.0}, {'period_start': '2024-02-04T18:00:00+00:00', 'export': 0.0}, {'period_start': '2024-02-04T18:30:00+00:00', 'export': 0.0}, {'period_start': '2024-02-04T19:00:00+00:00', 'export': 0.0}, {'period_start': '2024-02-04T19:30:00+00:00', 'export': 0.0}, {'period_start': '2024-02-04T20:00:00+00:00', 'export': 0.0}, {'period_start': '2024-02-04T20:30:00+00:00', 'export': 0.0}, {'period_start': '2024-02-04T21:00:00+00:00', 'export': 0.0}, {'period_start': '2024-02-04T21:30:00+00:00', 'export': 0.0}, {'period_start': '2024-02-04T22:00:00+00:00', 'export': 0.0}, {'period_start': '2024-02-04T22:30:00+00:00', 'export': 0.0}, {'period_start': '2024-02-04T23:00:00+00:00', 'export': 0.0}, {'period_start': '2024-02-04T23:30:00+00:00', 'export': 0.0}, {'period_start': '2024-02-05T00:00:00+00:00', 'export': 0.0}, {'period_start': '2024-02-05T00:30:00+00:00', 'export': 0.0}, {'period_start': '2024-02-05T01:00:00+00:00', 'export': 0.0}, {'period_start': '2024-02-05T01:30:00+00:00', 'export': 0.0}, {'period_start': '2024-02-05T02:00:00+00:00', 'export': 0.0}, {'period_start': '2024-02-05T02:30:00+00:00', 'export': 0.0}, {'period_start': '2024-02-05T03:00:00+00:00', 'export': 0.0}, {'period_start': '2024-02-05T03:30:00+00:00', 'export': 0.0}, {'period_start': '2024-02-05T04:00:00+00:00', 'export': 0.0}, {'period_start': '2024-02-05T04:30:00+00:00', 'export': 0.0}, {'period_start': '2024-02-05T05:00:00+00:00', 'export': 0.0}, {'period_start': '2024-02-05T05:30:00+00:00', 'export': 0.0}, {'period_start': '2024-02-05T06:00:00+00:00', 'export': 0.0}, {'period_start': '2024-02-05T06:30:00+00:00', 'export': 0.0}, {'period_start': '2024-02-05T07:00:00+00:00', 'export': 0.0}, {'period_start': '2024-02-05T07:30:00+00:00', 'export': 0.0}, {'period_start': '2024-02-05T08:00:00+00:00', 'export': 0.0}, {'period_start': '2024-02-05T08:30:00+00:00', 'export': 0.0}, {'period_start': '2024-02-05T09:00:00+00:00', 'export': 0.0}, {'period_start': '2024-02-05T09:30:00+00:00', 'export': 0.0}, {'period_start': '2024-02-05T10:00:00+00:00', 'export': 0.0}, {'period_start': '2024-02-05T10:30:00+00:00', 'export': 0.0}, {'period_start': '2024-02-05T11:00:00+00:00', 'export': 0.0}, {'period_start': '2024-02-05T11:30:00+00:00', 'export': 0.0}, {'period_start': '2024-02-05T12:00:00+00:00', 'export': 0.0}, {'period_start': '2024-02-05T12:30:00+00:00', 'export': 0.0}, {'period_start': '2024-02-05T13:00:00+00:00', 'export': 0.0}, {'period_start': '2024-02-05T13:30:00+00:00', 'export': 0.0}, {'period_start': '2024-02-05T14:00:00+00:00', 'export': 0.0}, {'period_start': '2024-02-05T14:30:00+00:00', 'export': 0.0}, {'period_start': '2024-02-05T15:00:00+00:00', 'export': 0.0}, {'period_start': '2024-02-05T15:30:00+00:00', 'export': 0.0}, {'period_start': '2024-02-05T16:00:00+00:00', 'export': 0.0}, {'period_start': '2024-02-05T16:30:00+00:00', 'export': 0.0}, {'period_start': '2024-02-05T17:00:00+00:00', 'export': 0.0}, {'period_start': '2024-02-05T17:30:00+00:00', 'export': 0.0}, {'period_start': '2024-02-05T18:00:00+00:00', 'export': 0.0}, {'period_start': '2024-02-05T18:30:00+00:00', 'export': 0.0}, {'period_start': '2024-02-05T19:00:00+00:00', 'export': 0.0}, {'period_start': '2024-02-05T19:30:00+00:00', 'export': 0.0}, {'period_start': '2024-02-05T20:00:00+00:00', 'export': 0.0}, {'period_start': '2024-02-05T20:30:00+00:00', 'export': 0.0}, {'period_start': '2024-02-05T21:00:00+00:00', 'export': 0.0}, {'period_start': '2024-02-05T21:30:00+00:00', 'export': 0.0}, {'period_start': '2024-02-05T22:00:00+00:00', 'export': 0.0}, {'period_start': '2024-02-05T22:30:00+00:00', 'export': 0.0}, {'period_start': '2024-02-05T23:00:00+00:00', 'export': 0.0}, {'period_start': '2024-02-05T23:30:00+00:00', 'export': 0.0}], 'grid': [{'period_start': '2024-02-04T15:30:00+00:00', 'grid': 140.0}, {'period_start': '2024-02-04T16:00:00+00:00', 'grid': 166.0}, {'period_start': '2024-02-04T16:30:00+00:00', 'grid': 289.0}, {'period_start': '2024-02-04T17:00:00+00:00', 'grid': 1017.0}, {'period_start': '2024-02-04T17:30:00+00:00', 'grid': 1430.0}, {'period_start': '2024-02-04T18:00:00+00:00', 'grid': 1128.0}, {'period_start': '2024-02-04T18:30:00+00:00', 'grid': 1512.0}, {'period_start': '2024-02-04T19:00:00+00:00', 'grid': 1155.0}, {'period_start': '2024-02-04T19:30:00+00:00', 'grid': 1320.0}, {'period_start': '2024-02-04T20:00:00+00:00', 'grid': 165.0}, {'period_start': '2024-02-04T20:30:00+00:00', 'grid': 192.0}, {'period_start': '2024-02-04T21:00:00+00:00', 'grid': 660.0}, {'period_start': '2024-02-04T21:30:00+00:00', 'grid': 412.0}, {'period_start': '2024-02-04T22:00:00+00:00', 'grid': 715.0}, {'period_start': '2024-02-04T22:30:00+00:00', 'grid': 385.0}, {'period_start': '2024-02-04T23:00:00+00:00', 'grid': 357.0}, {'period_start': '2024-02-04T23:30:00+00:00', 'grid': 385.0}, {'period_start': '2024-02-05T00:00:00+00:00', 'grid': 495.0}, {'period_start': '2024-02-05T00:30:00+00:00', 'grid': 3952.0}, {'period_start': '2024-02-05T01:00:00+00:00', 'grid': 5519.0}, {'period_start': '2024-02-05T01:30:00+00:00', 'grid': 6894.0}, {'period_start': '2024-02-05T02:00:00+00:00', 'grid': 6344.0}, {'period_start': '2024-02-05T02:30:00+00:00', 'grid': 3897.0}, {'period_start': '2024-02-05T03:00:00+00:00', 'grid': 3484.0}, {'period_start': '2024-02-05T03:30:00+00:00', 'grid': 2604.0}, {'period_start': '2024-02-05T04:00:00+00:00', 'grid': -0.0}, {'period_start': '2024-02-05T04:30:00+00:00', 'grid': 0.0}, {'period_start': '2024-02-05T05:00:00+00:00', 'grid': -0.0}, {'period_start': '2024-02-05T05:30:00+00:00', 'grid': 0.0}, {'period_start': '2024-02-05T06:00:00+00:00', 'grid': 0.0}, {'period_start': '2024-02-05T06:30:00+00:00', 'grid': 0.0}, {'period_start': '2024-02-05T07:00:00+00:00', 'grid': -0.0}, {'period_start': '2024-02-05T07:30:00+00:00', 'grid': -0.0}, {'period_start': '2024-02-05T08:00:00+00:00', 'grid': 0.0}, {'period_start': '2024-02-05T08:30:00+00:00', 'grid': 0.0}, {'period_start': '2024-02-05T09:00:00+00:00', 'grid': -0.0}, {'period_start': '2024-02-05T09:30:00+00:00', 'grid': -0.0}, {'period_start': '2024-02-05T10:00:00+00:00', 'grid': 0.0}, {'period_start': '2024-02-05T10:30:00+00:00', 'grid': -0.0}, {'period_start': '2024-02-05T11:00:00+00:00', 'grid': 0.0}, {'period_start': '2024-02-05T11:30:00+00:00', 'grid': 0.0}, {'period_start': '2024-02-05T12:00:00+00:00', 'grid': -0.0}, {'period_start': '2024-02-05T12:30:00+00:00', 'grid': 0.0}, {'period_start': '2024-02-05T13:00:00+00:00', 'grid': 0.0}, {'period_start': '2024-02-05T13:30:00+00:00', 'grid': 0.0}, {'period_start': '2024-02-05T14:00:00+00:00', 'grid': -0.0}, {'period_start': '2024-02-05T14:30:00+00:00', 'grid': 0.0}, {'period_start': '2024-02-05T15:00:00+00:00', 'grid': -0.0}, {'period_start': '2024-02-05T15:30:00+00:00', 'grid': -0.0}, {'period_start': '2024-02-05T16:00:00+00:00', 'grid': -0.0}, {'period_start': '2024-02-05T16:30:00+00:00', 'grid': -0.0}, {'period_start': '2024-02-05T17:00:00+00:00', 'grid': -0.0}, {'period_start': '2024-02-05T17:30:00+00:00', 'grid': 0.0}, {'period_start': '2024-02-05T18:00:00+00:00', 'grid': -0.0}, {'period_start': '2024-02-05T18:30:00+00:00', 'grid': 598.0}, {'period_start': '2024-02-05T19:00:00+00:00', 'grid': 1595.0}, {'period_start': '2024-02-05T19:30:00+00:00', 'grid': 1100.0}, {'period_start': '2024-02-05T20:00:00+00:00', 'grid': 385.0}, {'period_start': '2024-02-05T20:30:00+00:00', 'grid': 522.0}, {'period_start': '2024-02-05T21:00:00+00:00', 'grid': 770.0}, {'period_start': '2024-02-05T21:30:00+00:00', 'grid': 522.0}, {'period_start': '2024-02-05T22:00:00+00:00', 'grid': 605.0}, {'period_start': '2024-02-05T22:30:00+00:00', 'grid': 495.0}, {'period_start': '2024-02-05T23:00:00+00:00', 'grid': 357.0}, {'period_start': '2024-02-05T23:30:00+00:00', 'grid': 385.0}], 'consumption': [{'period_start': '2024-02-04T15:30:00+00:00', 'consumption': 137.5}, {'period_start': '2024-02-04T16:00:00+00:00', 'consumption': 220.0}, {'period_start': '2024-02-04T16:30:00+00:00', 'consumption': 293.33}, {'period_start': '2024-02-04T17:00:00+00:00', 'consumption': 1017.5}, {'period_start': '2024-02-04T17:30:00+00:00', 'consumption': 1430.0}, {'period_start': '2024-02-04T18:00:00+00:00', 'consumption': 1127.5}, {'period_start': '2024-02-04T18:30:00+00:00', 'consumption': 1512.5}, {'period_start': '2024-02-04T19:00:00+00:00', 'consumption': 1155.0}, {'period_start': '2024-02-04T19:30:00+00:00', 'consumption': 1320.0}, {'period_start': '2024-02-04T20:00:00+00:00', 'consumption': 165.0}, {'period_start': '2024-02-04T20:30:00+00:00', 'consumption': 192.5}, {'period_start': '2024-02-04T21:00:00+00:00', 'consumption': 660.0}, {'period_start': '2024-02-04T21:30:00+00:00', 'consumption': 412.5}, {'period_start': '2024-02-04T22:00:00+00:00', 'consumption': 715.0}, {'period_start': '2024-02-04T22:30:00+00:00', 'consumption': 385.0}, {'period_start': '2024-02-04T23:00:00+00:00', 'consumption': 357.5}, {'period_start': '2024-02-04T23:30:00+00:00', 'consumption': 385.0}, {'period_start': '2024-02-05T00:00:00+00:00', 'consumption': 495.0}, {'period_start': '2024-02-05T00:30:00+00:00', 'consumption': 1457.5}, {'period_start': '2024-02-05T01:00:00+00:00', 'consumption': 3025.0}, {'period_start': '2024-02-05T01:30:00+00:00', 'consumption': 4400.0}, {'period_start': '2024-02-05T02:00:00+00:00', 'consumption': 3850.0}, {'period_start': '2024-02-05T02:30:00+00:00', 'consumption': 1402.5}, {'period_start': '2024-02-05T03:00:00+00:00', 'consumption': 990.0}, {'period_start': '2024-02-05T03:30:00+00:00', 'consumption': 110.0}, {'period_start': '2024-02-05T04:00:00+00:00', 'consumption': 137.5}, {'period_start': '2024-02-05T04:30:00+00:00', 'consumption': 440.0}, {'period_start': '2024-02-05T05:00:00+00:00', 'consumption': 495.0}, {'period_start': '2024-02-05T05:30:00+00:00', 'consumption': 412.5}, {'period_start': '2024-02-05T06:00:00+00:00', 'consumption': 110.0}, {'period_start': '2024-02-05T06:30:00+00:00', 'consumption': 110.0}, {'period_start': '2024-02-05T07:00:00+00:00', 'consumption': 247.5}, {'period_start': '2024-02-05T07:30:00+00:00', 'consumption': 467.5}, {'period_start': '2024-02-05T08:00:00+00:00', 'consumption': 1100.0}, {'period_start': '2024-02-05T08:30:00+00:00', 'consumption': 1017.5}, {'period_start': '2024-02-05T09:00:00+00:00', 'consumption': 825.0}, {'period_start': '2024-02-05T09:30:00+00:00', 'consumption': 742.5}, {'period_start': '2024-02-05T10:00:00+00:00', 'consumption': 302.5}, {'period_start': '2024-02-05T10:30:00+00:00', 'consumption': 440.0}, {'period_start': '2024-02-05T11:00:00+00:00', 'consumption': 275.0}, {'period_start': '2024-02-05T11:30:00+00:00', 'consumption': 412.5}, {'period_start': '2024-02-05T12:00:00+00:00', 'consumption': 522.5}, {'period_start': '2024-02-05T12:30:00+00:00', 'consumption': 632.5}, {'period_start': '2024-02-05T13:00:00+00:00', 'consumption': 192.5}, {'period_start': '2024-02-05T13:30:00+00:00', 'consumption': 577.5}, {'period_start': '2024-02-05T14:00:00+00:00', 'consumption': 797.5}, {'period_start': '2024-02-05T14:30:00+00:00', 'consumption': 302.5}, {'period_start': '2024-02-05T15:00:00+00:00', 'consumption': 2227.5}, {'period_start': '2024-02-05T15:30:00+00:00', 'consumption': 2447.5}, {'period_start': '2024-02-05T16:00:00+00:00', 'consumption': 2200.0}, {'period_start': '2024-02-05T16:30:00+00:00', 'consumption': 623.33}, {'period_start': '2024-02-05T17:00:00+00:00', 'consumption': 907.5}, {'period_start': '2024-02-05T17:30:00+00:00', 'consumption': 1430.0}, {'period_start': '2024-02-05T18:00:00+00:00', 'consumption': 1017.5}, {'period_start': '2024-02-05T18:30:00+00:00', 'consumption': 1952.5}, {'period_start': '2024-02-05T19:00:00+00:00', 'consumption': 1595.0}, {'period_start': '2024-02-05T19:30:00+00:00', 'consumption': 1100.0}, {'period_start': '2024-02-05T20:00:00+00:00', 'consumption': 385.0}, {'period_start': '2024-02-05T20:30:00+00:00', 'consumption': 522.5}, {'period_start': '2024-02-05T21:00:00+00:00', 'consumption': 770.0}, {'period_start': '2024-02-05T21:30:00+00:00', 'consumption': 522.5}, {'period_start': '2024-02-05T22:00:00+00:00', 'consumption': 605.0}, {'period_start': '2024-02-05T22:30:00+00:00', 'consumption': 495.0}, {'period_start': '2024-02-05T23:00:00+00:00', 'consumption': 357.5}, {'period_start': '2024-02-05T23:30:00+00:00', 'consumption': 385.0}], 'cost': [{'period_start': '2024-02-04T00:00:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-04T00:30:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-04T01:00:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-04T01:30:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-04T02:00:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-04T02:30:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-04T03:00:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-04T03:30:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-04T04:00:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-04T04:30:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-04T05:00:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-04T05:30:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-04T06:00:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-04T06:30:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-04T07:00:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-04T07:30:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-04T08:00:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-04T08:30:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-04T09:00:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-04T09:30:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-04T10:00:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-04T10:30:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-04T11:00:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-04T11:30:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-04T12:00:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-04T12:30:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-04T13:00:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-04T13:30:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-04T14:00:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-04T14:30:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-04T15:00:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-04T15:30:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-04T16:00:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-04T16:30:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-04T17:00:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-04T17:30:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-04T18:00:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-04T18:30:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-04T19:00:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-04T19:30:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-04T20:00:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-04T20:30:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-04T21:00:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-04T21:30:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-04T22:00:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-04T22:30:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-04T23:00:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-04T23:30:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-05T00:00:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-05T00:30:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-05T01:00:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-05T01:30:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-05T02:00:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-05T02:30:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-05T03:00:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-05T03:30:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-05T04:00:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-05T04:30:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-05T05:00:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-05T05:30:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-05T06:00:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-05T06:30:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-05T07:00:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-05T07:30:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-05T08:00:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-05T08:30:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-05T09:00:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-05T09:30:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-05T10:00:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-05T10:30:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-05T11:00:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-05T11:30:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-05T12:00:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-05T12:30:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-05T13:00:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-05T13:30:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-05T14:00:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-05T14:30:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-05T15:00:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-05T15:30:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-05T16:00:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-05T16:30:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-05T17:00:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-05T17:30:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-05T18:00:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-05T18:30:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-05T19:00:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-05T19:30:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-05T20:00:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-05T20:30:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-05T21:00:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-05T21:30:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-05T22:00:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-05T22:30:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-05T23:00:00+00:00', 'cumulative_cost': nan}, {'period_start': '2024-02-05T23:30:00+00:00', 'cumulative_cost': nan}]}}
2024-02-04 15:31:51.338351 WARNING HASS: Code: 400, error: {"message":"Invalid JSON specified."}

Additional context

$ curl -u <<api>> https://api.octopus.energy/v1/products/OUTGOING-LITE-FIX-12M-23-09-12/electricity-tariffs/E-1R-OUTGOING-LITE-FIX-12M-23-09-12-F/standard-unit-rates/ | jq .
{
  "count": 1,
  "next": null,
  "previous": null,
  "results": [
    {
      "value_exc_vat": 8,
      "value_inc_vat": 8,
      "valid_from": "2023-09-11T23:00:00Z",
      "valid_to": null,
      "payment_method": null
    }
  ]
}

Charging time slots not aligned to cheapest

Version 3.4.5 B2.
This may be desired behaviour and me not understanding things or my setup isn't correct!

Parameter setup and output:
image

Todays negative Octopus Agile slots (they pay us for usage) would be the optimal charging time slots, however the Charging Plan doesn't seem to align. Similarly with SOC being 100% a lot of the time. Is the Opt Plan to run off battery and top up during cheap rates based on historic load pattern? Wondering if this usage pattern isn't correct as our usage can be sporadic although we try to shift loads to cheap night rates (just off Eco7 tariff).

Octopus Rates card highlights cheapest slots for a target charge pattern:
image

I'll keep looking at the Opt Plan outputs and tweak parameters to see how it behaves in ReadOnly mode.

Merry Christmas!

Stuck on โ€˜Loading Tariffsโ€™

Describe the bug
My setup appears to always be stuck on โ€˜Loading Tarrifsโ€™ , which is presumably why some sensors are also missing.

To Reproduce
Steps to reproduce the behavior:
Log File -

T23:00
29-01-2024
28-01-2024
27-01-2024
26-01-2024
25-01-2024
24-01-2024
23-01-2024
22-01-2024
29-01-2024
28-01-2024
27-01-2024
26-01-2024
25-01-2024
24-01-2024
23-01-2024
22-01-2024
2024-01-28 19:44:08.960443 INFO pv_opt:
2024-01-28 19:44:08.961274 INFO pv_opt: Retrieved day ahead forecast for period 21/01 23:00 - 29/01 22:00 for tariff E-1R-AGILE-FLEX-22-11-25-N
2024-01-28 19:44:09.002330 WARNING pv_opt: ------------------------------------------------------------
2024-01-28 19:44:09.002452 WARNING pv_opt: Unexpected error running initialize() for pv_opt
2024-01-28 19:44:09.002521 WARNING pv_opt: ------------------------------------------------------------
2024-01-28 19:44:09.003181 WARNING pv_opt: Traceback (most recent call last):
File "/usr/lib/python3.11/site-packages/appdaemon/app_management.py", line 162, in initialize_app
await utils.run_in_executor(self, init)
File "/usr/lib/python3.11/site-packages/appdaemon/utils.py", line 304, in run_in_executor
response = future.result()
^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/homeassistant/appdaemon/apps/pv_opt/pv_opt.py", line 292, in initialize
self._compare_tariffs()
File "/homeassistant/appdaemon/apps/pv_opt/pv_opt.py", line 1923, in _compare_tariffs
opt = self.pv_system.optimised_force(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/homeassistant/appdaemon/apps/pv_opt/pvpy.py", line 614, in optimised_force
max_slot = import_cost[import_cost == max_import_cost].index[0]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
File "/usr/lib/python3.11/site-packages/pandas/core/indexes/base.py", line 5366, in getitem
return getitem(key)
^^^^^^^^^^^^
IndexError: index 0 is out of bounds for axis 0 with size 0

2024-01-28 19:44:09.003267 WARNING pv_opt: ------------------------------------------------------------
2024-01-28 22:34:23.446573 WARNING AppDaemon: Excessive time spent in utility loop: 2235.0ms, 1.0ms in check_app_updates(), 2234.0ms in other

Expected behavior
I had presumed that setting my local Tariff codes and my API / account details etc into AppDaemon would have this running smoothly, but it seems not. Hasnโ€™t worked yet.

Screenshots

IMG_5748
IMG_5749

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

PV_OPT starts ignoring parameters

Describe the bug

In: /homeassistant/appdaemon/apps/pv_opt/config/config.yaml

I have : consumption_history_days: 5

========================================

Plant parameters

========================================

All parameters can be a number or point to an entity UNLESS they start with 'id_'. All of

these are required but will be defaulted if not specified

battery_capacity_wh: 5000
inverter_efficiency_percent: 97 # Default: 97

charger_efficiency_percent: 91 # Default: 91

maximum_dod_percent: 15

charger_power_watts: 3600
inverter_power_watts: 3600

inverter_loss_watts: 100

switch.pvopt_read_only: off
switch.pvopt_allow_cyclic: on

However when PV_OPT starts on the dashboard I find:
switch.pvopt_read_only: on
switch.pvopt_allow_cyclic: off
charger_power_watts: 3000
battery_capacity_wh: 10000

To Reproduce
Steps to reproduce the behavior:
restart appdaemon / HA

Expected behavior
PV_OPT / AppDaemon to pick up the parameters correctly

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):
App and Browser too

Discharge slots take estimated consumption into consideration ?

When I have a bit more time I will add some logs / screenshots but for context I am only using it in read only mode at the moment and using my own automations.
What I am seeing though for discharge slots is that it will schedule a slot during peak Import/Export costs at 4PM at full power (6000w). Because it doesn't appear to take the consumption into account this means it will drain my battery before the peak finishes at 7PM.
Is this intended ?
Thanks
Mark

AppDaemon Install Issue

In section 10. Install AppDaemon, para 1. the button to click to install doesn't seem to be visible to me. I've also tried finding AppDaemon in HACS and can't seem to find it there either.

image

The MQTT button is present though

image

Desktop (please complete the following information):

  • Windows
  • Opera One
  • Version 106.0.4998.19)

AppDaemon initialization error

New setup, not sure how to reproduce - on appdaemon I'm seeing with 3.5.2

2024-01-25 19:52:32.001905 WARNING pv_opt: ------------------------------------------------------------
2024-01-25 19:52:32.002290 WARNING pv_opt: Unexpected error running initialize() for pv_opt
2024-01-25 19:52:32.002418 WARNING pv_opt: ------------------------------------------------------------
2024-01-25 19:52:32.005096 WARNING pv_opt: Traceback (most recent call last):
File "/usr/lib/python3.11/site-packages/appdaemon/app_management.py", line 162, in initialize_app
await utils.run_in_executor(self, init)
File "/usr/lib/python3.11/site-packages/appdaemon/utils.py", line 304, in run_in_executor
response = future.result()
^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/homeassistant/appdaemon/apps/pv_opt/pv_opt.py", line 292, in initialize
self._compare_tariffs()
File "/homeassistant/appdaemon/apps/pv_opt/pv_opt.py", line 1879, in _compare_tariffs
consumption = self.load_consumption(start, end)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/homeassistant/appdaemon/apps/pv_opt/pv_opt.py", line 1866, in load_consumption
x = temp.to_numpy() + y.to_numpy()
~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
ValueError: operands could not be broadcast together with shapes (48,) (13,)

2024-01-25 19:52:32.006090 WARNING pv_opt: ------------------------------------------------------------
2024-01-25 19:52:32.006778 INFO AppDaemon: App initialization complete

As a result pvopt sensors are missing

image

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

Flux charging periods seem to be ignored in favour of peak rate charging

Describe the bug

Octopus flux customer, cheap rates between 02:00 and 05:00 daily.

PV_OPT seems to be wanting to charge 3500W between 00:00 and 00:30 at a higher rate, rather than wait for the cheap period at 02:00

Expected behavior
I would have thought the optimum approach on Flux to be to consume from the grid when the battery is discharged until the cheaper period starts at 02:00.

Screenshots

pv_opt

Additional context
Logs:
pv_opt.log

pv_opt config:

# Internal configuration --- DO NOT EDIT ---
pvpy:
  module: pvpy
  global: true

inverters:
  module: inverters
  global: true

pv_opt:
  module: pv_opt
  class: PVOpt
  log: pv_opt_log
  prefix: pvopt
  inverter_type: "SOLIS_SOLAX_MODBUS"
  # inverter_type: "SOLIS_CORE_MODBUS"

  # User configuration ---  EDIT AWAY! ---

  # ========================================
  # Plant parameters
  # ========================================

  # All parameters can be a number or point to an entity UNLESS they start with 'id_'. All of
  # these are required but will be defaulted if not specified

  battery_capacity_Wh: 9400
  # inverter_efficiency_percent: 97 # Default: 97
  # charger_efficiency_percent: 91 # Default: 91
  maximum_dod_percent: 12
  charger_power_watts: 3500
  inverter_power_watts: 5000
  # inverter_loss_watts: 100
  battery_voltage: sensor.solis_battery_voltage
  
  # ========================================
  # Solcast configuration
  # ========================================
  #
  # id_solcast_today: sensor.solcast_pv_forecast_forecast_today
  # id_solcast_tomorrow: sensor.solcast_pv_forecast_forecast_tomorrow

  # ========================================
  # Solar and consumption forecast parameters
  # ========================================
  #
  # Valid options are:
  #
  # Solcast         - the Solcast mid-case forecast [Default]
  # Solcast_p90     - the Solcast high estimate
  # Solcast_p10     - the Solcast high estimate
  #
  # Set this using an "input_select" helper and it can be varied on the fly

  # solar_forecast:
  # - input_select.solar_forecast_source
  #   - Solcast

  # # consumption estimation
  # consumption_history_days:
  #   - 7
  # consumption_margin:
  #   - input_number.solar_opt_consumption_margin
  #  
  # ========================================
  # Octopus account parameters
  # ========================================

  octopus_auto: True # Read tariffs from the Octopus Energy integration. If successful this over-rides the following parameters

  octopus_account: !secret octopus_account
  octopus_api_key: !secret octopus_api_key

  # The following Can be omitted if either of the above options is working correctly:

  octopus_import_tariff_code: E-1R-FLUX-IMPORT-23-02-14-A
  octopus_export_tariff_code: E-1R-FLUX-EXPORT-23-02-14-A

  # octopus_import_tariff_code: E-1R-FLUX-IMPORT-23-02-14-G
  # octopus_export_tariff_code: E-1R-FLUX-EXPORT-23-02-14-G
  
  # ===============================================================================================================
  # Brand / Integration Specific Config: SOLIS_SOLAX_MODBUS: https://github.com/wills106/homeassistant-solax-modbus
  # ===============================================================================================================
  #
  # These are the default entities used with the Solis Solax Modbus integration. You can change them here and over-ride the defaults

  battery_voltage: sensor.solis_battery_voltage

  id_consumption:
    - sensor.solis_house_load
    - sensor.solis_bypass_load

  id_battery_soc: sensor.solis_battery_soc
  id_timed_charge_start_hours: number.solis_timed_charge_start_hours
  id_timed_charge_start_minutes: number.solis_timed_charge_start_minutes
  id_timed_charge_end_hours: number.solis_timed_charge_end_hours
  id_timed_charge_end_minutes: number.solis_timed_charge_end_minutes
  id_timed_charge_current: number.solis_timed_charge_current

  id_timed_discharge_start_hours: number.solis_timed_discharge_start_hours
  id_timed_discharge_start_minutes: number.solis_timed_discharge_start_minutes
  id_timed_discharge_end_hours: number.solis_timed_discharge_end_hours
  id_timed_discharge_end_minutes: number.solis_timed_discharge_end_minutes
  id_timed_discharge_current: number.solis_timed_discharge_current

  id_timed_charge_discharge_button: button.solis_update_charge_discharge_times
  id_inverter_mode: select.solis_energy_storage_control_switch

  # ==============================================================================================================
  # Brand / Integration Specific Config: SOLIS_CORE_MODBUS: https://github.com/fboundy/ha_solis_modbus
  # ==============================================================================================================
  #
  # These are the default entities used with the Solis Core Modbus integration. You can change them here and over-ride the defaults

  # modbus_hub: solis
  # modbus_slave: 1
  # battery_voltage: sensor.solis_battery_voltage
  # maximum_dod_percent: sensor.solis_overdischarge_soc
  #
  # id_consumption:
  #   - sensor.solis_house_load_power
  #   - ensor.solis_backup_load_power

  # id_grid_power: sensor.solis_grid_active_power
  # id_inverter_ac_power": sensor.solis_inverter_ac_power
  # id_battery_soc: sensor.solis_battery_soc

  # id_timed_charge_start_hours: sensor.solis_timed_charge_start_hour
  # id_timed_charge_start_minutes: sensor.solis_timed_charge_start_minute
  # id_timed_charge_end_hours: sensor.solis_timed_charge_end_hour
  # id_timed_charge_end_minutes: sensor.solis_timed_charge_end_minute
  # id_timed_charge_current: sensor.solis_timed_charge_current_limit

  # id_timed_discharge_start_hours: sensor.solis_timed_discharge_start_hour
  # id_timed_discharge_start_minutes: sensor.solis_timed_discharge_start_minute
  # id_timed_discharge_end_hours: sensor.solis_timed_discharge_end_hour
  # id_timed_discharge_end_minutes: sensor.solis_timed_discharge_end_minute
  # id_timed_discharge_current: sensor.solis_timed_discharge_current_limit

  # id_timed_charge_discharge_button: button.solis_update_charge_discharge_times
  # id_inverter_mode: select.solis_energy_storage_control_switch

AttributeError: 'NoneType' object has no attribute 'name'

Home Assistant Core: 2023.12.4
Home Assistant Supervisor: 2023.12.0
AppDaemon Add-on version: 0.16.0
Solax Modbus Integration

PVOpt results in an initialize_error. Here is the log. Any advice is greatly appreciated.
log:

AttributeError: 'NoneType' object has no attribute 'name'
^^^^^^
self.log(f" {imp_exp.title()}: {t.name}")
File "/homeassistant/appdaemon/apps/pv_opt/pv_opt.py", line 648, in _load_contract
self._load_contract()
File "/homeassistant/appdaemon/apps/pv_opt/pv_opt.py", line 288, in initialize
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
result = self.fn(*self.args, **self.kwargs)
File "/usr/lib/python3.11/concurrent/futures/thread.py", line 58, in run
^^^^^^^^^^^^^^^

Not loading custom tariff correctly

Describe the bug
Not loading custom

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

Unexpected error running initialize() for pv_opt

I'm terribly sorry, been trying to work out in the past two days what's going on, but now I'm at loss...

On version 3.6.0 and as far as loading data everything looks just fine:

20:08:33 INFO: ******************* PV Opt v3.6.0 *******************
20:08:33 INFO:
20:08:33 INFO: Local timezone set to GB
20:08:33 INFO: Time Zone Offset: 0.0 minutes
20:08:33 INFO: Inverter type: SOLIS_SOLAX_MODBUS: inverter module: solis.py
20:08:33 INFO: Reading arguments from YAML:
20:08:33 INFO: -----------------------------------
20:08:33 INFO: consumption_history_days = 2 2: value in YAML
20:08:33 INFO: battery_capacity_wh = 5000 5000: value in YAML
20:08:33 INFO: charger_power_watts = 3600 3600: value in YAML
20:08:33 INFO: inverter_power_watts = 3600 3600: value in YAML
20:08:33 INFO: id_solcast_today = sensor.solcast_pv_forecast_forecast_today 0.0: value(s) in YAML
20:08:33 INFO: id_solcast_tomorrow = sensor.solcast_pv_forecast_forecast_tomorrow 1.53035: value(s) in YAML
20:08:33 WARNING: consumption_margin = 10 10: system default. Unable to read from HA entities listed in YAML. No default in YAML.
20:08:33 INFO: octopus_account = ************* ******** YAML default value. No default defined.
20:08:33 INFO: octopus_api_key = ************************ s*********************: YAML default value. No default defined.
20:08:33 INFO: battery_voltage = sensor.solis_battery_voltage 52.1: value in YAML
20:08:33 INFO: update_cycle_seconds = 15 15: value in YAML
20:08:33 INFO: maximum_dod_percent = number.solis_battery_minimum_soc 15.0: value in YAML
20:08:33 INFO: id_consumption_today = sensor.solis_house_load_today 22.6: value(s) in YAML
20:08:33 INFO: id_grid_import_today = sensor.solis_grid_import_today 19.2: value(s) in YAML
20:08:33 INFO: id_grid_export_today = sensor.solis_grid_export_today 0.3: value(s) in YAML
20:08:33 INFO: id_battery_soc = sensor.solis_battery_soc 15.0: value(s) in YAML
20:08:33 INFO: id_timed_charge_start_hours = number.solis_timed_charge_start_hours 20.0: value(s) in YAML
20:08:33 INFO: id_timed_charge_start_minutes = number.solis_timed_charge_start_minutes 30.0: value(s) in YAML
20:08:33 INFO: id_timed_charge_end_hours = number.solis_timed_charge_end_hours 21.0: value(s) in YAML
20:08:33 INFO: id_timed_charge_end_minutes = number.solis_timed_charge_end_minutes 0.0: value(s) in YAML
20:08:33 INFO: id_timed_charge_current = number.solis_timed_charge_current 30.0: value(s) in YAML
20:08:33 INFO: id_timed_discharge_start_hours = number.solis_timed_discharge_start_hours 0.0: value(s) in YAML
20:08:33 INFO: id_timed_discharge_start_minutes = number.solis_timed_discharge_start_minutes 0.0: value(s) in YAML
20:08:33 INFO: id_timed_discharge_end_hours = number.solis_timed_discharge_end_hours 0.0: value(s) in YAML
20:08:33 INFO: id_timed_discharge_end_minutes = number.solis_timed_discharge_end_minutes 0.0: value(s) in YAML
20:08:33 INFO: id_timed_discharge_current = number.solis_timed_discharge_current 60.0: value(s) in YAML
20:08:33 INFO: id_timed_charge_discharge_button = button.solis_update_charge_discharge_times 2024-02-01T16:30:20.738670+00:00: value(s) in YAML
20:08:33 INFO: id_inverter_mode = select.solis_energy_storage_control_switch Timed Charge/Discharge: value(s) in YAML
20:08:33 INFO: id_daily_solar = sensor.solis_power_generation_today 2.9: value(s) in YAML
20:08:33 INFO:
20:08:33 INFO: Checking config:
20:08:33 INFO: -----------------------
20:08:33 WARNING: forced_charge = True True: system default. Not in YAML.
20:08:33 WARNING: forced_discharge = True True: system default. Not in YAML.
20:08:33 WARNING: read_only = True True: system default. Not in YAML.
20:08:33 WARNING: allow_cyclic = False False: system default. Not in YAML.
20:08:33 WARNING: optimise_frequency_minutes = 10 10: system default. Not in YAML.
20:08:33 WARNING: slot_threshold_p = 1.0 1.0: system default. Not in YAML.
20:08:33 WARNING: day_of_week_weighting = 0.5 0.5: system default. Not in YAML.
20:08:33 WARNING: pass_threshold_p = 4.0 4.0: system default. Not in YAML.
20:08:33 WARNING: octopus_auto = True True: system default. Not in YAML.
20:08:33 WARNING: inverter_efficiency_percent = 97 97: system default. Not in YAML.
20:08:33 WARNING: charger_efficiency_percent = 91 91: system default. Not in YAML.
20:08:33 WARNING: inverter_loss_watts = 100 100: system default. Not in YAML.
20:08:33 WARNING: solar_forecast = Solcast Solcast: system default. Not in YAML.
20:08:33 WARNING: consumption_grouping = mean mean: system default. Not in YAML.
20:08:33 WARNING: forced_power_group_tolerance = 100 100: system default. Not in YAML.
20:08:33 WARNING: id_battery_charge_power = sensor.solis_battery_input_energy 0.0: system default. Not in YAML.
20:08:33 WARNING: id_inverter_ac_power = sensor.solis_active_power -90.0: system default. Not in YAML.
20:08:33 WARNING: supports_hold_soc = True True: system default. Not in YAML.
20:08:33 WARNING: id_backup_mode_soc = number.solis_backup_mode_soc 100.0: system default. Not in YAML.
20:08:33 INFO:
20:08:33 INFO: Syncing config with Home Assistant:
20:08:33 INFO: -----------------------------------
20:08:33 INFO:
20:08:33 INFO: Config Item HA Entity Current State
20:08:33 INFO: ----------- --------- -------------
20:08:33 INFO: forced_charge switch.pvopt_forced_charge on
20:08:33 INFO: forced_discharge switch.pvopt_forced_discharge on
20:08:33 INFO: read_only switch.pvopt_read_only on
20:08:33 INFO: allow_cyclic switch.pvopt_allow_cyclic off
20:08:33 INFO: optimise_frequency_minutes number.pvopt_optimise_frequency_minutes 10
20:08:33 INFO: slot_threshold_p number.pvopt_slot_threshold_p 1.0
20:08:33 INFO: day_of_week_weighting number.pvopt_day_of_week_weighting 0.5
20:08:33 INFO: pass_threshold_p number.pvopt_pass_threshold_p 4.0
20:08:33 INFO: battery_capacity_wh number.pvopt_battery_capacity_wh 5000
20:08:33 INFO: inverter_efficiency_percent number.pvopt_inverter_efficiency_percent 97
20:08:33 INFO: charger_efficiency_percent number.pvopt_charger_efficiency_percent 91
20:08:33 INFO: charger_power_watts number.pvopt_charger_power_watts 3600
20:08:33 INFO: inverter_power_watts number.pvopt_inverter_power_watts 3600
20:08:33 INFO: inverter_loss_watts number.pvopt_inverter_loss_watts 100
20:08:33 INFO: solar_forecast select.pvopt_solar_forecast Solcast
20:08:33 INFO: consumption_history_days number.pvopt_consumption_history_days 2
20:08:33 INFO: consumption_margin number.pvopt_consumption_margin 10
20:08:33 INFO: consumption_grouping select.pvopt_consumption_grouping mean
20:08:33 INFO: forced_power_group_tolerance number.pvopt_forced_power_group_tolerance 100
20:08:33 INFO:
20:08:33 INFO: Loading Contract:
20:08:33 INFO: -----------------
20:08:33 INFO: Trying to auto detect Octopus tariffs:
20:08:33 INFO: Found import entity event.octopus_energy_electricity_current_day_rates
20:08:33 INFO: Found export entity event.octopus_energy_electricity
export_current_day_rates
20:08:34 INFO: Contract tariffs loaded OK
20:08:34 INFO: Import: E-1R-AGILE-FLEX-22-11-25-N Start: 2024-01-23 13:00:00+0000 End: 2024-02-02 23:00:00+0000
20:08:34 INFO: Export: E-1R-OUTGOING-FIX-12M-19-05-13-N Start: 2019-05-15 23:00:00+0000 End: N/A
20:08:34 INFO: AGILE tariff detected. Rates will update at 16:00 daily
20:08:34 INFO:
20:08:34 INFO:
20:08:34 INFO: Found Octopus Savings Events entity: event.octopus_energy_a
******_octoplus_saving_session_events
20:08:34 INFO:
20:08:34 INFO: No upcoming Octopus Saving Events detected or joined:
20:08:34 INFO: Finished loading contract
20:08:34 INFO:
20:08:34 INFO: Running initial Optimisation:
20:08:34 INFO:
20:08:34 INFO:
20:08:34 INFO: Found Octopus Savings Events entity: event.octopus_energy_a_a2720466_octoplus_saving_session_events
20:08:34 INFO:
20:08:34 INFO: No upcoming Octopus Saving Events detected or joined:
20:08:34 INFO:
20:08:34 INFO: Starting Opimisation with discharge enabled
20:08:34 INFO: -------------------------------------------
20:08:34 INFO:
20:08:34 INFO: Checking tariffs:
20:08:34 INFO: -----------------
20:08:34 INFO: Import: E-1R-AGILE-FLEX-22-11-25-N Start: 2024-01-23 13:00:00+0000 End: 2024-02-02 23:00:00+0000
20:08:34 INFO: Export: E-1R-OUTGOING-FIX-12M-19-05-13-N Start: 2019-05-15 23:00:00+0000 End: N/A
20:08:34 INFO: AGILE tariff detected. Rates will update at 16:00 daily
20:08:34 INFO: - Tariffs OK
20:08:34 INFO:
20:08:34 INFO: Solcast forecast loaded OK
20:08:34 INFO: Getting expected consumption data
20:08:34 INFO: - Estimated consumption from sensor.solis_house_load_today loaded OK
20:08:34 INFO: Initial SOC: 15.0
20:08:34 INFO: Calculating Base flows
20:08:35 INFO:
20:08:35 INFO: Retrieved day ahead forecast for period 25/01 23:00 - 02/02 22:00 for tariff E-1R-AGILE-FLEX-22-11-25-N
20:09:34 INFO: >>> Agile Callback Handler

and on the error log I see

20:08:35 WARNING pv_opt: ------------------------------------------------------------
20:08:35 WARNING pv_opt: Unexpected error running initialize() for pv_opt
20:08:35 WARNING pv_opt: ------------------------------------------------------------
20:08:35 WARNING pv_opt: Traceback (most recent call last):
File "/usr/lib/python3.11/site-packages/appdaemon/app_management.py", line 162, in initialize_app
await utils.run_in_executor(self, init)
File "/usr/lib/python3.11/site-packages/appdaemon/utils.py", line 304, in run_in_executor
response = future.result()
^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/homeassistant/appdaemon/apps/pv_opt/pv_opt.py", line 321, in initialize
self.optimise()
File "/usr/lib/python3.11/site-packages/appdaemon/adbase.py", line 35, in f_app_lock
return f(*args, **kw)
^^^^^^^^^^^^^^
File "/homeassistant/appdaemon/apps/pv_opt/pv_opt.py", line 1322, in optimise
self.base_cost = self.contract.net_cost(self.base)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/homeassistant/appdaemon/apps/pv_opt/pvpy.py", line 442, in net_cost
imp_df = self.imp.to_df(start, end, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/homeassistant/appdaemon/apps/pv_opt/pvpy.py", line 230, in to_df
newindex = pd.date_range(x.index[0], df.index[-1], freq="30T")
~~~~~~~~^^^^
File "/usr/lib/python3.11/site-packages/pandas/core/indexes/base.py", line 5385, in getitem
return getitem(key)
^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/pandas/core/arrays/datetimelike.py", line 379, in getitem
result = cast("Union[Self, DTScalarOrNaT]", super().getitem(key))
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/pandas/core/arrays/_mixins.py", line 284, in getitem
result = self._ndarray[key]
~~~~~~~~~~~~~^^^^^
IndexError: index -1 is out of bounds for axis 0 with size 0

20:08:35 WARNING pv_opt: ------------------------------------------------------------

Tried deleting and reinstalling PV OPT unfortunately no difference...

Syntax error reported in pv_opt.py

Describe the bug
Installation issue - syntax error reported in pv_opt.py in appdaemon

To Reproduce
File "/homeassistant/appdaemon/apps/pv_opt/pv_opt.py", line 1693
"device_class": "current", elif status["hold_soc"]["active"]:
^^^^
SyntaxError: invalid syntax

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
Appdaemon log:

**s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
[22:29:42] INFO: Starting AppDaemon...
2023-12-20 22:29:59.139450 INFO AppDaemon: AppDaemon Version 4.4.2 starting
2023-12-20 22:29:59.151233 INFO AppDaemon: Python version is 3.11.6
2023-12-20 22:29:59.151946 INFO AppDaemon: Configuration read from: /config/appdaemon.yaml
2023-12-20 22:29:59.158058 INFO AppDaemon: Added log: AppDaemon
2023-12-20 22:29:59.162242 INFO AppDaemon: Added log: Error
2023-12-20 22:29:59.162727 INFO AppDaemon: Added log: Access
2023-12-20 22:29:59.163257 INFO AppDaemon: Added log: Diag
2023-12-20 22:30:00.175148 INFO AppDaemon: Loading Plugin HASS using class HassPlugin from module hassplugin
2023-12-20 22:30:01.943385 INFO HASS: HASS Plugin Initializing
2023-12-20 22:30:01.945784 WARNING HASS: ha_url not found in HASS configuration - module not initialized
2023-12-20 22:30:01.946719 INFO HASS: HASS Plugin initialization complete
2023-12-20 22:30:01.947356 INFO AppDaemon: Loading Plugin MQTT using class MqttPlugin from module mqttplugin
2023-12-20 22:30:02.460542 INFO MQTT: MQTT Plugin Initializing
2023-12-20 22:30:02.465088 INFO MQTT: Using 'localad/status' as Will Topic
2023-12-20 22:30:02.465522 INFO MQTT: Using 'localad/status' as Birth Topic
2023-12-20 22:30:02.466390 INFO AppDaemon: HTTP is disabled
2023-12-20 22:30:02.574689 INFO HASS: Connected to Home Assistant 2023.12.3
2023-12-20 22:30:02.815610 INFO MQTT: Connected to Broker at URL core-mosquitto:1883
2023-12-20 22:30:02.833793 INFO AppDaemon: App 'pv_opt' added
2023-12-20 22:30:02.852074 INFO AppDaemon: Found 1 active apps
2023-12-20 22:30:02.854388 INFO AppDaemon: Found 0 inactive apps
2023-12-20 22:30:02.855243 INFO AppDaemon: Found 2 global libraries
2023-12-20 22:30:02.855941 INFO AppDaemon: Starting Apps with 1 workers and 1 pins
2023-12-20 22:30:02.863263 INFO AppDaemon: Got initial state from namespace mqtt
2023-12-20 22:30:02.864894 INFO MQTT: MQTT Plugin initialization complete
2023-12-20 22:30:03.033157 INFO HASS: Evaluating startup conditions
2023-12-20 22:30:03.093516 INFO HASS: Startup condition met: hass state=RUNNING
2023-12-20 22:30:03.093816 INFO HASS: All startup conditions met
2023-12-20 22:30:08.396670 INFO AppDaemon: Got initial state from namespace default
2023-12-20 22:30:09.906098 INFO AppDaemon: Scheduler running in realtime
2023-12-20 22:30:09.915360 INFO AppDaemon: Adding /homeassistant/appdaemon/apps to module import path
2023-12-20 22:30:09.926168 INFO AppDaemon: Adding /homeassistant/appdaemon/apps/pv_opt to module import path
2023-12-20 22:30:09.934003 INFO AppDaemon: Adding /homeassistant/appdaemon/apps/pv_opt/config to module import path
2023-12-20 22:30:09.948777 WARNING AppDaemon: No app description found for: /homeassistant/appdaemon/apps/pv_opt/solis.py - ignoring
2023-12-20 22:30:09.954318 INFO AppDaemon: Loading App Module: /homeassistant/appdaemon/apps/pv_opt/pv_opt.py
2023-12-20 22:30:10.164543 WARNING Error: ------------------------------------------------------------
2023-12-20 22:30:10.175562 WARNING Error: Unexpected error loading module: /homeassistant/appdaemon/apps/pv_opt/pv_opt.py:
2023-12-20 22:30:10.178896 WARNING Error: ------------------------------------------------------------
2023-12-20 22:30:10.204897 WARNING Error: Traceback (most recent call last):
File "/usr/lib/python3.11/site-packages/appdaemon/app_management.py", line 1000, in check_app_updates
await utils.run_in_executor(self, self.read_app, mod["name"], mod["reload"])
File "/usr/lib/python3.11/site-packages/appdaemon/utils.py", line 304, in run_in_executor
response = future.result()
^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/appdaemon/app_management.py", line 783, in read_app
self.modules[module_name] = importlib.import_module(module_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1204, in _gcd_import
File "", line 1176, in _find_and_load
File "", line 1147, in _find_and_load_unlocked
File "", line 690, in _load_unlocked
File "", line 936, in exec_module
File "", line 1074, in get_code
File "", line 1004, in source_to_code
File "", line 241, in _call_with_frames_removed
File "/homeassistant/appdaemon/apps/pv_opt/pv_opt.py", line 1693
"device_class": "current", elif status["hold_soc"]["active"]:
^^^^
SyntaxError: invalid syntax

2023-12-20 22:30:10.222560 WARNING Error: ------------------------------------------------------------
2023-12-20 22:30:10.227979 WARNING AppDaemon: Removing associated apps:
2023-12-20 22:30:10.231052 WARNING AppDaemon: pv_opt
2023-12-20 22:30:10.239272 INFO AppDaemon: Loading Global Module: /homeassistant/appdaemon/apps/pv_opt/pvpy.py
2023-12-20 22:30:16.837590 WARNING AppDaemon: Unable to find app solis in dependencies for pv_opt
2023-12-20 22:30:16.844103 WARNING AppDaemon: Ignoring app pv_opt
2023-12-20 22:30:16.852981 INFO AppDaemon: Loading app pv_opt using class PVOpt from module pv_opt
2023-12-20 22:30:16.982913 WARNING pv_opt: ------------------------------------------------------------
2023-12-20 22:30:16.984007 WARNING pv_opt: Unexpected error initializing app: pv_opt:
2023-12-20 22:30:16.988236 WARNING pv_opt: ------------------------------------------------------------
2023-12-20 22:30:16.991485 WARNING pv_opt: Traceback (most recent call last):
File "/usr/lib/python3.11/site-packages/appdaemon/app_management.py", line 1035, in check_app_updates
await self.init_object(app)
File "/usr/lib/python3.11/site-packages/appdaemon/app_management.py", line 323, in init_object
modname = await utils.run_in_executor(self, import, app_args["module"])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/appdaemon/utils.py", line 304, in run_in_executor
response = future.result()
^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/homeassistant/appdaemon/apps/pv_opt/pv_opt.py", line 1693
"device_class": "current", elif status["hold_soc"]["active"]:
^^^^
SyntaxError: invalid syntax

2023-12-20 22:30:16.999102 WARNING pv_opt: ------------------------------------------------------------
2023-12-20 22:30:17.003469 WARNING AppDaemon: Unable to find module pv_opt - initialize() skipped
2023-12-20 22:30:17.005212 INFO AppDaemon: App initialization complete
2023-12-20 23:20:14.836077 WARNING AppDaemon: Excessive time spent in utility loop: 2386.0ms, 5.0ms in check_app_updates(), 2381.0ms in other**

Additional context
It may be user error on my part attempting to set this up, so any help would be greatly appreciated.

Check Charge Times and Mode - Clip and Max Charge Current

Describe the bug
The app isn't fully checking that the charge/discharge times and inverter mode are correct on each run.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

Support for DLS-W v2.2 Data Logger / Solarman

I have realised that the reason I cannot successfully install PV Opt is because my data logger is incompatible with Solax Modbus. I have a DSL-W v2.2 firmware MW3_15_0501_1.24 which works with the Solarman integration. Is it possible to incorporate support for my datalogger into your project?

Agile Price Nit Updating

Describe the bug
Agile pricing is carrying forward the previous day's pricing even though this should be updated daily at 16.00

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

energidata service for pricing

sorry its not a essue but i iam pretty new to github and can't find eny batter way to write my questes.

hey here in Danemark we use thes addon to get energy price https://github.com/MTrab/energidataservice
i can't find a way to use it on the addon withs is a shame love to try you'r andon

its not clear what you mean with
inverter_type: "SOLIS_SOLAX_MODBUS"

inverter_type: "SOLIS_CORE_MODBUS"

inverter_type: SOLIS_SOLARMAN

device_name: solis

are that just names or are it a sensor from ha?

all the unmarked ( # ) in config needs to be removed or what to do with them?

i just tried my bedst to add what i could but its not working

========================================

Octopus account parameters

========================================

octopus_auto: False # Read tariffs from the Octopus Energy integration. If successful this over-rides the following parameters

id_import_tariff: sensor.energi_data_service
id_export_tariff: sensor.energi_data_service_salg

modbus_hub: "{device_name}"

modbus_slave: 1

battery_voltage: sensor.omcma3800g_battery_voltage

maximum_dod_percent: sensor.{device_name}_overdischarge_soc

update_cycle_seconds: 60

id_consumption:

  • sensor.omcma3800g_import_from_grid

Missing entities

Hello, if you are able to provide some assistance, that would be very much appriciated. This isn't a bug I don't think, but the pvopt_dashboard.yaml has some errors for me, of which it reports these are not available:
sensor.solis_grid_import_power
sensor.solis_grid_export_power

How have you defined these? I don't seem to have them.

I'm connecting to my Solis inverter using a S2-WL-ST via:
alienatedsec RS485 to TCP
homeassistant-solax-modbus

Solax-Modbus is working fine and I manually update the charging times currently. I was on Octopus Eco7 but recently switched to Agile.

Thanks.

Hold Charge

With Flux in particular it looks like PV Opt wants to hold 100% charge until forced discharge starts.

Rather than using forced charge this could be done for some inverters (such as Solis) using Backup SOC or equivalent which would reduce interaction with the inverter.

Battery Capacity Estimation Causing Problems

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

PV_opt costs not displaying

AppDaemon Current version: 0.16.4
PV_OPT VERSION = "3.6.2"

  • PVOPT Results don't display on dashboard
  • sensor.pvopt_base_cost gives errors to display and errors in logs
  • FutureWarning: 'T' is deprecated and will be removed in a future version
  • FutureWarning: 'H' is deprecated and will be removed in a future version.

Any help appreciated. Do you need any more log files?
pv_opt.log
main.log

User configuration --- EDIT AWAY! ---

inverter_type: "SOLIS_SOLAX_MODBUS"

inverter_type: "SOLIS_CORE_MODBUS"

inverter_type: SOLIS_SOLARMAN

device_name: solis_modbus
consumption_history_days: 7

If true the current config in HA will be over-written with that in the config.yaml.

overwrite_ha_on_restart: true
redact_personal_data_from_log: true

Dashboard screenshot:
image

PV_OPT log:
I have attached the log files
01:00:02 INFO: Output written to sensor.pvopt_optimiser_elapsed
01:00:02 INFO: Average unit cost today: 0.00p/kWh
01:00:02 INFO: Output written to sensor.pvopt_unit_cost_today
01:00:02 WARNING: pv_opt: Entity sensor.pvopt_base_cost not found in namespace default
01:00:02 INFO: Output written to sensor.pvopt_base_cost
01:00:03 WARNING: pv_opt: Entity sensor.pvopt_opt_cost not found in namespace default
01:00:03 INFO: Output written to sensor.pvopt_opt_cost
01:00:03 INFO: Output written to sensor.pvopt_charge_start
01:00:03 INFO: Output written to sensor.pvopt_charge_end
01:00:03 INFO: Output written to sensor.pvopt_charge_current
01:00:03 INFO: Output written to sensor.pvopt_soc_h1
01:00:03 INFO: Output written to sensor.pvopt_soc_h4
01:00:03 INFO: Output written to sensor.pvopt_soc_h8
01:00:03 INFO: Output written to sensor.pvopt_soc_h12
01:00:03 INFO: Read only mode enabled. Not querying inverter.
01:10:00 INFO: Optimiser triggered by Scheduler

Main log
11:50:03 WARNING HASS: Error setting Home Assistant state default.sensor.pvopt_opt_cost, {'state': 0.0, 'attributes': {'friendly_name': 'PV Opt Optimised Cost', 'device_class': 'monetary', 'state_class': 'measurement', 'unit_of_measurement': 'GBP', 'cost_today': 0.0, 'cost_tomorrow': 0.0, 'soc': [{'period_start': '2024-02-06T11:30:00+00:00', 'soc': 68.5}, {'period_start': '2024-02-06T12:00:00+00:00', 'soc': .....
11:50:03 WARNING HASS: Code: 400, error: {"message":"Invalid JSON specified."}

Error log:

10:00:10 WARNING pv_opt: ------------------------------------------------------------ -- ย  TypeError: 'NoneType' object is not subscriptable ~~~~^^^ df = pd.DataFrame(hist[0]).set_index("last_updated")["state"] File "/homeassistant/appdaemon/apps/pv_opt/pv_opt.py", line 251, in hass2df ^^^^^^^^^^^^^ df = self.hass2df( File "/homeassistant/appdaemon/apps/pv_opt/pv_opt.py", line 1892, in _get_hass_power_from_daily_kwh ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ df = self._get_hass_power_from_daily_kwh( File "/homeassistant/appdaemon/apps/pv_opt/pv_opt.py", line 1922, in load_consumption ^^^^^^^^^^^^^^^^^^^^^^ consumption = self.load_consumption( File "/homeassistant/appdaemon/apps/pv_opt/pv_opt.py", line 1316, in optimise ^^^^^^^^^^^^^^ return f(*args, **kw) File "/usr/lib/python3.11/site-packages/appdaemon/adbase.py", line 35, in f_app_lock self.optimise() File "/homeassistant/appdaemon/apps/pv_opt/pv_opt.py", line 1273, in optimise_time ^^^^^^^^^^^^^^ return f(*args, **kw) File "/usr/lib/python3.11/site-packages/appdaemon/adbase.py", line 35, in f_app_lock funcref(self.AD.sched.sanitize_timer_kwargs(app, args["kwargs"])) File "/usr/lib/python3.11/site-packages/appdaemon/threading.py", line 1022, in worker 10:00:10 WARNING pv_opt: Traceback (most recent call last): 10:00:10 WARNING pv_opt: ------------------------------------------------------------ 10:00:10 WARNING pv_opt: Worker Ags: {'id': '32579a1f996144f98f30b695d2032c1f', 'name': 'pv_opt', 'objectid': '5e948e0aa1314043a069275605dad6af', 'type': 'scheduler', 'function': >, 'pin_app': True, 'pin_thread': 0, 'kwargs': {'interval': 600, '__thread_id': 'thread-0'}} 10:00:10 WARNING pv_opt: Unexpected error in worker for App pv_opt: 10:00:10 WARNING pv_opt: ------------------------------------------------------------

APPDemon log:

/homeassistant/appdaemon/apps/pv_opt/pvpy.py:209: FutureWarning: 'T' is deprecated and will be removed in a future version. Please use 'min' instead of 'T'.
df.index[-1] + pd.Timedelta("30T"),
/homeassistant/appdaemon/apps/pv_opt/pvpy.py:210: FutureWarning: 'H' is deprecated and will be removed in a future version. Please use 'h' instead of 'H'.
df.index[-1] + pd.Timedelta("24H"),
/homeassistant/appdaemon/apps/pv_opt/pvpy.py:208: FutureWarning: 'T' is
deprecated and will be removed in a future version, please use 'min' instead.
extended_index = pd.date_range(
/homeassistant/appdaemon/apps/pv_opt/pvpy.py:209: FutureWarning: 'T' is deprecated and will be removed in a future version. Please use 'min' instead of 'T'.
df.index[-1] + pd.Timedelta("30T"),
/homeassistant/appdaemon/apps/pv_opt/pvpy.py:210: FutureWarning: 'H' is deprecated and will be removed in a future version. Please use 'h' instead of 'H'.
df.index[-1] + pd.Timedelta("24H"),
/homeassistant/appdaemon/apps/pv_opt/pvpy.py:208: FutureWarning: 'T' is deprecated and will be removed in a future version, please use 'min' instead.
extended_index = pd.date_range(
/homeassistant/appdaemon/apps/pv_opt/pvpy.py:209: FutureWarning: 'T' is deprecated and will be removed in a future version. Please use 'min' instead of 'T'.
df.index[-1] + pd.Timedelta("30T"),
/homeassistant/appdaemon/apps/pv_opt/pvpy.py:210: FutureWarning: 'H' is deprecated and will be removed in a future version. Please use 'h' instead of 'H'.
df.index[-1] + pd.Timedelta("24H"),

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.