victronenergy / gui-v2

Other
24 stars 9 forks source link

Grid unexpectedly shown as disconnected #1380

Closed blammit closed 1 month ago

blammit commented 1 month ago

Tested on this installation.

Overview grid looks like this:

image

Even though mqtt/system/0/Ac/ActiveIn/Source = 1:

image

And Brief page shows some Grid output:

image
blammit commented 1 month ago

This is because mqtt/system/Ac/In/0/Connected is true instead of 1 when connected, on VenusOS v3.50~7.

image

@ReinvdZee do you know if this is a deliberate change? On VenusOS v3.41~1 it is still 1 when connected, when querying the value on MQTT.

We can easily fix this bug in gui-v2 by checking if Connected is either 1 or true, but I just want to check whether this change is intentional, and whether any other values have changed in a similar manner.

ReinvdZee commented 1 month ago

@blammit I'm not sure if this is intentional or not. In dbus, it still has the value 1.

Maybe this was changed in the MQTT broker? @mpvader, @wiebeytec?

wiebeytec commented 1 month ago

Dbus-flashmq looks at the dbus type for generating the json string. Dbus has a distinction between bool and int, so I'm curious what the underlying type is.

Can you run (something like) this on various Venus versions and post the output:?

dbus-send --print-reply=literal --system --dest=com.victronenergy.system /Ac/In/0/Connected com.victronenergy.BusItem.GetValue

Example result for an int:

dbus-send --print-reply=literal --system --dest=com.victronenergy.system /Relay/1/State com.victronenergy.BusItem.GetValue
   variant       int32 1

Example result for a bool:

dbus-send --print-reply=literal --system --dest=com.victronenergy.platform /ConnectVrmTunnel com.victronenergy.BusItem.GetValue
   variant       boolean true
ReinvdZee commented 1 month ago

@wiebeytec

On Venus OS 3.50~9, this is the output:

root@einstein:~# dbus-send --print-reply=literal --system --dest=com.victronenergy.system /Ac/In/0/Connected com.victronenergy.BusItem.GetValue
   variant       boolean true

And on 3.41:

dbus-send --print-reply=literal --system --dest=com.victronenergy.system /Ac/In/0/Connected com.victronenergy.BusItem.GetValue
  variant       int32 1

In both cases, the values shows up in dbus-spy as 1. So it seems the type has changed along the way.

wiebeytec commented 1 month ago

Did you get no output from the second command, or did you make a copy/paste mistake?

ReinvdZee commented 1 month ago

@wiebeytec,

Sorry, copy mistake. I updated the comment

wiebeytec commented 1 month ago

I tried to see if i could find something in systemcalc (if that's even the right project) or velib_python to explain this, but nothing obvious stands out.

I don't know at which end(s) it needs fixing, although it seems reasonable GUIv2 can handle both.

ReinvdZee commented 1 month ago

I agree, Gui-v2 should be able to handle both.

The path is indeed created by dbus-systemcalc-py. Maybe @izak has a clue?

izak commented 1 month ago

My mistake guys...

It is the new feature where a system with no Inverter/Charger will show a connected grid connection if you have a grid meter. It is meant to better support systems with only a grid meter, and this is the line of code (that last input_count==0 creates a bool instead of an int).

newvalues.update(self.input_tree(input_count, source.service, source.instance, t, input_count==0))

Easy fix, I will cast it to an int explicitly.

Introduced in v3.50~3. Affects only systems without an inverter/charger and with a grid meter.

blammit commented 1 month ago

Thanks! I will also add a patch to allow gui-v2 to recognise either 1 or true as "connected".