Virtual Devices add custom DBUS Paths

by Midlands Solar · 1 month ago 45 views 5 replies
Midlands Solar
Midlands Solar
Active Member
17 posts
thumb_up 3 likes
Joined Nov 2024
1 month ago
#31830

Been thinking about this for a while and finally feel like posting.

Running Node-RED on my Cerbo GX for the garden office setup, and one thing that keeps biting me is the limitations around virtual devices and custom D-Bus paths. You can fake up a virtual PV inverter well enough, but the moment you want to push data to a path that isn't baked in by default, you're stuck doing workarounds that feel increasingly hacky.

Specifically, I've got a small Renogy array feeding into the office that I'm monitoring separately, and I'd love to expose some of those custom metrics properly through Venus OS rather than just bodging it through MQTT. The virtual device framework in Node-RED is genuinely brilliant — Victron have done a solid job — but it feels like it's almost there and then hits a wall.

What I'm wondering:

  • Has anyone managed to register fully custom D-Bus paths via Node-RED without it feeling like you're fighting the system?
  • Is there a clean way to extend virtual PV inverter objects with extra paths, or does it always require dropping into Python scripts?
  • Anyone running custom services alongside Node-RED to handle the bits Venus OS won't expose natively?

I know there's been chat in the Victron community forum about extending virtual devices, but most of it goes quite deep into the Venus OS internals and assumes you're comfortable SSH-ing in and editing service configs. Not everyone is at that level (myself included, most days).

Curious whether anyone here has cracked this in a practical way without needing a computer science degree. Feels like it should be simpler than it is.

CE_Builds
CE_Builds
Senior Member
140 posts
thumb_up 40 likes
Joined Oct 2023
1 month ago
#31858

@MidlandsSolar yeah this is a known pain point. The virtual device dbus paths in Node-RED are fairly limited out of the box.

Few things that've helped me on my garden office setup:

  • Use the dbus-victron node to write directly to custom paths rather than relying on virtual devices
  • The com.victronenergy.battery service accepts quite a few undocumented paths if you poke around
  • Check out venus-docker on GitHub — gives you a local sandbox to test path writes without bricking your Cerbo

Worth also looking at the Victron community forums (Modifications section) — there's a thread about registering custom services properly via dbus so they persist across reboots. That's where it gets interesting.

Main gotcha: paths you write manually often disappear after a VRM sync unless the service is properly registered. Caught me out a few times.

Moor Lee
Moor Lee
Senior Member
105 posts
thumb_up 27 likes
Joined Jul 2023
1 month ago
#31863

@MidlandsSolar @CE_Builds

Been down this rabbit hole myself 😄 Ended up writing custom dbus-spy scripts at 2am questioning all my life choices.

What actually saved me was using dbus-native directly in Node-RED function nodes rather than fighting the virtual device paths. You can register pretty much whatever path you like

MrBodge65
MrBodge65
Regular
53 posts
thumb_up 12 likes
Joined Jun 2023
1 month ago
#31898

@MoorLee the 2am dbus-spy rabbit hole is a rite of passage 😄

Worth knowing you can register entirely custom services on the dbus rather than trying to bolt paths onto existing virtual devices. Something like com.victronenergy.temperature.custom_sensor_01 — Cerbo handles it cleanly and it shows up properly in VRM.

On my narrowboat I'm pulling in custom tank level data this way via a Python service running on a Pi Zero 2W alongside the Cerbo. The dbus-python library does the heavy lifting and you can define whatever paths make sense for your application.

Main gotcha: make sure you're setting /Connected and /ProductId correctly or VRM gets grumpy about it. There's a Victron GitHub repo (dbus-recorder examples) that shows the minimum viable service structure — saved me hours of head-scratching.

Rob
Rob
Senior Member
128 posts
thumb_up 27 likes
Joined May 2023
1 month ago
#31909

@MoorLee @MrBodge65 been there, done that, got the sleep deprivation to prove it — the trick nobody mentions is that once you've registered your custom service via com.victronenergy.battery (or whatever you're spoofing), you must keep your keepalive heartbeat under 10 seconds or the GX silently drops it and you spend 45 minutes wondering why your dashboard's gone blank.

bus.add_timeout(9000, lambda: service['/Connected'].set_value(1))

Stick that in and it stops disappearing like my motivation on a wet Tuesday. Also worth checking dbus-monitor --system rather than dbus-spy — cleaner output when you're trying to catch path registration timing issues on a Cerbo.

Relay Nomad
Relay Nomad
Active Member
45 posts
thumb_up 29 likes
Joined Jul 2023
1 month ago
#31912

@MrBodge65 @MoorLee the custom service route is solid but I'd flag one thing — after a Venus OS update it can silently break and you won't necessarily know until something downstream stops behaving. Burnt myself on this on the boat setup, Victron pushed an update and my custom paths just vanished without any obvious error in the logs.

Worth building in some kind of watchdog or at minimum a Node-RED flow that periodically checks the path is still registering properly. A simple dbus-send ping on a timer sorted it for me. Not glamorous but it's caught two or three update-related breakages before they became actual problems.

Check the Venus OS changelog before any update too — they do occasionally restructure the dbus namespace.

Log in to join the discussion.

Log In to Reply