Commit Graph

604 Commits

Author SHA1 Message Date
Niko
3c1d3f7207
Feature: retrieve absorption and float voltage from Victron MPPTs (#1140)
the absorption and float voltage setting is retrieved from connected
Victron Ve.Direct MPPTs using the HEX protocol. the values are
displayed in the live view, published to MQTT, and added to Home
Assistent auto-discovery.
2024-10-25 21:42:26 +02:00
Tobias Diedrich
2e85b420d5 Feature: add SoC & voltage thresholds for battery current limit
This changes the custom current limit so the custom limit is only
applied when any of:

- SoC is valid and not ignored and SoC < threshold
- Voltage is valid and Voltage < threshold
- Voltage is invalid

Independently, if "Use Battery-Reported limit" is enabled and valid, it
is applied (unless a lower custom limit already was applied).
2024-10-24 15:07:54 +02:00
Andreas Böhm
d36b30ae0e Fix: SBS Unipower battery discharge current handling
SBS CAN receiver implementation was not using the correct way to provide
discharge current limit.
2024-10-24 15:07:54 +02:00
Tobias Diedrich
2454cead03 Fix default value for discharge current limit
If the default type is an int, setting to a fractional value is not possible.

Presumably this is because in
`target.DischargeCurrentLimit = source["discharge_current_limit"] | BATTERY_DISCHARGE_CURRENT_LIMIT;`
the JSON library uses the default to force the expected type and on type mismatch the default is used.

As per https://arduinojson.org/v7/api/jsonvariant/or/:
`defaultValue: the value to return if the JsonVariant is null or incompatible with the requested type.`
2024-10-10 18:06:58 +02:00
ranma
c523f066b3
feature: Add support for native pytes CAN protocol (#1196)
* Allow scaleValue() for 32bit values

* Victron: Implement CAN message 0x360

This one-byte message is set to 0xff to request charging below a
 certain SoC threshold (10% in my tests).

* Pytes: Add support for native CAN protocol

The recently added PytesCanReceiver.cpp implements the Victron CAN protocol.

This change additionally adds support for the native Pytes CAN
protocol messages.

Features only supported in Pytes protocol:
- High-resolution state of charge / full and remaining mAh
- Charge cycle counter
- Balancing state

Features only supported in Victron protocol:
- FW version
- Serial number

Note that the only known way to select the native Pytes protocol is
via the serial console (Cisco-compatible cables work):

```
login config
setprt PYTES
logout
```

to return to Victron protocol use:
```
login config
setprt VICTRON
logout
```

to return to DIP-switch based protocol setting:
```
login config
setprt DIP
logout
```
2024-10-10 18:04:58 +02:00
Bernhard Kirchen
b2913f24d3 Merge upstream tag 'v24.10.6' into development 2024-10-06 21:21:26 +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
Bernhard Kirchen
1812e6eb6a Fix: prevent unauthorized access to OnBattery websockets
it turns out that authentication was never implemented on
OpenDTU-OnBattery-specific websocket connections. found while
applying https://github.com/tbnobody/OpenDTU/pull/2320
2024-09-30 22:26:31 +02:00
Bernhard Kirchen
185ac36282 Merge upstream tag 'v24.9.30' into development 2024-09-30 21:34:17 +02:00
Bernhard Kirchen
cbad181b99 Revert "Feature: SPIPortManager allows simultaneous use of CMT2300 and Huawei charger"
This reverts commit df53f34b51.
2024-09-30 21:07:05 +02:00
Bernhard Kirchen
0a289bbcab Revert "Feature: Support for W5500 ethernet module (#1231)"
This reverts commit 89d9a40296.
2024-09-30 20:59:22 +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
Bernhard Kirchen
5d8bb8f810 Merge upstream tag 'v24.9.26' into development 2024-09-27 20:07:53 +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
ranma
20159f341e
Feature: Add syslog logger (#1267)
This implements RFC5424 version of the protocol.

Don'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.

Add UI for syslog configuration to network admin view.
2024-09-26 23:01:06 +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
Thomas Basler
9b565596d5 Feature: Allow reset of radio statistics via WebApp 2024-09-25 20:18:36 +02:00
ranma
191cc8007d
Feature: parse additional Pylontech CAN protocol fields (#1213)
I noticed that these are missing while looking at dissassembly of the
Pytes implementation of the protocol. I also found Pylontech sample
CAN messages] which match the Pytes implementation [1]:

```
CAN ID – followed by 2 to 8 bytes of data:
0x351 – 14 02 74 0E 74 0E CC 01 – Battery voltage + current limits
                          ^^^^^ discharge cutoff voltage 46.0V
0x355 – 1A 00 64 00 – State of Health (SOH) / State of Charge (SOC)
0x356 – 4e 13 02 03 04 05 – Voltage / Current / Temp
0x359 – 00 00 00 00 0A 50 4E – Protection & Alarm flags
                       ^^^^^ always 0x50 0x59 in Pytes implementation
                    ^^ module count (matches the blog article image)
0x35C – C0 00 – Battery charge request flags
        ^^ two possible additional flags (bit 3 and bit 4)
0x35E – 50 59 4C 4F 4E 20 20 20 – Manufacturer name (“PYLON “)
        ^^^^^^^^^^^^^^ Note: Pytes sends a 5-byte message "PYTES" instead
                       padding with spaces
```

The extra charge request flag is "bit4: SOC low" (Seems to be SoC < 10%
threshold for Pytes), I haven't bothered adding that as it provides
little value.

[1] https://www.setfirelabs.com/green-energy/pylontech-can-reading-can-replication
2024-09-25 14:45:52 +02:00
LennartF22
851190dbcc Implement W5500 support 2024-09-25 00:37:03 +02:00
Thomas Basler
d3903d8602 MQTT Hass: Implement method to add common metadata to json output 2024-09-24 23:23:08 +02:00
Thomas Basler
2230850201 MQTT Hass: Implement device class as enum instead of String 2024-09-24 22:55:18 +02:00
Thomas Basler
bb4be0bbf7 MQTT Hass: Implement category as enum instead of String 2024-09-24 22:38:52 +02:00
Thomas Basler
2213ad7bce MQTT Hass: Move serialization and allocation check into own method 2024-09-24 21:47:56 +02:00
Thomas Basler
c699f1b487 MQTT Hass: Add device_type and category to publishInverterBinarySensor 2024-09-24 20:45:55 +02:00
Thomas Basler
239a77198d MQTT Hass: Move publishSensor logic into separate method 2024-09-24 20:38:12 +02:00
Thomas Basler
e5ca0ab784 MQTT Hass: Reorder binary sensor methods 2024-09-24 20:06:45 +02:00
Thomas Basler
f46a5017c7 MQTT Hass: Move publishBinarySensor logic into separate method 2024-09-24 20:03:42 +02:00
Thomas Basler
d899ea7364 MQTT Hass: Harmonise parameter names 2024-09-24 19:44:58 +02:00
Thomas Basler
7aca72b8fd MQTT Hass: Change parameter order for publishInverterNumber 2024-09-24 19:39:14 +02:00
Thomas Basler
483c10785b MQTT Hass: Change parameter order for publishInverterButton 2024-09-24 19:30:21 +02:00
Thomas Basler
a7100f238b MQTT Hass: Change parameter order for publishDtuBinarySensor 2024-09-24 19:23:04 +02:00
Thomas Basler
57c5b8c97e MQTT Hass: Make publish methods static 2024-09-24 19:22:05 +02:00
Thomas Basler
1c3e7de390 MQTT Hass: Change parameter order for publishDtuSensor 2024-09-24 19:21:06 +02:00
Thomas Basler
96e83f3d37 MQTT Hass: Change parameter order for publishInverterSensor 2024-09-24 19:18:56 +02:00
Thomas Basler
8e68632ed9 MQTT Hass: Rename caption parameter to name 2024-09-24 18:17:42 +02:00
Thomas Basler
8de1f7e70f MQTT Hass: Change char* to String& 2024-09-24 18:15:38 +02:00
Thomas Basler
bef81eed45 Feature: Publish Radio statistics to home assistant 2024-09-23 23:13:23 +02:00
Thomas Basler
181802a76b Feature: Allow reset of radio statistics via mqtt 2024-09-23 22:46:23 +02:00
Thomas Basler
93b6e5a885 Optimize MQTT subscription handling 2024-09-23 21:59:43 +02:00
Bernhard Kirchen
82de98c7c0 Merge remote-tracking branch 'tbnobody/master' into development 2024-09-23 21:38:50 +02:00
Eugen
2637e32145
Feature: rxen/txen support for RS485 transceiver for SDM power meter (#1269)
This allows to talk to the SDM power meter through an RS485 transceiver
with separate rxen and txen pins, like on the OpenDTU Fusion board.
2024-09-23 21:20:03 +02:00
Thomas Basler
e785904fca Fix: Restart was triggered before all website data was sent
This led to the effect that e.g. the confirmation messages where  not shown.

It is somehow related to ESPAsyncWebServer 3.3.0
2024-09-23 18:11:52 +02:00