send commands via dbus-send ?

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

Moderator: hvxl

send commands via dbus-send ?

Postby noether » Mon Jan 25, 2016 8:15 pm

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!
noether
Starting Member
Starting Member
 
Posts: 10
Joined: March 2015

Re: send commands via dbus-send ?

Postby hvxl » Mon Jan 25, 2016 10:31 pm

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
hvxl
Senior Member
Senior Member
 
Posts: 1180
Joined: June 2010

Re: send commands via dbus-send ?

Postby noether » Mon Jan 25, 2016 11:51 pm

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.
noether
Starting Member
Starting Member
 
Posts: 10
Joined: March 2015

Re: send commands via dbus-send ?

Postby hvxl » Tue Jan 26, 2016 1:24 pm

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
hvxl
Senior Member
Senior Member
 
Posts: 1180
Joined: June 2010


Return to Opentherm Gateway Forum

Who is online

Users browsing this forum: No registered users and 1 guest