springfall2008 / batpred

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

pred_bat: ERROR: Exception raised 'NoneType' object has no attribute 'get' #527

Closed dandwhelan closed 7 months ago

dandwhelan commented 7 months ago

Describe the bug I have a new install of predbat and everytime the appdeamon processes the givenergy / agile times I get this error...

ERROR: Exception raised 'NoneType' object has no attribute 'get'

Expected behavior No error Predbat version

7.14.23

Environment details

Screenshots

Log file appdaemon.log

Can you capture a log file from the time of the issue, debug mode is not normally required. If you are not keeping the full logs then please enable this in appdaemon.yaml (see the installation instruction in the Predbat docs area for details on how to do this)

springfall2008 commented 7 months ago

I probably need the more detailed error message that you will find in 'system, settings, logs, appdeamon' to find out exactly the problem, but it seems like you might not have set your import or export rates correctly. If you don't have export you should set it to 0.

dandwhelan commented 7 months ago

Hey, this might be relevant... Does it help?

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/homeassistant/appdaemon/apps/batpred/predbat.py", line 4816, in basic_rates start_str = this_rate.get("start", "00:00:00") ^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'get'

2023-12-25 15:50:04.468790 WARNING pred_bat:

On Mon, 25 Dec 2023, 15:23 Trefor Southwell, @.***> wrote:

I probably need the more detailed error message that you will find in 'system, settings, logs, appdeamon' to find out exactly the problem, but it seems like you might not have set your import or export rates correctly. If you don't have export you should set it to 0.

— Reply to this email directly, view it on GitHub https://github.com/springfall2008/batpred/issues/527#issuecomment-1869025574, or unsubscribe https://github.com/notifications/unsubscribe-auth/AS34JH32ZCH4M6JLW2SRLC3YLGK6NAVCNFSM6AAAAABBCNQLKWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNRZGAZDKNJXGQ . You are receiving this because you authored the thread.Message ID: @.***>

dandwhelan commented 7 months ago

On Mon, 25 Dec 2023, 15:53 Daniel Whelan, @.***> wrote:

Hey, this might be relevant... Does it help?

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/homeassistant/appdaemon/apps/batpred/predbat.py", line 4816, in basic_rates start_str = this_rate.get("start", "00:00:00") ^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'get'

2023-12-25 15:50:04.468790 WARNING pred_bat:

On Mon, 25 Dec 2023, 15:23 Trefor Southwell, @.***> wrote:

I probably need the more detailed error message that you will find in 'system, settings, logs, appdeamon' to find out exactly the problem, but it seems like you might not have set your import or export rates correctly. If you don't have export you should set it to 0.

— Reply to this email directly, view it on GitHub https://github.com/springfall2008/batpred/issues/527#issuecomment-1869025574, or unsubscribe https://github.com/notifications/unsubscribe-auth/AS34JH32ZCH4M6JLW2SRLC3YLGK6NAVCNFSM6AAAAABBCNQLKWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNRZGAZDKNJXGQ . You are receiving this because you authored the thread.Message ID: @.***>

File "/homeassistant/appdaemon/apps/batpred/predbat.py", line 10523, 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 "/homeassistant/appdaemon/apps/batpred/predbat.py", line 9766, in update_pred self.fetch_sensor_data() File "/homeassistant/appdaemon/apps/batpred/predbat.py", line 9357, in fetch_sensor_data self.rate_export = self.basic_rates(self.get_arg("rates_export_override", [], indirect=False), "export", self.rate_export) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/homeassistant/appdaemon/apps/batpred/predbat.py", line 4816, in basic_rates start_str = this_rate.get("start", "00:00:00") ^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'get' 2023-12-25 16:35:03.783425 WARNING pred_bat: ------------------------------------------------------------ 2023-12-25 16:40:04.044928 WARNING pred_bat: ------------------------------------------------------------ 2023-12-25 16:40:04.047180 WARNING pred_bat: Unexpected error in worker for App pred_bat: 2023-12-25 16:40:04.048795 WARNING pred_bat: Worker Ags: {'id': 'b21a4515aea74f6fb476a3817a8c3233', 'name': 'pred_bat', 'objectid': 'ae65d3fcd06144d488a222d829065e05', 'type': 'scheduler', 'function': <bound method PredBat.run_time_loop of <predbat.PredBat object at 0x7fb8b97150>>, 'pin_app': True, 'pin_thread': 0, 'kwargs': {'interval': 300, 'random_start': 0, 'random_end': 0, '__thread_id': 'thread-0'}} 2023-12-25 16:40:04.050078 WARNING pred_bat: ------------------------------------------------------------ 2023-12-25 16:40:04.057479 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 "/homeassistant/appdaemon/apps/batpred/predbat.py", line 10527, in run_time_loop raise e File "/homeassistant/appdaemon/apps/batpred/predbat.py", line 10523, 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 "/homeassistant/appdaemon/apps/batpred/predbat.py", line 9766, in update_pred self.fetch_sensor_data() File "/homeassistant/appdaemon/apps/batpred/predbat.py", line 9357, in fetch_sensor_data self.rate_export = self.basic_rates(self.get_arg("rates_export_override", [], indirect=False), "export", self.rate_export) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/homeassistant/appdaemon/apps/batpred/predbat.py", line 4816, in basic_rates start_str = this_rate.get("start", "00:00:00") ^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'get' 2023-12-25 16:40:04.057966 WARNING pred_bat: ------------------------------------------------------------ 2023-12-25 16:45:03.613576 WARNING pred_bat: ------------------------------------------------------------ 2023-12-25 16:45:03.614684 WARNING pred_bat: Unexpected error in worker for App pred_bat: 2023-12-25 16:45:03.615374 WARNING pred_bat: Worker Ags: {'id': 'b21a4515aea74f6fb476a3817a8c3233', 'name': 'pred_bat', 'objectid': 'ae65d3fcd06144d488a222d829065e05', 'type': 'scheduler', 'function': <bound method PredBat.run_time_loop of <predbat.PredBat object at 0x7fb8b97150>>, 'pin_app': True, 'pin_thread': 0, 'kwargs': {'interval': 300, 'random_start': 0, 'random_end': 0, 'thread_id': 'thread-0'}} 2023-12-25 16:45:03.616283 WARNING pred_bat: ------------------------------------------------------------ 2023-12-25 16:45:03.621972 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 "/homeassistant/appdaemon/apps/batpred/predbat.py", line 10527, in run_time_loop raise e File "/homeassistant/appdaemon/apps/batpred/predbat.py", line 10523, 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 "/homeassistant/appdaemon/apps/batpred/predbat.py", line 9766, in update_pred self.fetch_sensor_data() File "/homeassistant/appdaemon/apps/batpred/predbat.py", line 9357, in fetch_sensor_data self.rate_export = self.basic_rates(self.get_arg("rates_export_override", [], indirect=False), "export", self.rate_export) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/homeassistant/appdaemon/apps/batpred/predbat.py", line 4816, in basic_rates start_str = this_rate.get("start", "00:00:00") ^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'get' 2023-12-25 16:45:03.623503 WARNING pred_bat: ------------------------------------------------------------ 2023-12-25 16:50:04.063567 WARNING pred_bat: ------------------------------------------------------------ 2023-12-25 16:50:04.064236 WARNING pred_bat: Unexpected error in worker for App pred_bat: 2023-12-25 16:50:04.064787 WARNING pred_bat: Worker Ags: {'id': 'b21a4515aea74f6fb476a3817a8c3233', 'name': 'pred_bat', 'objectid': 'ae65d3fcd06144d488a222d829065e05', 'type': 'scheduler', 'function': <bound method PredBat.run_time_loop of <predbat.PredBat object at 0x7fb8b97150>>, 'pin_app': True, 'pin_thread': 0, 'kwargs': {'interval': 300, 'random_start': 0, 'random_end': 0, 'thread_id': 'thread-0'}} 2023-12-25 16:50:04.065682 WARNING pred_bat: ------------------------------------------------------------ 2023-12-25 16:50:04.073193 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 "/homeassistant/appdaemon/apps/batpred/predbat.py", line 10527, in run_time_loop raise e File "/homeassistant/appdaemon/apps/batpred/predbat.py", line 10523, 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 "/homeassistant/appdaemon/apps/batpred/predbat.py", line 9766, in update_pred self.fetch_sensor_data() File "/homeassistant/appdaemon/apps/batpred/predbat.py", line 9357, in fetch_sensor_data self.rate_export = self.basic_rates(self.get_arg("rates_export_override", [], indirect=False), "export", self.rate_export) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/homeassistant/appdaemon/apps/batpred/predbat.py", line 4816, in basic_rates start_str = this_rate.get("start", "00:00:00") ^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'get' 2023-12-25 16:50:04.074073 WARNING pred_bat: ------------------------------------------------------------

springfall2008 commented 7 months ago

What is in your apps.yaml related to rates as it’s an errror in this file?

dandwhelan commented 7 months ago

I'd be embarrassed if its something I've done. I wouldn't be suprised.

I even got a fresh copy of the yaml file from github earlier on the day just in case I'd ruined the previous.

On Mon, 25 Dec 2023, 17:26 Trefor Southwell, @.***> wrote:

What is in your apps.yaml related to rates as it’s an errror in this file?

— Reply to this email directly, view it on GitHub https://github.com/springfall2008/batpred/issues/527#issuecomment-1869062327, or unsubscribe https://github.com/notifications/unsubscribe-auth/AS34JH6RREUTZ6Y5T35J4CDYLGZNHAVCNFSM6AAAAABBCNQLKWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNRZGA3DEMZSG4 . You are receiving this because you authored the thread.Message ID: @.***>

------------------------------------------------------------------

This is an example configuration, please modify it

------------------------------------------------------------------


pred_bat module predbat class PredBat

Sets the prefix for all created entities in HA - only change if you want to run more than once instance

prefix predbat

Timezone to work in

timezone Europe/London

XXX This is a configuration template, delete this line once you edit your configuration

Set to auto-match with a GivEnergy serial number, but you can override the serial or the sensor names

if it doesn't work or if you have more than one inverter you will need to list both

geserial 'resensor.giv_(.+)_sockwh' geserial2 'resensor.givtcp2(.+)_soc_kwh'

Sets the maximum period of zero load before the gap is filled, default 30 minutes

To disable set it to 1440

load_filter_threshold 30

#

Sensors, more than one can be specified and they will be summed up automatically

#

For two inverters the load today would normally be the master load sensor only (to cover the entire house)

If you have three phase and one inverter per phase then you would need three load sensors

#

For pv_today if you have multiple solar inverter inputs then you should include one entry for each inverter

# load_today

springfall2008 commented 7 months ago

You probably need one space before the dash eg

rate_export:

dandwhelan commented 7 months ago

Sorry still no joy.

Maybe I should delete everything batpred related and start from scratch.

On Mon, 25 Dec 2023, 17:47 Trefor Southwell, @.***> wrote:

You probably need one space before the dash eg

rate_export:

  • rate: 15

— Reply to this email directly, view it on GitHub https://github.com/springfall2008/batpred/issues/527#issuecomment-1869067684, or unsubscribe https://github.com/notifications/unsubscribe-auth/AS34JH5YYVEYXS4QM5PUHG3YLG345AVCNFSM6AAAAABBCNQLKWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNRZGA3DONRYGQ . You are receiving this because you authored the thread.Message ID: @.***>

------------------------------------------------------------------

This is an example configuration, please modify it

------------------------------------------------------------------


pred_bat module predbat class PredBat

Sets the prefix for all created entities in HA - only change if you want to run more than once instance

prefix predbat

Timezone to work in

timezone Europe/London

XXX This is a configuration template, delete this line once you edit your configuration

Set to auto-match with a GivEnergy serial number, but you can override the serial or the sensor names

if it doesn't work or if you have more than one inverter you will need to list both

geserial 'resensor.giv_(.+)_sockwh' geserial2 'resensor.givtcp2(.+)_soc_kwh'

Sets the maximum period of zero load before the gap is filled, default 30 minutes

To disable set it to 1440

load_filter_threshold 30

#

Sensors, more than one can be specified and they will be summed up automatically

#

For two inverters the load today would normally be the master load sensor only (to cover the entire house)

If you have three phase and one inverter per phase then you would need three load sensors

#

For pv_today if you have multiple solar inverter inputs then you should include one entry for each inverter

# load_today

springfall2008 commented 7 months ago

Can you attach your apps.yaml as file rather than cut pasting it so I can check the format?

dandwhelan commented 7 months ago

Here you go ☺️

On Mon, 25 Dec 2023, 18:56 Trefor Southwell, @.***> wrote:

Can you attach your apps.yaml as file rather than cut pasting it so I can check the format?

— Reply to this email directly, view it on GitHub https://github.com/springfall2008/batpred/issues/527#issuecomment-1869085774, or unsubscribe https://github.com/notifications/unsubscribe-auth/AS34JH6ZCBUVZRU7NHYPVJDYLHD57AVCNFSM6AAAAABBCNQLKWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNRZGA4DKNZXGQ . You are receiving this because you authored the thread.Message ID: @.***>

dandwhelan commented 7 months ago

Desktop.zip

dandwhelan commented 7 months ago

Ok, I completely removed and reinstalled and everything looks fine. Thanks for your time!

springfall2008 commented 7 months ago

For reference the attached apps.yaml was corrupted, e.g. colons were missing