question

eliott avatar image
eliott asked

modifying OverviewMobile.qml to display remaining distance

Hi!

I already did some modifications to OverviewMobile.qml to get values about storm warning that I populate from dbus from a python script that gets data from a json service.

I thought I have a basic understanding of how Victron Qt thing works, however, I am stuck getting a basic value from the service dbus the same way it works on my own custom namespace.


This is my code:

                 VBusItem {
                                id: localtimetogo
                                bind: Utils.path("com.victronenergy.system","/DC/Battery/TimeToGo")
                        }

If I want to display the value (localtimetogo.value), it always gives me undefined, when displaying text (localtimetogo.text) gives me "--"

What am I doing wrong?

thanks


Venus OS
1 comment
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

Ole Saether avatar image Ole Saether commented ·

I have done some qml coding but I believe your code above is incomplete. Show us the complete code or how you are trying to display the value.

0 Likes 0 ·
1 Answer
Ole Saether avatar image
Ole Saether answered ·

Have you tried something like this?


MbItemValue {
    description: qsTr("Time to go")
    item.bind: Utils.path("com.victronenergy.system","/DC/Battery/TimeToGo")
}




4 comments
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

eliott avatar image eliott commented ·

I need to do calculations with that number, speed (m/s) * timetogo (secs) / 1000.

The speed value I can get with

VBusItem {
                                id: localspeed
                                bind: Utils.path("com.victronenergy.gps","/Speed")
                        }

But the same logic does not work with TimeToGo

0 Likes 0 ·
eliott avatar image eliott commented ·

This is the relevant code:

                    values: [
                                TileText {
                                        text: getDist()
                                        visible: true
                                        VBusItem {
                                                id: localspeed
                                                bind: Utils.path("com.victronenergy.gps","/Speed")
                                        }

                                        VBusItem {
                                               id: localtimetogo
                                               bind: Utils.path("com.victronenergy.system","/DC/Battery/TimeToGo")
                                        }


                                        function getDist()
                                        {
                                                return localspeed.value * localtimetogo.value / 1000
                                        }
                                }
                        ]

any help is really appreciated

0 Likes 0 ·
eliott avatar image eliott eliott commented ·

@osaether can you spot the error please?

0 Likes 0 ·
Show more comments

Related Resources