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

AttributeError: 'Reg_u64b' object has no attribute 'count' #10

Open
braini75 opened this issue Feb 29, 2024 · 3 comments
Open

AttributeError: 'Reg_u64b' object has no attribute 'count' #10

braini75 opened this issue Feb 29, 2024 · 3 comments

Comments

@braini75
Copy link

There seems to be an issue with the class Reg_u64b.

as christoph pointed out in #7 commenting out the whole class seem to help:

I had similar problem when using venus os 3.13 and I solved it by commenting out these lines at Kostal_SmartEnergyMeter.py

#class Reg_u64b(Reg_num):
# def __init__(self, base, *args, scale=1, **kwargs):
# super(Reg_u64b, self).__init__(self, base, *args, **kwargs)
# self.coding = ('>Q', '>4H')
# self.scale = float(self.scale)

I'm not a Python developer, but obviously with the update at Venus OS there is an attribute "count" expected, which is missing at this overriding part of Reg_u64b, so I always got

   File "/opt/victronenergy/dbus-modbus-client/Kostal_SmartEnergyMeter.py", line 46, in device_init
     Reg_u32b(0x001A, '/Ac/Frequency',         1000,  '%.1f Hz'),
   File "/opt/victronenergy/dbus-modbus-client/Kostal_SmartEnergyMeter.py", line 46, in device_init
     Reg_u32b(0x001A, '/Ac/Frequency',         1000,  '%.1f Hz'),
   File "/opt/victronenergy/dbus-modbus-client/Kostal_SmartEnergyMeter.py", line 13, in __init__
     def __init__(self, base, *args, scale=1, **kwargs):
   File "/opt/victronenergy/dbus-modbus-client/register.py", line 59, in __init__
     super().__init__(base, self.count, name, text, write, **kwargs)
 AttributeError: 'Reg_u64b' object has no attribute 'count'

Originally posted by @gristoph in #7 (comment)

@braini75
Copy link
Author

A correct implementation of that class should look like:

class Reg_u64b(Reg_num):
    def __init__(self, base, *args, **kwargs):
        super(Reg_u64b, self).__init__(base, 4, *args, **kwargs)
        self.coding = ('>Q', '>4H')
        self.count = 4
        self.scale = float(self.scale)

But I can not see any difference in function. It seems to work well without the re-definition of Reg_u64b.

@NightHawk32
Copy link

Should be fixed with #11

@Kartax
Copy link

Kartax commented Oct 21, 2024

I had the same issue and indeed it was fixed by removing the Class Definition (PR #11 )
However I still cannot see my KSEM under "Discovered Devices".

Mylog shows:

Starting background scan
Scanning 192.168.1.0/24
[tcp:192.168.1.7:502:1] Found Energy meter: None KOSTAL_KSEM
Scan completed in 21 seconds

Could the "None" mean that i have the known issue regarding deviceId ?

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

No branches or pull requests

3 participants