reinhard-brandstaedter / solarflow-control

A tool to automatically control Zendure's Solarflow hub with more flexibility to match home power demand
67 stars 12 forks source link

SF-Control application error #124

Closed mavo closed 7 months ago

mavo commented 7 months ago

My SF-Control container did fail this morning

2024-02-15 06:29:06,819:INFO: HUB: S:0.0W [ 0.0 ], B: 0% ( 0| 0), C: 0W, P:False, F:-1.0h, E:0.0h, H: 0W, L: 0W
2024-02-15 06:29:06,819:INFO: INV: AC:0.0W, DC:0.3W (), L:1600.0W
2024-02-15 06:29:06,819:INFO: SMT: T:ShellyEM3 P:1059.8W [ 1059.6,1058.4,1057.5,1058.0,1060.9,1060.7 ]
2024-02-15 06:29:06,819:INFO: Direct connected panels can't cover demand 0.0W/1059.8W, trying to get rest from hub.
2024-02-15 06:29:06,819:INFO: Checking if Solarflow is willing to contribute 1059.8W ...
2024-02-15 06:29:06,820:INFO: Based on time, solarpower ( 0.0W) and minimum charge power (1W), hub could contribute 800.0W - Decision path: 2.1.
2024-02-15 06:29:06,820:INFO: Battery hasn't fully charged for -1.0 hours! To ensure it is fully charged at least every 28hrs not discharging now!
2024-02-15 06:29:06,820:INFO: Not setting solarflow output limit to 0.0W as it is identical to current limit!
2024-02-15 06:29:06,821:INFO: Solarflow is willing to contribute 0.0W!
Traceback (most recent call last):
  File "/solarflow/solarflow-control.py", line 407, in <module>
    main(sys.argv[1:])
  File "/solarflow/solarflow-control.py", line 404, in main
    run()
  File "/solarflow/solarflow-control.py", line 339, in run
    limitHomeInput(client)
  File "/solarflow/solarflow-control.py", line 277, in limitHomeInput
    direct_limit = getDirectPanelLimit(inv,hub,smt)
  File "/solarflow/solarflow-control.py", line 188, in getDirectPanelLimit
    return math.ceil(max(inv.getDirectDCPowerValues())) if smt.getPower() < 0 else limitedRise(max(inv.getDirectDCPowerValues()))
ValueError: max() arg is an empty sequence

I noticed as I had my compose file set to restart = "no" and therefore I had no data reported anymore, so I checked the container and its logs.

Just wanted to report, as you might be interested in this. MaVo

reinhard-brandstaedter commented 7 months ago

Interesting, do you have any Panels connected directly to the inverter? Could also be that the inverter was not reachable or not reporting at this time and no channels were detected before. The only way I can imagine this to happen is when solarflow-control was started at a time when the inverter was offline, and so it never got a chance to detect channels. Could that be the case?

mavo commented 7 months ago

Yes, I have 1 Panel directly connected. And yes, as I drained the battery yesterday completely after 10pm and when it was empty I started the sf-control again. Did stop the sf-control to manually to do it via the app in BT mode. When I enabled the sf-tool again, it was still night and the battery was empty.

The strange thing is, why did it fail around 6am and not when I restarted the app?

reinhard-brandstaedter commented 7 months ago

Ok that explains things…a corner case not handled too well. I assume it failed because it tried to calculate a limit based on a zero channel list. The inverter was basically offline/not producing and therefore didn’t report any channels either. I have added a safeguard for that in the latest dev-build.

Out of interest, why stopping the script when the battery is empty? Or was that an exception as well?

mavo commented 7 months ago

Because the app does not allow me to drain it when it was never full. There is my other ticket #119 in which I mentioned this as well. Tldr: to calibrate the battery the manual asks to drain the battery and afterwards fill it once when the system is new. As this is the case for my system but SF control is not built for this (there's no need for this) I stopped it to be able to control it via BT.

Out of interest, why stopping the script when the battery is empty? Or was that an exception as well?

Actually, I stopped it to drain it and started it again when it was empty :-)

MaVo

reinhard-brandstaedter commented 7 months ago

Usually, you could just let it run, the battery will get empty at some stage anyway. In normal operation the sf-control with charge through would take care of that with the appropriate settings of full_charge_interval. (unless you live in an area with 365 days sunshine ;-)

mavo commented 7 months ago

Well, ok. I was following the manual, where it states you should drain first and then load. So yeah. The issue why I opened the ticket is resolved as you changed it in your dev branch, will close it now.