send commands via dbus-send ?

This Forum is about the Opentherm gateway (OTGW) from Schelte

Moderator: hvxl

Post Reply
noether
Starting Member
Starting Member
Posts: 10
Joined: Fri Mar 13, 2015 12:46 pm

send commands via dbus-send ?

Post by noether »

Hi,

first of all I am not very familiar to DBUS.

Right now I have a daemon ot-monitor running in a raspberry-pi. The process is sending signals to the "system bus", in fact I can check it via "dbus-monitor --system", so the guy is running good in that sense.

Now I want to command the thermostat via the command line (so I can write scripts). I would say that this should be possible employing the command "dbus-send". I have to say that it is a bit frustrating since it seems to me
a bit cumbersome.

Is the following the right way?

Code: Select all

dbus-send --system --dest=com.tclcode.otmonitor --type=method_call /com/tclcode/otmonitor com.tclcode.otmonitor.Command string:"TT=19.0" 
Despite that for sure the former command is wrong (nothing happens after, not even an error). In the documentation it says that the argument ogf the method much be a QString, but dbus-send only supports strings. No idea if then I could use dbus-send then.

Btw, before I was using the graphical program "d-feet" for interfacing the DBUS and I could click on all the available commands very easily. So I hope it is also easy to interface otmonitor via the command line.

Thanks in advance!
hvxl
Senior Member
Senior Member
Posts: 1965
Joined: Sat Jun 05, 2010 11:59 am
Contact:

Re: send commands via dbus-send ?

Post by hvxl »

There's no error because you didn't indicate to dbus-send that you were interested in that (using the --print-reply option). And nothing happens because you used the wrong value for the object path.

Try this:
dbus-send --system --print-reply --dest=com.tclcode.otmonitor / com.tclcode.otmonitor.Command :"TT=19.0"

You're allowed to specify "--type=method_call" and "string", but those are the defaults, so I skipped them.
Schelte
noether
Starting Member
Starting Member
Posts: 10
Joined: Fri Mar 13, 2015 12:46 pm

Re: send commands via dbus-send ?

Post by noether »

Thank you very much for your help, it works.

Now I see more clear how to use dbus-send, at the beginning I have found a bit confusing the documentation.
hvxl
Senior Member
Senior Member
Posts: 1965
Joined: Sat Jun 05, 2010 11:59 am
Contact:

Re: send commands via dbus-send ?

Post by hvxl »

Normally I prefer qdbus over dbus-send for most situations. It's a bit more user-friendly. But qdbus is not included in raspbian by default. At least not in the version I have installed.
Schelte
Post Reply

Return to “Opentherm Gateway Forum”