GithubHelp home page GithubHelp logo

Comments (8)

Arise avatar Arise commented on July 17, 2024 1

The ones that appear near the elfins in the image.

Two Master One /Multiple Slave RS485 Repeater Cache Optoelectronic Isolation Modbus Dual Master Hub
https://a.aliexpress.com/_EwiBqvz

from home-assistant-saj-modbus.

Arise avatar Arise commented on July 17, 2024

I've enabled logs and watched with tail -f /config/home-assistant.log and when it had problems, this is how it went:

...
2024-04-27 19:47:25.318 DEBUG (MainThread) [custom_components.saj_modbus.hub] Finished fetching SAJ data in 0.275 seconds (success: True)
2024-04-27 19:47:35.318 DEBUG (MainThread) [custom_components.saj_modbus.hub] Finished fetching SAJ data in 0.277 seconds (success: True)
2024-04-27 19:47:45.321 DEBUG (MainThread) [custom_components.saj_modbus.hub] Finished fetching SAJ data in 0.279 seconds (success: True)
2024-04-27 19:47:55.322 DEBUG (MainThread) [custom_components.saj_modbus.hub] Finished fetching SAJ data in 0.280 seconds (success: True)
2024-04-27 19:48:05.324 DEBUG (MainThread) [custom_components.saj_modbus.hub] Finished fetching SAJ data in 0.283 seconds (success: True)
2024-04-27 19:48:15.324 DEBUG (MainThread) [custom_components.saj_modbus.hub] Finished fetching SAJ data in 0.283 seconds (success: True)
2024-04-27 19:48:25.134 ERROR (MainThread) [custom_components.saj_modbus.hub] Unexpected error fetching SAJ data: unpack requires a buffer of 4 bytes
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 315, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/saj_modbus/hub.py", line 95, in _async_update_data
    realtime_data = await self.hass.async_add_executor_job(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/saj_modbus/hub.py", line 166, in read_modbus_realtime_data
    faultMsg0 = decoder.decode_32bit_uint()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pymodbus/payload.py", line 380, in decode_32bit_uint
    handle = self._unpack_words(fstring, handle)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pymodbus/payload.py", line 340, in _unpack_words
    handle = unpack(f"!{wc_value}H", handle)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
struct.error: unpack requires a buffer of 4 bytes
2024-04-27 19:48:25.139 DEBUG (MainThread) [custom_components.saj_modbus.hub] Finished fetching SAJ data in 0.098 seconds (success: False)
2024-04-27 19:48:40.047 INFO (MainThread) [custom_components.saj_modbus.hub] Fetching SAJ data recovered
2024-04-27 19:48:40.047 DEBUG (MainThread) [custom_components.saj_modbus.hub] Finished fetching SAJ data in 5.007 seconds (success: True)
2024-04-27 19:48:55.051 DEBUG (MainThread) [custom_components.saj_modbus.hub] Finished fetching SAJ data in 5.009 seconds (success: True)
2024-04-27 19:49:05.310 DEBUG (MainThread) [custom_components.saj_modbus.hub] Finished fetching SAJ data in 0.269 seconds (success: True)
2024-04-27 19:49:15.310 DEBUG (MainThread) [custom_components.saj_modbus.hub] Finished fetching SAJ data in 0.269 seconds (success: True)
2024-04-27 19:49:25.311 DEBUG (MainThread) [custom_components.saj_modbus.hub] Finished fetching SAJ data in 0.269 seconds (success: True)
...

from home-assistant-saj-modbus.

Arise avatar Arise commented on July 17, 2024

My feeling is this could be related to the SEC device, if I understand properly this modbus thingie, the inverter is the slave and the Elfin and the SEC smart meter devices are the masters, and both harass the inverter requesting data.

Maybe at some point the SEC is requesting data, inverter replies and the Elfin device is catching the response on the fly, tries to decode using his known structure, the structure is not matching because the reply was meant for the SEC device, so the SAJ integration throws the exception and then it takes some time to recover (like 20 seconds?!?)

After the "Fetching SAJ data recovered" there are also 2 long time processing jobs reports, which is strange.

from home-assistant-saj-modbus.

mvn23 avatar mvn23 commented on July 17, 2024

See #72 (comment) for the most likely cause of your troubles. You can not connect more than one device that requests data from your inverter's RS485 port and expect it to work without issues. Modbus is not designed for that.

from home-assistant-saj-modbus.

Arise avatar Arise commented on July 17, 2024

I understand the part with "not expect it to work without issues". But most of the time the integration works fine, only from time to time the problem appears in which case handling the exception thrown could maybe improve the behavior?

from home-assistant-saj-modbus.

Arise avatar Arise commented on July 17, 2024

I ordered two "gateways" units, something that works like 2 masters and 1 slave and I hope to see if this is going to fix my issues.
I will report back with the outcome, and I will propose closing the issue.

from home-assistant-saj-modbus.

Arise avatar Arise commented on July 17, 2024

I received the gateway units, installed them and those works flawless.

No more errors in HA.

Also, now I can query the DTSU-666 smart meter over modbus.

image

from home-assistant-saj-modbus.

wimb0 avatar wimb0 commented on July 17, 2024

Good to hear the issue is solved.
Which gateway did you use?

from home-assistant-saj-modbus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.