Coder Social home page Coder Social logo

Comments (5)

dummy74 avatar dummy74 commented on May 28, 2024

@sfstar: When I read the registers directly from Python the values are correct. The register definition on the part of Victron is valid!

from pymodbus.constants import Defaults
from pymodbus.constants import Endian
from pymodbus.client.tcp import ModbusTcpClient as ModbusClient
from pymodbus.payload import BinaryPayloadDecoder

Defaults.Timeout = 25
Defaults.Retries = 5
client = ModbusClient('192.168.2.56', port='502')

for reg in [817,818,819]:
	result = client.read_input_registers(reg,2)
	decoder = BinaryPayloadDecoder.fromRegisters(result.registers, byteorder=Endian.Big)
	r1=decoder.decode_16bit_uint()
	print(f"Register {reg} : {r1}")

Output:

Register 817 : 172
Register 818 : 38
Register 819 : 69

from hass-victron.

sfstar avatar sfstar commented on May 28, 2024

Thank you for opening this issue.
Most likely the integration is doing something wrong when decoding the bytebuffer received from the GX device.

After a quick investigation it seems that a similair issue is locally reproducable with my setup.
Although the interesting thing is that for me it seems to assign the grid L1 values to the grid L2 entity
Screenshot 2022-12-02 at 08 41 49

While your script returns the correct values for my setup as well

Register 817 : 22
Register 818 : 0
Register 819 : 0

I need to further investigate before an solution can be introduced.
I think I will have some time this weekend to further troubleshoot

from hass-victron.

sfstar avatar sfstar commented on May 28, 2024

So I had a sudden insight in what it could be.
It turned out that the register names were broken for pvonoutput for the system registers.

    "system_pvonoutput_L1": RegisterInfo(808, UINT16, UnitOfPower.WATT),
    "system_pvonoutput_l1": RegisterInfo(809, UINT16, UnitOfPower.WATT),
    "system_pvonoutput_l1": RegisterInfo(810, UINT16, UnitOfPower.WATT),

This caused the offset by one due to the integration using an ordered dict (with unique key requirement) for parsing the data.
So 808 and 810 would be decoded but 809 wouldn't since it wasn't an unique dictionary key (808 had L1 in the name and 809/810 l1 in lower case)
By changing this to

    "system_pvonoutput_L1": RegisterInfo(808, UINT16, UnitOfPower.WATT),
    "system_pvonoutput_L2": RegisterInfo(809, UINT16, UnitOfPower.WATT),
    "system_pvonoutput_L3": RegisterInfo(810, UINT16, UnitOfPower.WATT),

The system registers were reporting the correct values for my local setup.
@dummy74 could you test it with your setup as well?

Fun fact: during the fixing I also discovered that I was decoding INT32 as UINT32. So that was also resolved.

from hass-victron.

dummy74 avatar dummy74 commented on May 28, 2024

Perfect! The values are now displayed correctly.

from hass-victron.

sfstar avatar sfstar commented on May 28, 2024

@dummy74 thank you for confirming.
I will close this issue as resolved now.
Please feel free to re-open if there are complications

from hass-victron.

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.