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

Added Modbus to OpenDTU #582

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open

Conversation

ArekKubacki
Copy link

Added Modbus TCP/IP

@ArekKubacki
Copy link
Author

ArekKubacki commented Feb 27, 2023

Hello,
Any idea why there is error? In VisualStudio Code there is not any error.

@PhiDiWoe
Copy link

PhiDiWoe commented Mar 4, 2023

Ist die Modbus unterstützung dann auch für das OLIMEX Modul gedacht? also man kann dann direkt per LAN damit arbeiten?

@horfic
Copy link

horfic commented Mar 8, 2023

the build fails as it can't find the "ModbusDTU.h" file you include

@mzurhorst
Copy link

For my understanding: will this PR provide the capability to read the Hoymiles power/energy from e.g. a Kostal Smart Energy Meter? -- Or is there another use case behind?

@ArekKubacki
Copy link
Author

This change allows you to read data from OpenDTU over Modbus. It runs parallel to MQTT.

@AloisKlingler
Copy link

@ArekKubacki can you please offer me a compiled binary? I would like to try out if this can be added at fronius gen24 as "Power Meter"

@ArekKubacki
Copy link
Author

ArekKubacki commented Jun 7, 2023

@AloisKlingler
Copy link

AloisKlingler commented Jun 7, 2023

to get sure: This would act as Modbus TCP (port 502 on OpenDTU-IP) or as Modbus RTU ?
is there additional config necessary?
I tried to read registers 40072 to 40193 - I think this would be sunspec, but not sure at all - but nothing there. the registers you mentioned are maybe (decimal) 4096 to 4115 ?

thanks. :-)

@MIC1981
Copy link

MIC1981 commented Jun 30, 2023

firmware.zip

If you need Modbus registers, see here

https://github.com/ArekKubacki/OpenDTU/blob/master/src/ModbusDtu.cpp

I tried your precompiled firmware to use Modbus with iobroker. But everything i tried failed. If I try to read a register, for example 4096 I only get an error "illegal data address".
Is Modbus provided in the firmware you posted above? If not, is there a ready-to-flash firmware available?

@fantilator
Copy link

Any chance that this will be implemented in the master branch?

@madmartin
Copy link
Contributor

madmartin commented Jul 18, 2023

@AloisKlingler @fantilator @ArekKubacki

is there a reason for not merging this PR into OpenDTU?

IMHO yes.

  • The commits mess around with libraries (I assume a change in CR/LF cause by an editor).
  • Every new feature which is not essentially necessary should be able to be turned on/off. At least at runtime, and if it consume a lot of codespace then it should be configurable at compile time also.
  • Pull requests should look "nice" in the history of the main project when they get merged. So if this would be my project, I would not merge a PR with 22 commits and half of it are "fix this" "fix that" "merge...". I recommend a rebase of the pull request.

This is just my personal opinion, I am not the project owner.

@mschimpfhuber
Copy link

Hello, I am new here,

@AloisKlingler
is it possible that I get the AC_Power in an Register?

@heppth
Copy link

heppth commented Oct 30, 2023

Unfortunately, only the DC channels are provided. I would have been more interested in the AC channel.

@stefan123t
Copy link

@ArekKubacki have you considered / asked to add your PR/changes to the OpenDTU-onBattery fork from Helge Erbe ?

I know Helge has included a couple of plugins to retrieve Power Meter readings via MQTT, so maybe adding ModBus support there might be easier and straight forward ?

https://github.com/helgeerbe/OpenDTU-OnBattery

@ArekKubacki
Copy link
Author

I think that one day I will come back to mastering Modbus and creating a subpage where I can set everything up. How closely does this version follow the original OpenDTU?

@stefan123t
Copy link

@ArekKubacki
I have not checked what your PR actually does, but OpenDTU-onBattery has a PowerMeter.cpp class which has support for several PowerMeter Sources, including HTTP, MQTT, SML and something called SOURCE_SDM1PH/3PH.
As far as I know the SDM Smart Meters are read via ModBus / RS485 too ?

https://github.com/helgeerbe/OpenDTU-OnBattery/blob/development/src/PowerMeter.cpp

Regarding the fork Helge seems to be rather quick in merging changes which are inteoduced by Thomas in upstream OpenDTU. I can not remember any delays in the past year. So thanks to the great jobs of both project maintainers this fork is really well maintained !

@ArekKubacki
Copy link
Author

I'll look into it in my spare time.

@pneutek
Copy link

pneutek commented Nov 19, 2023

Hello

I'm new here. I am planning a PV project. Can I query the open DTU data (total power, power of the individual solar panels) with Modbus TCP? Is Modbus integrated in the current open DTU v23.11.16?
If so, is there a description here?

@hwinkel
Copy link

hwinkel commented Dec 17, 2023

Could OpenDTU Emulate a Fronius MODBUS Interface and becomes compatible with a Victron ESS system?

@AloisKlingler
Copy link

Could OpenDTU Emulate a Fronius MODBUS Interface and becomes compatible with a Victron ESS system?

this does this fork here: https://github.com/AloisKlingler/OpenDTU-FroniusSM-MB

@stefan123t
Copy link

@AloisKlingler did you check the fork / code in https://github.com/helgeerbe/OpenDTU-OnBattery ?
I do recall that @helgeerbe already implemented a couple of things to work with Victron ESS.
If your code does something different, maybe it would be a good idea to merge it into helge's fork, as this is a perfectly well maintained OpenDTU fork with the same focus, i.e. ESS.

@AloisKlingler
Copy link

@AloisKlingler did you check the fork / code in https://github.com/helgeerbe/OpenDTU-OnBattery ? I do recall that @helgeerbe already implemented a couple of things to work with Victron ESS. If your code does something different, maybe it would be a good idea to merge it into helge's fork, as this is a perfectly well maintained OpenDTU fork with the same focus, i.e. ESS.

regrettably I can not - as I just forked @ArekKubacki 's implementation and played around until the Fronius Smartmeter Simulation worked

so more or less, my fork is stuck in the current state as I am not good enough in coding to provide a PR for OpenDTU-OnBattery

@hwinkel
Copy link

hwinkel commented Dec 18, 2023

The point for me is not the meter emulation, metering is kind of easy, but the zero feed in control of the hoymiles. If the look like sunspec fronius to the Victron system they should be reduced in power if Victron says so?!?

b0661 added a commit to b0661/OpenDTU that referenced this pull request Apr 8, 2024
OpenDTU is extended by a Modbus server. The Modbus server serves TCP at port 502.
At Modbus ID 1 the server mimicks the Modbus registers in the original DTUPro.
At Modbus ID 125 the server serves a SunSpec compatible pseudo inverter that
provides the OpenDTU aggregated data from all registered inverters.

The OpenDTU Modbus sources were imspired by : https://github.com/ArekKubacki/OpenDTU.
See tbnobody#582 for the orignal pull request.

The Modbus library used for Modbus communication is: https://github.com/eModbus/eModbus.
Documentation for the library is here: https://emodbus.github.io/.
The library was choosen over full featured libraries to achieve a lower memory footprint.

fixes tbnobody#582

Signed-off-by: Bobby Noelte <[email protected]>
@b0661 b0661 mentioned this pull request Apr 8, 2024
b0661 added a commit to b0661/OpenDTU that referenced this pull request Apr 9, 2024
OpenDTU is extended by a Modbus server. The Modbus server serves TCP at port 502.
At Modbus ID 1 the server mimicks the Modbus registers in the original DTUPro.
At Modbus ID 125 the server serves a SunSpec compatible pseudo inverter that
provides the OpenDTU aggregated data from all registered inverters.

The OpenDTU Modbus sources were imspired by : https://github.com/ArekKubacki/OpenDTU.
See tbnobody#582 for the orignal pull request.

The Modbus library used for Modbus communication is: https://github.com/eModbus/eModbus.
Documentation for the library is here: https://emodbus.github.io/.
The library was choosen to achieve a lower memory footprint.

fixes tbnobody#582

Signed-off-by: Bobby Noelte <[email protected]>
b0661 added a commit to b0661/OpenDTU that referenced this pull request Apr 13, 2024
OpenDTU is extended by a Modbus server. The Modbus server serves TCP at port 502.
At Modbus ID 1 the server mimicks the Modbus registers in the original DTUPro.
At Modbus ID 125 the server serves a SunSpec compatible pseudo inverter that
provides the OpenDTU aggregated data from all registered inverters.

The OpenDTU Modbus sources were imspired by : https://github.com/ArekKubacki/OpenDTU.
See tbnobody#582 for the orignal pull request.

The Modbus library used for Modbus communication is: https://github.com/eModbus/eModbus.
Documentation for the library is here: https://emodbus.github.io/.
The library was choosen to achieve a lower memory footprint.

fixes tbnobody#582

Signed-off-by: Bobby Noelte <[email protected]>
b0661 added a commit to b0661/OpenDTU that referenced this pull request Apr 13, 2024
OpenDTU is extended by a Modbus server. The Modbus server serves TCP at port 502.
At Modbus ID 1 the server mimicks the Modbus registers in the original DTUPro.
At Modbus ID 125 the server serves a SunSpec compatible pseudo inverter that
provides the OpenDTU aggregated data from all registered inverters.

The OpenDTU Modbus sources were imspired by : https://github.com/ArekKubacki/OpenDTU.
See tbnobody#582 for the orignal pull request.

The Modbus library used for Modbus communication is: https://github.com/eModbus/eModbus.
Documentation for the library is here: https://emodbus.github.io/.
The library was choosen to achieve a lower memory footprint.

fixes tbnobody#582

Signed-off-by: Bobby Noelte <[email protected]>
b0661 added a commit to b0661/OpenDTU that referenced this pull request Apr 14, 2024
OpenDTU is extended by a Modbus server. The Modbus server serves TCP at port 502.
At Modbus ID 1 the server mimicks the Modbus registers in the original DTUPro.
At Modbus ID 125 the server serves a SunSpec compatible pseudo inverter that
provides the OpenDTU aggregated data from all registered inverters.

The OpenDTU Modbus sources were imspired by : https://github.com/ArekKubacki/OpenDTU.
See tbnobody#582 for the orignal pull request.

The Modbus library used for Modbus communication is: https://github.com/eModbus/eModbus.
Documentation for the library is here: https://emodbus.github.io/.
The library was choosen to achieve a lower memory footprint.

fixes tbnobody#582

Signed-off-by: Bobby Noelte <[email protected]>
b0661 added a commit to b0661/OpenDTU that referenced this pull request Apr 15, 2024
OpenDTU is extended by a Modbus server. The Modbus server serves TCP at port 502.
At Modbus ID 1 the server mimicks the Modbus registers in the original DTUPro.
At Modbus ID 125 the server serves a SunSpec compatible pseudo inverter that
  provides the OpenDTU aggregated data from all registered inverters.
At Modbus ID 243 the server serves a Sunspec meter that provides aggregated
  AC power and AC yield values of all registered inverters.

The OpenDTU Modbus sources were imspired by : https://github.com/ArekKubacki/OpenDTU.
See tbnobody#582 for the orignal pull request.

The Modbus library used for Modbus communication is: https://github.com/eModbus/eModbus.
Documentation for the library is here: https://emodbus.github.io/.
The library was choosen to achieve a lower memory footprint.

fixes tbnobody#582

Signed-off-by: Bobby Noelte <[email protected]>
b0661 added a commit to b0661/OpenDTU that referenced this pull request Apr 19, 2024
OpenDTU is extended by a Modbus server. The Modbus server serves TCP at port 502.
At Modbus ID 1 the server mimicks the Modbus registers in the original DTUPro.
At Modbus ID 125 the server serves a SunSpec compatible pseudo inverter that
  provides the OpenDTU aggregated data from all registered inverters.
At Modbus ID 243 the server serves a Sunspec meter that provides aggregated
  AC power and AC yield values of all registered inverters.

The OpenDTU Modbus sources were imspired by : https://github.com/ArekKubacki/OpenDTU.
See tbnobody#582 for the orignal pull request.

The Modbus library used for Modbus communication is: https://github.com/eModbus/eModbus.
Documentation for the library is here: https://emodbus.github.io/.
The library was choosen to achieve a lower memory footprint.

fixes tbnobody#582

Signed-off-by: Bobby Noelte <[email protected]>
b0661 added a commit to b0661/OpenDTU that referenced this pull request Apr 21, 2024
OpenDTU is extended by a Modbus server. The Modbus server serves TCP at port 502.
At Modbus ID 1 the server mimicks the Modbus registers in the original DTUPro.
At Modbus ID 125 the server serves a SunSpec compatible pseudo inverter that
  provides the OpenDTU aggregated data from all registered inverters.
At Modbus ID 243 the server serves a Sunspec meter that provides aggregated
  AC power and AC yield values of all registered inverters.

The OpenDTU Modbus sources were imspired by : https://github.com/ArekKubacki/OpenDTU.
See tbnobody#582 for the orignal pull request.

The Modbus library used for Modbus communication is: https://github.com/eModbus/eModbus.
Documentation for the library is here: https://emodbus.github.io/.
The library was choosen to achieve a lower memory footprint.

fixes tbnobody#582

Signed-off-by: Bobby Noelte <[email protected]>
b0661 added a commit to b0661/OpenDTU that referenced this pull request Apr 25, 2024
OpenDTU is extended by a Modbus server. The Modbus server serves TCP at port 502.
At Modbus ID 1 the server mimicks the Modbus registers in the original DTUPro.
At Modbus ID 125 the server serves a SunSpec compatible pseudo inverter that
  provides the OpenDTU aggregated data from all registered inverters.
At Modbus ID 243 the server serves a Sunspec meter that provides aggregated
  AC power and AC yield values of all registered inverters.

The OpenDTU Modbus sources were imspired by : https://github.com/ArekKubacki/OpenDTU.
See tbnobody#582 for the orignal pull request.

The Modbus library used for Modbus communication is: https://github.com/eModbus/eModbus.
Documentation for the library is here: https://emodbus.github.io/.
The library was choosen to achieve a lower memory footprint.

fixes tbnobody#582

Signed-off-by: Bobby Noelte <[email protected]>
b0661 added a commit to b0661/OpenDTU that referenced this pull request May 7, 2024
OpenDTU is extended by a Modbus server. The Modbus server serves TCP at port 502.
At Modbus ID 1 the server mimicks the Modbus registers in the original DTUPro.
At Modbus ID 125 the server serves a SunSpec compatible pseudo inverter that
  provides the OpenDTU aggregated data from all registered inverters.
At Modbus ID 243 the server serves a Sunspec meter that provides aggregated
  AC power and AC yield values of all registered inverters.

The OpenDTU Modbus sources were imspired by : https://github.com/ArekKubacki/OpenDTU.
See tbnobody#582 for the orignal pull request.

The Modbus library used for Modbus communication is: https://github.com/eModbus/eModbus.
Documentation for the library is here: https://emodbus.github.io/.
The library was choosen to achieve a lower memory footprint.

Signed-off-by: Bobby Noelte <[email protected]>
b0661 added a commit to b0661/OpenDTU that referenced this pull request May 7, 2024
OpenDTU is extended by a Modbus server. The Modbus server serves TCP at port 502.
At Modbus ID 1 the server mimicks the Modbus registers in the original DTUPro.
At Modbus ID 125 the server serves a SunSpec compatible pseudo inverter that
  provides the OpenDTU aggregated data from all registered inverters.
At Modbus ID 243 the server serves a Sunspec meter that provides aggregated
  AC power and AC yield values of all registered inverters.

The OpenDTU Modbus sources were imspired by : https://github.com/ArekKubacki/OpenDTU.
See tbnobody#582 for the orignal pull request.

The Modbus library used for Modbus communication is: https://github.com/eModbus/eModbus.
Documentation for the library is here: https://emodbus.github.io/.
The library was choosen to achieve a lower memory footprint.

Signed-off-by: Bobby Noelte <[email protected]>
b0661 added a commit to b0661/OpenDTU that referenced this pull request Jul 10, 2024
OpenDTU is extended by a Modbus server. The Modbus server serves TCP at port 502.
At Modbus ID 1 the server mimicks the Modbus registers in the original DTUPro.
At Modbus ID 125 the server serves a SunSpec compatible pseudo inverter that
  provides the OpenDTU aggregated data from all registered inverters.
At Modbus ID 243 the server serves a Sunspec meter that provides aggregated
  AC power and AC yield values of all registered inverters.

The OpenDTU Modbus sources were imspired by : https://github.com/ArekKubacki/OpenDTU.
See tbnobody#582 for the orignal pull request.

The Modbus library used for Modbus communication is: https://github.com/eModbus/eModbus.
Documentation for the library is here: https://emodbus.github.io/.
The library was choosen to achieve a lower memory footprint.

Signed-off-by: Bobby Noelte <[email protected]>
b0661 added a commit to b0661/OpenDTU that referenced this pull request Jul 14, 2024
OpenDTU is extended by a Modbus server. The Modbus server serves TCP at port 502.
At Modbus ID 1 the server mimicks the Modbus registers in the original DTUPro.
At Modbus ID 125 the server serves a SunSpec compatible pseudo inverter that
  provides the OpenDTU aggregated data from all registered inverters.
At Modbus ID 243 the server serves a Sunspec meter that provides aggregated
  AC power and AC yield values of all registered inverters.

The OpenDTU Modbus sources were imspired by : https://github.com/ArekKubacki/OpenDTU.
See tbnobody#582 for the orignal pull request.

The Modbus library used for Modbus communication is: https://github.com/eModbus/eModbus.
Documentation for the library is here: https://emodbus.github.io/.
The library was choosen to achieve a lower memory footprint.

Signed-off-by: Bobby Noelte <[email protected]>
@podarok
Copy link

podarok commented Oct 7, 2024

In order for the Victron ESS to see OpenDTU and use power limiting feature for zero|non zero feed-in Sunspec model 123 or Sunspec model 704 must be implemented
THis is started in v3.50~28 Venus oS - see https://community.victronenergy.com/t/venus-os-beta-series-announcement-and-changelog-v3-50-28/120

https://github.com/sunspec/models/blob/master/json/model_123.json
https://github.com/sunspec/models/blob/master/json/model_704.json

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

Successfully merging this pull request may close these issues.