320 Commits

Author SHA1 Message Date
Bernhard Kirchen
c106224052 logging: centralize rate limiting 2025-08-19 18:53:08 +02:00
Bernhard Kirchen
20003a0f92 syslog: implement rate limiting
enabling a lot of logging messages, e.g., by setting verbose as the
default level, can make the system unresponsive if syslogging is
enabled. to protect against this, a rate limiting algorithm is
implemented in the syslogger.
2025-08-19 18:52:44 +02:00
Bernhard Kirchen
5ba3446ad4 Fix: make logging more leightweight using large shared buffer 2025-08-19 18:52:17 +02:00
Bernhard Kirchen
5c89460e14 do not derive MessageOutput from Print
force us to use ESP_LOGx macros to log messages. print*() functions are
no longer available through MessageOutput.
2025-06-09 15:19:37 +02:00
Thomas Basler
27d28090d5 Fix: Dont allow HA base topic without trailing slash 2025-05-20 19:44:59 +02:00
Thomas Basler
98675263b6 Fix: Prevent crash when performing a lot of inverter edits
On every edit the whole HA MQTT gets published. This leads to a memory issue when saving quite often without any delay in between. The patch only send config updates every 60 seconds and adds several yield() calls.
This should also fix the crash when saving the network config very often.
2025-05-04 16:26:54 +02:00
Thomas Basler
030df8b715 Syslog: Send dynamic headers based on log level of the message
The code part regarding overflow was also removed as the write method 1 in any case. Different handling regarding line break etc. in one message was also removed as the function is called only containing one log line from MessageOutput.
2025-05-04 16:26:27 +02:00
ranma
bf31ccd02c Feature: Add syslog logger
This implements RFC5424 version of the protocol.

Doesn't use https://github.com/arcao/Syslog since the protocol itself
is trivial and most of the libraries functionality is not needed here.
The library also doesn't support setting the PROCID field, which is set
to a random id to indicate a reboot here.

Adds UI for syslog configuration to network admin view.
2025-05-04 16:26:27 +02:00
Tobias Diedrich
3d39349876 Add UI for syslog configuration to network view 2025-05-04 16:26:27 +02:00
benzman
d039455b82 Fix: handle MQTT message fragmentation
MQTT messages might arrive in parts if their payload is too big. for that
reason, we need to be prepared to re-assemble fragmented messages
on a topic before handing them over to the subscriber.
2025-05-04 16:17:24 +02:00
Thomas Basler
d4c29d708b Feature: Allow setting the log level for the different modules at runtime 2025-05-04 16:17:24 +02:00
Thomas Basler
724890147f Feature: Redirect all ESP log output to the MessageOutput handler 2025-05-04 16:17:23 +02:00
Thomas Basler
39b8d3f43f Implement Wifi reconnect watchdog
Sometimes the ESP does not trigger the ARDUINO_EVENT_WIFI_STA_DISCONNECTED when a disconnect occours. In this case, no further reconnect attempt is done. To take care of this behavior, the wifi hardware is reset when no connect occours within 60 seconds..
2025-05-04 16:17:23 +02:00
Thomas Basler
ec614b3132 Move disableAdminMode to separate method 2025-05-04 16:16:38 +02:00
Thomas Basler
3addcc2758 Use more thread save Message Output
Thanks to OnBattery!
2025-04-18 11:00:13 +02:00
Thomas Basler
897dad39a6 Give reconnect more time
Try to fix maybe unresponseable APs
2025-04-10 18:17:21 +02:00
Thomas Basler
542e755c64 Remove not required parameters from MqttSubscribeParser
index and total are only required to handle different payload fragments. This is not done here. In a further step, the correct fragment handling will be implemented outside this library.
2025-04-09 19:36:46 +02:00
Thomas Basler
136657c846 Change datatype for display pins from uint8_t to gpio_num_t
This also changes the behavior of undefined pins... They are now introduced as -1 (255 is still compatible)
2025-02-08 00:56:22 +01:00
Thomas Basler
328936dfa0 Move all display related initialization inside the display class 2025-02-08 00:41:16 +01:00
Thomas Basler
8a227df4a7 Change datatype for eth pins from int to gpio_num_t 2025-02-08 00:30:48 +01:00
Thomas Basler
9d6de56857 Change datatype for w5500 pins from int8_t to gpio_num_t 2025-02-08 00:25:56 +01:00
Thomas Basler
48e2a3d245 Change datatype for cmt pins from int8_t to gpio_num_t 2025-02-08 00:24:44 +01:00
Thomas Basler
a3610abed7 Change datatype for nrf24 pins from int8_t to gpio_num_t 2025-02-08 00:24:44 +01:00
Thomas Basler
c661155028 Change datatype for led pins from int8_t to gpio_num_t 2025-02-08 00:24:44 +01:00
Thomas Basler
e7e607ce6f Apply automatic code formatting 2025-02-07 22:57:01 +01:00
Thomas Basler
226ed94346 Move network reconfiguration to main loop to prevent crashes 2025-01-24 21:08:38 +01:00
Thomas Basler
db130f646e Upgrade ESPAsyncWebServer from 3.4.2 to 3.6.0 2025-01-14 19:14:17 +01:00
Thomas Basler
58382be16c Feature: show hint if device profile missing or not selected 2024-12-14 13:07:31 +01:00
Thomas Basler
33a9b7454c Make function getClientId const 2024-11-10 02:45:42 +01:00
Thomas Basler
74e3947cb2 Merge branch 'pr2360' into dev 2024-11-06 19:55:03 +01:00
Thomas Basler
55c98ef880 Fix: skip BOM in JSON files (pin_mapping and config)
based on #2387
2024-11-01 22:07:48 +01:00
Thomas Basler
70f301941b Feature: Implement language pack support for display texts 2024-10-25 22:38:55 +02:00
Thomas Basler
d259042542 Rewrite display language handling to work with locale strings instead of magic numbers.
This is required to implement further i18n functions using the language packs
2024-10-25 21:43:29 +02:00
Bernhard Kirchen
b1edb13b3c add and use configuration write guard
the configuration write guard is now required when the configuration
struct shall be mutated. the write guards locks multiple writers against
each other and also, more importantly, makes the writes synchronous to
the main loop. all code running in the main loop can now be sure that
(1) reads from the configuration struct are non-preemtive and (2) the
configuration struct as a whole is in a consistent state when reading
from it.

NOTE that acquiring a write guard from within the main loop's task will
immediately cause a deadlock and the watchdog will trigger a reset. if
writing from inside the main loop should ever become necessary, the
write guard must be updated to only lock the mutex but not wait for a
signal.
2024-10-22 20:39:23 +02:00
Thomas Basler
68c87c9217 Move lookup for translation path to separate method 2024-10-21 20:15:56 +02:00
Thomas Basler
e29b86e4dc Add API endpoint to retrieve custom languages and complete language pack 2024-10-21 19:02:50 +02:00
Thomas Basler
16901482d9 Refactor file handling API and add endpoint to delete files 2024-10-19 12:40:43 +02:00
Thomas Basler
aa9f36ee8f Rename config API to file API 2024-10-19 11:07:15 +02:00
LennartF22
6d048ae01d Remove EMAC related code for devices that don't have one 2024-10-06 03:08:58 +02:00
Thomas Basler
7dac96810f Rename NetworkEventCbList_t to DtuNetworkEventCbList_t for further upgrades 2024-10-04 23:02:12 +02:00
Thomas Basler
0c2b6f1a61 Fix: Add state_class to several Home Assistant sensors
state_class was added to yieldtotal, yieldday ac power and temperature for the whole dtu

closes: #2324
2024-10-02 18:13:12 +02:00
mbo18
9df3e30bb2 Remove unused DEVICE_CLASS_TEMP 2024-10-02 11:02:52 +02:00
Thomas Basler
aa5087cc8a Merge branch 'pr2320' into dev 2024-09-30 16:02:58 +02:00
Bernhard Kirchen
ebb225f6c0 Fix: avoid deprecated setAuthentication() to fix memory exhaustion
with ESPAsyncWebServer 3.3.0, the setAuthentication() method became
deprecated and a replacement method was provided which acts as a shim
and uses the new middleware-based approach to setup authentication. in
order to eventually apply a changed "read-only access allowed" setting,
the setAuthentication() method was called periodically. the shim
implementation each time allocates a new AuthenticationMiddleware and
adds it to the chain of middlewares, eventually exhausting the memory.

we now use the new middleware-based approach ourselves and only add the
respective AuthenticatonMiddleware instance once to the respective
websocket server instance.

a regression where enabling unauthenticated read-only access is not
applied until reboot is also fixed. all the AuthenticationMiddleware
instances were never removed from the chain of middlewares when calling
setAuthentication("", "").
2024-09-30 15:16:30 +02:00
LennartF22
251bb7bd89 Add connection check for W5500 before full initialization 2024-09-28 02:26:36 +02:00
Thomas Basler
0fcf6061c1 Added required include to work with IDF 5 2024-09-27 18:30:44 +02:00
Thomas Basler
b43383007a Rename NetworkEventCb to DtuNetworkEventCb to prevent further upgrade issues 2024-09-27 17:32:28 +02:00
Thomas Basler
a18e298cdd Apply automatic code formatting 2024-09-26 19:22:30 +02:00
Thomas Basler
326525c961 Merge branch 'pr2306' into dev 2024-09-26 18:34:07 +02:00
Thomas Basler
155735c828 Embed current branch into building process 2024-09-25 21:46:38 +02:00