ptrbojko / openhab-lsw4inverter-binding

6 stars 0 forks source link

Small example #3

Closed hasant73 closed 1 year ago

hasant73 commented 1 year ago

Hi, I read all the code but could not really see where you talk to the logger. There is so much OpenHAB code in between that I gave up. :-) Would you be so kind and give me a simple Java class that queries the logger and returns the response. Just plain Java. No OpenHAB. I would like to understand how the communication works.

ptrbojko commented 1 year ago

Start reading here - https://github.com/ptrbojko/openhab-lsw4inverter-binding/blob/623eae38fed3bced67f2e5fedc89df7faf69d2d3/src/main/java/org/openhab/binding/lswlogger/internal/protocolv5/lsw3/LswLoggerHandler.java#L61

This creates a statemachine.

  1. initial state connects to lsw logger
  2. sending request state sends a request (bases on serial number and two modbus registers - start and end)
  3. reading response state decodes response
hasant73 commented 1 year ago

How do you actually figure out how to communicate with the logger? Is there a documentation? I would like to talk to my LSE-3 Logger (LAN cable) but it does not respond to LWS3 queries. The 8899 port is open but no answer.

ptrbojko commented 1 year ago

I'v red some github projects. There are here and there some code doing essentially the same like this project: like bridging between loggers and mqtt.

As far as I know - SN of the logger and its firmware version determines the protocol it uses. Inverter type and firmare determines modbus registers it uses.