-
Notifications
You must be signed in to change notification settings - Fork 11
Development Testing Tips And Tricks
If you wish to connect to the VRM broker using the WebAssembly build, you need to follow these steps:
- Login to https://vrm.victronenergy.com/ in your web browser
- Click on the installation you wish to connect to, then click on Device List in the left-hand side, then click the Gateway device
- Copy the value shown for "VRM portal ID" and save it in notepad
- Construct a percent-encoded VRM username by prefixing your login email address with "vrmlogin_live_" and replacing the @ symbol with %40 e.g. if your email address is
[email protected]
then the VRM username will bevrmlogin_live_somebody%40example.com
- Construct a percent-encoded VRM password by percent-encoding any characters in your VRM password which require it
- Open notepad and construct a query string which looks like:
?id=vrm_portal_id&user=vrm_username&pass=vrm_password&shard=vrm
where thevrm_portal_id
was ascertained in step 3, thevrm_username
was ascertained in step 4, and thevrm_password
was ascertained in step 5. - Run the gui-v2 webassembly application in your browser (e.g. served by emrun or other webserver) and then paste in the query string you have constructed at the end, for example:
http://localhost:30000/venus-gui-v2.html?id=abcdef123456&user=vrmlogin_live_somebody%40example.com&pass=yourpassword&shard=vrm
. Press enter to reload the application with those parameters.
Note that in future, there will be a button you can click in the VRM website which will launch the application automatically with the required information passed securely to it, and the above process will no longer be required.
If you connect to VRM with a WebAssembly build, but it doesn't seem to connect (or it connects but immediately reconnects) there are a few things you should check:
- First, double check that you have constructed the query parameters correctly
- Second, double check that your device has two-way communication with VRM enabled. i.e. Settings -> VRM Online Portal -> VRM Two Way Communication.
- Third, log into VRM web portal in your browser, open your installation, and check that the connection status says "real-time".
You can point your web browser at http://cerbo.gx.ip.address/gui-beta/
to load gui-v2 directly from CerboGX. In the near future, this path will change, once gui-v2 is out of beta. The CerboGX serves the WebAssembly build of gui-v2 via its nginx webserver.
You should not need to specify any other parameters when connecting in this way, as by default it will connect to the localhost's (i.e. the CerboGX) MQTT server to receive its data.
If you are running a build from a separate host (desktop or WebAssembly), you need to specify which MQTT server it should connect to for data.
You can connect to the MQTT server on a CerboGX (or Ekrano) on your local LAN from either a desktop/development build, or a WebAssembly build, by passing an appropriate parameter.
On desktop, the parameter is like: --mqtt=cerbo.gx.ip.address
On WebAssembly, the query parameter looks like ?mqtt=ws://cerbo.gx.ip.address:9001
To test some temperature sensors and relay settings: Run /opt/victronenergy/dbus-recorder/startdemo.sh 2 to add a 'Fridge' temperature sensor relay to the relay settings.
To add a datapoint to a demo, edit /opt/victronenergy/dbus-recorder/demo2_vebus.csv
see: https://github.com/victronenergy/localsettings
dbus -y com.victronenergy.settings /Settings/Services/MqttVrm SetValue 0
dbus -y com.victronenergy.settings /Settings AddSettings '%[{"path": "CGwacs/DeviceIds", "default": "1,2,3,4,5,6"}]'
dbus -y com.victronenergy.settings /Settings AddSettings '%[{"path": "CGwacs/DeviceIds", "default": "1,2,3,4,5,6"}]'
custom name:
dbus -y com.victronenergy.settings /Settings AddSettings '%[{"path": "Devices/cgwacs_1/CustomName", "default": "customname1"}]'
dbus -y com.victronenergy.settings /Settings AddSettings '%[{"path": "Devices/cgwacs_2/CustomName", "default": "customname2"}]'
dbus -y com.victronenergy.settings /Settings AddSettings '%[{"path": "Devices/cgwacs_3/CustomName", "default": "customname3"}]'
dbus -y com.victronenergy.settings /Settings AddSettings '%[{"path": "Devices/cgwacs_4/CustomName", "default": "customname4"}]'
dbus -y com.victronenergy.settings /Settings AddSettings '%[{"path": "Devices/cgwacs_1/ServiceType", "default": "pvinverter"}]'
dbus -y com.victronenergy.settings /Settings AddSettings '%[{"path": "Devices/cgwacs_2/ServiceType", "default": "grid"}]'
classAndVrmInstanceItem:
dbus -y com.victronenergy.settings /Settings AddSettings '%[{"path": "Devices/cgwacs_1/ClassAndVrmInstance", "default": "pvinverter:1"}]'
dbus -y com.victronenergy.settings /Settings AddSettings '%[{"path": "Devices/cgwacs_2/ClassAndVrmInstance", "default": "grid:1"}]'
dbus -y com.victronenergy.settings /Settings AddSettings '%[{"path": "Devices/cgwacs_3/ClassAndVrmInstance", "default": "genset:1"}]'
dbus -y com.victronenergy.settings /Settings AddSettings '%[{"path": "Devices/cgwacs_4/ClassAndVrmInstance", "default": "acload:1"}]'
multiPhaseSupport:
dbus -y com.victronenergy.settings /Settings AddSettings '%[{"path": "Devices/cgwacs_1/SupportMultiphase", "default": "0"}]'
dbus -y com.victronenergy.settings /Settings AddSettings '%[{"path": "Devices/cgwacs_2/SupportMultiphase", "default": "1"}]'
isMultiphase:
dbus -y com.victronenergy.settings /Settings AddSettings '%[{"path": "Devices/cgwacs_1/IsMultiphase", "default": "1"}]'
dbus -y com.victronenergy.settings /Settings AddSettings '%[{"path": "Devices/cgwacs_2/IsMultiphase", "default": "0"}]'
pvOnL2:
dbus -y com.victronenergy.settings /Settings AddSettings '%[{"path": "Devices/cgwacs_1_S/Enabled", "default": "0"}]'
dbus -y com.victronenergy.settings /Settings AddSettings '%[{"path": "Devices/cgwacs_2_S/Enabled", "default": "0"}]'
PV inverter on phase 2 Position:
dbus -y com.victronenergy.settings /Settings AddSettings '%[{"path": "Devices/cgwacs_2/Position", "default": "0"}]'
/L2/ServiceType
dbus -y com.victronenergy.settings /Settings AddSettings '%[{"path": "Devices/cgwacs_1/L2/ServiceType", "default": "pvinverter"}]'
dbus -y com.victronenergy.settings /Settings AddSettings '%[{"path": "Devices/cgwacs_2/L2/ServiceType", "default": "grid"}]'
How to modify an existing dbus data point:
dbus-send --system --dest=com.victronenergy.battery.ttyUSB0 --print-reply /CustomName com.victronenergy.BusItem.SetValue variant:string:"new custom name"
find . -name "*.qml" -exec grep "//%" {} \; | sed -Ez 's/[ ]( )+([/])//g' | sed -e 's/^[ \t]*//' | sort
Build the application in debug mode using the sdk:
cmake -DCMAKE_BUILD_TYPE=Debug ../gui-v2/
cmake --build . --parallel 8
Run the application on device, enabling qmljsdebugger:
# ./venus-gui-v2 -qmljsdebugger=port:3768,block
Connect to it using qmlprofiler from the host (using qmlprofiler from the sdk)
$ . /opt/venus/dunfell-arm-cortexa8hf-neon/environment-setup-cortexa8hf-neon-ve-linux-gnueabi
$ /opt/venus/dunfell-arm-cortexa8hf-neon/sysroots/x86_64-ve-linux/usr/bin/qt6/qmlprofiler -a 192.168.5.96 -p 3768 -verbose -o trace.qtd
Gracefully quit the application on the device by going to Settings/Debug/QuitApplication (note: control-C will prevent flush to socket...).
Load the trace file in QtCreator via Analyze / QML Profiler Options / Load Trace.
The "mock" backend is available on Desktop to test layouts / data inputs / etc.
Use --mock
rather than --mqtt
etc to enable the mock backend.
Use the left and right arrows to cycle between different system setups.
The brief, overview, and levels pages have different setups implemented for them.