deg0nz / MMM-VartaESS

MagicMirror module to show information about Varta Energy Storage Systems
MIT License
0 stars 0 forks source link

Battery Status not Updating #2

Closed Pob4acke closed 2 years ago

Pob4acke commented 2 years ago

For me the batterie Status does not Update, it only switches between "Unknown" and "Error". The other Values are gathered properly so the plugin shows the right value for that.

Logs show the following: [06.02.2022 18:13.16.614] [LOG] [VartaESS Data Fetcher (ID: 42)] Modbus read error: [06.02.2022 18:13.16.666] [LOG] [VartaESS Data Fetcher (ID: 42)] {"name":"TransactionTimedOutError","message":"Timed out","errno":"ETIMEDOUT"} [06.02.2022 18:13.19.751] [LOG] [VartaESS Data Fetcher (ID: 42)] Connected. [06.02.2022 18:14.49.647] [LOG] [VartaESS Data Fetcher (ID: 42)] Modbus read error: [06.02.2022 18:14.49.674] [LOG] [VartaESS Data Fetcher (ID: 42)] {"name":"TransactionTimedOutError","message":"Timed out","errno":"ETIMEDOUT"} [06.02.2022 18:14.58.721] [LOG] [VartaESS Data Fetcher (ID: 42)] Modbus read error: [06.02.2022 18:14.58.767] [LOG] [VartaESS Data Fetcher (ID: 42)] {"name":"TransactionTimedOutError","message":"Timed out","errno":"ETIMEDOUT"} [06.02.2022 18:15.01.915] [LOG] [VartaESS Data Fetcher (ID: 42)] Connected. [06.02.2022 18:21.13.686] [LOG] [VartaESS Data Fetcher (ID: 42)] Modbus read error: [06.02.2022 18:21.13.702] [LOG] [VartaESS Data Fetcher (ID: 42)] {"name":"TransactionTimedOutError","message":"Timed out","errno":"ETIMEDOUT"} [06.02.2022 18:21.16.789] [LOG] [VartaESS Data Fetcher (ID: 42)] Connected. [06.02.2022 18:26.18.359] [LOG] [VartaESS Data Fetcher (ID: 42)] Modbus read error: [06.02.2022 18:26.18.433] [LOG] [VartaESS Data Fetcher (ID: 42)] {"name":"TransactionTimedOutError","message":"Timed out","errno":"ETIMEDOUT"} [06.02.2022 18:26.21.575] [LOG] [VartaESS Data Fetcher (ID: 42)] Connected. [06.02.2022 18:33.24.333] [LOG] [VartaESS Data Fetcher (ID: 42)] Modbus read error: [06.02.2022 18:33.24.395] [LOG] [VartaESS Data Fetcher (ID: 42)] {"name":"PortNotOpenError","message":"Port Not Open","errno":"ECONNREFUSED"} [06.02.2022 18:33.27.714] [LOG] [VartaESS Data Fetcher (ID: 42)] Connected.

If I try to read the data manually with the tool "modbus-cli" I get the correct value: ~/modbus-cli/bin $ python3 modbus 192.168.20.9:502 1065 Parsed 0 registers definitions from 1 files 1065: 4 0x4

My config is as follows: module: 'MMM-VartaESS', position: "bottom_right", config: { ip: "192.168.20.9", // Entering the IP of the power converter is mandatory header: "Hausbatterie", clientId: 42, uodateInterval: 60000 }

I already experimented with different update interval and clientId, as you can see.

Any idea how to fix that?

(atm I'm connecting to the batterie through a VPN, so maybe the timeout for connection kicks in? But all the other values work...)

deg0nz commented 2 years ago

Now that you mentioned it, I see the same behaviour on my mirror. I wasn't really paying attention to the status. (It was working earlier though)

I will look into it as soon as I find time. Please bring a little patience :)

Edit: I don't think that the timeout hits, it is configured to 1s (it's hard-coded). That would be an extremely bad VPN connection. In my experience, the ModBus protocol server of the battery is sometimes quite flaky (we have an Element Battery). Connection errors and timeouts happen. (Because of this reason I had to spend a lot if time with error handling for modbus via tcp)

Edit2: Also, please check your config, there is a typo for the updateInterval property in your config. I have my interval at 3s.

deg0nz commented 2 years ago

Ok, that was a quick fix 😅

I just browsed the code and saw what the problem was. This should be fixed now.

Please feel free to re-open if you still experience the error aber updateing

Pob4acke commented 2 years ago

Hi,

very nice, I can confirm that it also works for me. Thanks!

And for sure, thanks for that hint to my typo in the config :D