lumapu / ahoy

Various tools, examples, and documentation for communicating with Hoymiles microinverters
https://ahoydtu.de
Other
937 stars 219 forks source link

Reset Ahoy at midnight (ESP8266, v0.7.11) #1031

Open nexulm opened 1 year ago

nexulm commented 1 year ago

Hallo,

ich habe gestern voller Freude das neue Setting/Feature "Reset Ahoy at midnight" entdeckt und sofort die bei mir seit wenigen Wochen stabil laufende v0.7.3 aktualisiert. Heute Morgen habe ich dann allerdings überraschend festgestellt, dass letzte Nacht kein Reset des Ahoy (ESP8266) stattgefunden hat.

image

Zur Info: Da Abends nach Sonnenuntergang + 30min der WLAN-Router abgeschaltet wird, hat Ahoy kein Netzwerk mehr verfügbar. Möglicherweise gibt es hier ja Abhängigkeiten!?!

knickohr commented 1 year ago

Liegt vielleicht an der fehlenden Zeitsynchronisation ?

nexulm commented 12 months ago

Bei der Zeitsynchronisierung hätte ich allerdings erwartet, dass min. eine einmalige Zeitkorrektur zur Unterstützung des Feature passen sollte. Soeben habe ich zumindest den "alten" bekannten Reset-Grund "Hardware Watchdog" wiedergefunden: image

Hierdurch lief meine v0.7.3 ja in den letzten Wochen auch stabil, d.h. gelegentlicher Hardware-Reset durch den Watchdog im <= oder >= Tagesrythmus. ;-) image

lumapu commented 12 months ago

I think it's wrongly implemented. I will refactor that to get it working. In current implementation it is inside the NTP sync routine, but in Ahoy we have a scheduler to do that independent.

lumapu commented 12 months ago

Checked it again - it is correctly implemented but requires once a successfuly NTP sync. You can check if the scheduler has a registration for that function by doing that:

  1. open [IP]/serial in first browser tab
  2. open [IP]/debug in second browser tab
  3. go back to first browser tab and check the outpus

for me it looks like that (for today July 19th)

22:57:38 I: webSc, tmt: 1, rel: 1
22:57:38 I: uart, tmt: 3, rel: 5
22:57:38 I: tSend, tmt: 8, rel: 30
22:57:38 I: mqttS, tmt: 1, rel: 1
22:57:38 I: mqttM, tmt: 10, rel: 60
22:57:38 I: midNi, tmt: 1689804000, rel: 0
22:57:38 I: midRe, tmt: 1689804010, rel: 0
22:57:38 I: ivCom, tmt: 1689822911, rel: 0
22:57:38 I: Sunri, tmt: 1689881260, rel: 0
22:57:38 I: ntp, tmt: 40750, rel: 0

we're only interested for the entry 'midRe' which has a registered timestamp of 1689804010. So it's correct in my case - tested with version 0.7.11. I don't know what happens if the wifi router is turned of during Ahoy-Reboot.

nexulm commented 12 months ago

I've checked your proposal with the following results on my setup:

08:02:10` I: (#0) resetPayload 08:02:10 I: (#0) enqueCommand: 0x0b 08:02:10 I: (#0) prepareDevInformCmd 0x0b 08:02:10 15 pid: 80 08:02:10 I: TX 27B Ch75 | 15 81 85 66 81 86 16 45 40 80 0b 00 64 b8 cd e2 00 00 00 08 00 00 00 00 84 09 9e 08:02:10 I: procPyld: cmd: 0x0b 08:02:10 I: procPyld: txid: 0x95 08:02:15 I: webSc, tmt: 1, rel: 1 08:02:15 I: uart, tmt: 5, rel: 5 08:02:15 I: tSend, tmt: 25, rel: 30 08:02:15 I: mqttS, tmt: 1, rel: 1 08:02:15 I: mqttM, tmt: 57, rel: 60 08:02:15 I: midNi, tmt: 1689890400, rel: 0 08:02:15 I: midRe, tmt: 1689890410, rel: 0 08:02:15 I: ivCom, tmt: 1689881893, rel: 0 08:02:15 I: Sunri, tmt: 1689881953, rel: 0 08:02:15 I: ntp, tmt: 32877, rel: 0

1689890410: Fri Jul 21 2023 00:00:10 GMT+0200 (Mitteleuropäische Sommerzeit)

So far neither a reset due to "Reset at midnight" feature nor a reset due to "Hardware Watchdog" which I've seen several times in the last days/weeks with v0.7.3 and v0.7.11 as well. image

lumapu commented 11 months ago

for me it works, but my router is available 24/7

nexulm commented 11 months ago

For me it's not a question it's a bug as the Ahoy firmware up to v0.7.15 doesn't perform a reset at midnight in case that the WiFi network isn't available during night.

lumapu commented 11 months ago

yes I will look deeper into that - and there is no fixed dev label until now. So it's still in process.

lumapu commented 11 months ago

checked with an ESP8266 which had no WiFi at all (was configured using AP-Mode). Reboot was successful. Time was synced after first boot from browser.

nexulm commented 11 months ago

AhoyDTU (ESP8266) still does not reset at midnight (v0.7.23) when WiFi connection is off at night.

DanielR92 commented 10 months ago

Is it possible to check it with a other branch (dev03)? https://github.com/lumapu/ahoy/tree/development03 Download https://github.com/lumapu/ahoy/actions/runs/5981603776 - 0.7.41

nexulm commented 10 months ago

Of course but never seen that there is already a fix or change for this issue available. I‘m currently running v0.7.36, the latest stable release. I‘ll update to v0.7.41 in a few minutes to check the issue at next midnight. I‘ll give an update tomorrow.

BerziOnline commented 10 months ago

I checked that problem the last days as well.

These are my settings in v0.7.36: 2023-08-27_10-18

Activating/Deactivating the option "reset values and YieldDay at midnight" showed up in the logs by doing a http://[IP]/debug after each change, that this is enlisted in my case by "mid2" OR "midNi" and not as you said before by "midRe". Maybe this is the bug already, I don't know.

So my system has this kind of behaviour. After activating the option as shown I got a new entry "midNi": (it goes away after deavtivating the option) 2023-08-27_10-31

I did that yesterday and had a look now in the logs before starting this answer here and now the entry is named "mid2": 2023-08-27_10-19

After deactivating the option this entry dissappears. After activating again I have the entry "midNi" in the debug again, not the "mid2" anymore. (I did not play around with other options)

In none of my cases an entry "midRe" showed up.

So my YieldDay goes on day by day in counting without a reset :-)

Additional information:

nexulm commented 10 months ago

I checked that problem the last days as well.

These are my settings in v0.7.36: 2023-08-27_10-18

Activating/Deactivating the option "reset values and YieldDay at midnight" showed up in the logs by doing a http://[IP]/debug after each change, that this is enlisted in my case by "mid2" OR "midNi" and not as you said before by "midRe". Maybe this is the bug already, I don't know.

So my system has this kind of behaviour. After activating the option as shown I got a new entry "midNi": (it goes away after deavtivating the option) 2023-08-27_10-31

I did that yesterday and had a look now in the logs before starting this answer here and now the entry is named "mid2": 2023-08-27_10-19

After deactivating the option this entry dissappears. After activating again I have the entry "midNi" in the debug again, not the "mid2" anymore. (I did not play around with other options)

In none of my cases an entry "midRe" showed up.

So my YieldDay goes on day by day in counting without a reset :-)

Additional information:

  • My Hoymiles hm 1500 is running 24/7
  • NTP setup works properly

That's another issue as my original one was raised regarding the Device System option "Reboot Ahoy at midnight" and not Inverter option "Reset values and YieldDay at midnight"

image

Please raise an new issue for this observation. I can confirm that the "Reset values and YieldDay at midnight" isn't working for me since weeks as well. But maybe only due to my special setup that my WLAN-Router isn't running 24/7. I switch off the WLAN-Router during night so that Ahoy doesn't have any internet (and NTP) connection during the night, especially at midnight.

Remark: Some days ago I didn't switch off the WLAN-router during night by mistake and Ahoy did the Device/System reset. So for me my main issue here is that if no 24/7 internet connection, especially at midnight is available those reset won't work. :-(

nexulm commented 10 months ago

Of course but never seen that there is already a fix or change for this issue available. I‘m currently running v0.7.36, the latest stable release. I‘ll update to v0.7.41 in a few minutes to check the issue at next midnight. I‘ll give an update tomorrow.

image

Ahoy device system/reset at midnight is still not working in my specific case that the WLAN-router is off during the night (not running 24/7).

Remark: If the WLAN-router is on at midnight the reset works with the same settings but that isn't my preferred setup. ;-)

lumapu commented 10 months ago

understand, let me look into the code once again with this information 😉

lumapu commented 1 month ago

was already solved, try new development version

psm1711 commented 1 day ago

'L.S. My first Ahoy-DTU was up and running in August 2023. Used it successfully (I can't remember the revision number). Update 0.8.83 is installed last week and I was impressed by the good progress of the development. The reset of YieldDay was performed correctly during the night until I changed a setting. Now I'm struggling to get the reset of values correct while there are several inputs possible. Please note that I'm setting the system time from the browser, there is no connection possible through the NTP server. Herewith I present a list of set-points with my settings and some queries. --- A set-point "Reboot Ahoy at midnight" is available on the TAB System Configuration. "OFF" I'm careful to reboot the ESP 8266 to often, especially when eeproms are used. When do I need this setting? --- On the TAB Inverter several set-points can be used. -- A set-point "Reset values and YieldDay at midnight" "ON" This text looks good, this would be my favorite, however in this set-point the following text is added: ('Pause communication - during night' need to be set). Where can I find this set-point 'Pause communication during night'. Furthermore I would like to pause communication from sunset to sunrise. How can values and YieldDay be reset during a pause in communication? (in my original version I could see times of sunrise and sunset. That's gone in update 0.8.83) -- A set-point "Reset values at sunset" "ON" This is an acceptable alternative for resetting at midnight. Does it include YieldDay? -- A set-point " Reset values when the inverter status is not available" "OFF" To be honest, I don't understand the purpose of this set-point. -- A set-point "Reset 'max' values at midnight" "ON" The max values are only used in History I presume?

As stated YieldDay is not resetting, hopefully I can correct the mess I created.