Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected error in worker for App pv_opt: #296

Closed
philicibine opened this issue Nov 17, 2024 · 12 comments
Closed

Unexpected error in worker for App pv_opt: #296

philicibine opened this issue Nov 17, 2024 · 12 comments

Comments

@philicibine
Copy link

Hi. My PV opt doesnt appear to be charging according to the schedule it sets. Recently for a few mornings I have woken up to the battery being at 20% which is unusual. Having looked in the app daemon error logs i am seeing the following.

07:50:05 WARNING pv_opt: ------------------------------------------------------------
07:50:05 WARNING pv_opt: Unexpected error in worker for App pv_opt:
07:50:05 WARNING pv_opt: Worker Ags: {'id': '28e141cf029f4b3cbc8770702a717b6d', 'name': 'pv_opt', 'objectid': 'b922d7baae0044dc8030cd7835b8036c', 'type': 'scheduler', 'function': <bound method PVOpt.optimise_time of <pv_opt.PVOpt object at 0x7f7c1579d0>>, 'pin_app': True, 'pin_thread': 0, 'kwargs': {'interval': 600, '__thread_id': 'thread-0'}}
07:50:05 WARNING pv_opt: ------------------------------------------------------------
07:50:05 WARNING pv_opt: 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/pv_opt/pv_opt.py", line 1622, in optimise_time
    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 1694, in optimise
    consumption = self.load_consumption(
                  ^^^^^^^^^^^^^^^^^^^^^^
  File "/homeassistant/appdaemon/apps/pv_opt/pv_opt.py", line 2468, in load_consumption
    power = self.riemann_avg(power)
            ^^^^^^^^^^^^^^^^^^^^^^^
  File "/homeassistant/appdaemon/apps/pv_opt/pv_opt.py", line 2980, in riemann_avg
    dt = x.index.diff().total_seconds().fillna(0)
         ^^^^^^^
AttributeError: 'NoneType' object has no attribute 'index'

07:50:05 WARNING pv_opt: ------------------------------------------------------------
@fboundy
Copy link
Owner

fboundy commented Nov 17, 2024 via email

@philicibine
Copy link
Author

philicibine commented Nov 17, 2024

The source is correct. It seems this is an intermittent issue as it is getting the consumption history fine now. That log was from 7.50am this morning.. it then doesn't happen again until 2.55pm and then happens for several runs but stops erroring out at about 3.40pm. Very strange. Don't know what happened.

EDIT: Oh wait.... I turned off the power to my sockets this afternoon for DIY work!

Doesn't explain the morning log though. Will see what happens tomorrow. Maybe it's an issue with my router?

@fboundy
Copy link
Owner

fboundy commented Nov 17, 2024 via email

@philicibine
Copy link
Author

philicibine commented Nov 17, 2024

Just checked and i seem to be using sqlite.

Overall setup is a pi4 1gb, running solax modbus.

@fboundy
Copy link
Owner

fboundy commented Nov 17, 2024 via email

@fboundy
Copy link
Owner

fboundy commented Nov 17, 2024 via email

@philicibine
Copy link
Author

philicibine commented Nov 18, 2024

I think it polls every 30s. Not really sure how to check.

Just checked the error logs and it has happened overnight again. Right before it had scheduled a charge. Do you think it might be worth clearing the database?

Had a look and my database is only 275mb. Have setup the recorder section in my config.yaml to auto purge but keep 14 days. Not sure if this will make much difference though. The database is recording data every 5 seconds.. which is apparently the default.

@fboundy
Copy link
Owner

fboundy commented Nov 18, 2024 via email

@philicibine
Copy link
Author

philicibine commented Nov 18, 2024

Sorry .. I'm using Solax Modbus to communicate with the inverter. It polls every 60s. Which again is the default. The Modbus device I'm using is an esp32 with a modbus TCP gateway flashed onto it

@philicibine
Copy link
Author

philicibine commented Nov 19, 2024

Good morning. I have seen this error this morning. I guess this is why it isnt charging.

04:56:45     INFO: Entity: number.solax_timed_charge_start_hours Value:  4.0  Old State:  0.0 New state:  0.0 Diff:  4.0 Tol:  0.0
04:56:45    ERROR: Failed to write charge start hours to inverter
^[c04:56:47     INFO: Entity: number.solax_timed_charge_start_minutes Value: 56.0  Old State:  0.0 New state:  0.0 Diff: 56.0 Tol:  0.0
04:56:47    ERROR: Failed to write charge start minutes to inverter
04:56:50     INFO: Entity: number.solax_timed_charge_end_hours Value:  6.0  Old State:  0.0 New state:  0.0 Diff:  6.0 Tol:  0.0
04:56:50    ERROR: Failed to write charge end hours to inverter
04:56:50     INFO: Inverter already at correct time settings
04:56:50     INFO: Power 6000 = 100.0A at 52.9V
04:56:50     INFO: Inverter already at correct current
04:56:50     INFO: Waiting for inverter Read cycle: 18 seconds

How can i debug this? It does appear to be reading from the inverter ok

05:06:59     INFO: Current inverter status:
05:06:59     INFO: ------------------------
05:06:59     INFO:   mode              : Self-Use
05:06:59     INFO:   code              : 35
05:06:59     INFO:   switches          :
05:06:59     INFO:     SelfUse         : True
05:06:59     INFO:     Timed           : True
05:06:59     INFO:     OffGrid         : False
05:06:59     INFO:     BatteryWake     : False
05:06:59     INFO:     Backup          : False
05:06:59     INFO:     GridCharge      : True
05:06:59     INFO:     FeedInPriority  : False
05:06:59     INFO:   charge            :
05:06:59     INFO:     start           : 19-Nov 05:03 GMT
05:06:59     INFO:     end             : 19-Nov 06:00 GMT
05:06:59     INFO:     current         : 100.0
05:06:59     INFO:     active          : True
05:06:59     INFO:   discharge         :
05:06:59     INFO:     start           : 19-Nov 00:00 GMT
05:06:59     INFO:     end             : 19-Nov 00:00 GMT
05:06:59     INFO:     current         : 100.0
05:06:59     INFO:     active          : False
05:06:59     INFO:   hold_soc          :
05:06:59     INFO:     active          : False
05:06:59     INFO:     soc             : 80.0

@fboundy
Copy link
Owner

fboundy commented Nov 20, 2024 via email

@philicibine
Copy link
Author

Hi, the issue appears to have resolved itself for now. Will check the firmware version next time I go up into my loft. I did a full reset of the modbus adapter and the pi. It seemed to charge last night.

@fboundy fboundy closed this as completed Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants