This page last changed on May 17, 2014 by pz1.

The Razberry now has http.request() to push data using HTTP requests. In order to get rid of continuous inefficient polling at the OpenRemote side, this could be a solution. So I read the REST API docs again. I did notice that the "Send Write command" can do a couple of things:

    Switch: ON/OFF
    Slider: some integer or float, e.g. 27
    Button: click
    Gesture: swipe

Unfortunately no Status update in that list. Is that correct? If so why wasn't that considered?
If not what am I overlooking?

PS: At the moment sockets are not yet supported in Razberry, but they may come in a couple of months.

Status.PNG (image/png)
ON.PNG (image/png)


Posted by pz1 at May 28, 2014 10:59

This is used by the console to send an action to the controller. Maybe if you use a virtual command and rules to take the received command to update a sensor this could be a workaround.

Posted by mredeker at May 29, 2014 21:21

Thanks Marcus. Thought about that myself, but I'm not to fond of Drools anymore.

Posted by pz1 at May 30, 2014 09:41

The first draft of the REST API stated as it goal:

The first draft of Controller 2.0 REST API (this is the API between panels and other external client software that wants to integrate with OR Boss controller)

So in the intention it is definitely not constrained to consoles.

So I dug a bit deeper into this. So following the REST instructions I made a command instruction for the status sensor. In the controller.xml file I did find the the necessary command_id for my specific sensor command. As this command afaik does not have any parameters I added null

It is clumsy, I know. But it is for the principle to see if and how I could send a sensor update command using the standard functions of OpenRemote.

With Firefox the URL returns

<openremote xsi:schemaLocation="">

Unfortunately I do not see in the logs that a status call has been made.
I have tried the same from a http call within OR, where I could explicitly specify content-type and GET/POST. This gave many errors that I have to dig in first.
May be later more here.

Posted by pz1 at Oct 30, 2014 13:57

You cannot modify a sensor through the rest api.
You can only send what a console would send when a button is pushed or a slider is moved wich would trigger a command.

Posted by mredeker at Oct 31, 2014 08:47

How is this restricted then to a console? Must it identify itself to the controller to let this happen? The REST aPI documentation says nothing about that.

My intention is to Send Write Command using the syntax


I expected I could turn a switch on from a piece of code that sends the following URL

But that apparantly should not work?

Posted by pz1 at Oct 31, 2014 10:02

You are right that it is not restricted to a console. You can just call the URL from a browser and the light turns on.
What I mean is that you cannot modify a sensor value through this API. Sensor values can only be modified from status commands from within the controller.

Posted by mredeker at Oct 31, 2014 10:19

Sensor values can only be modified from status commands from within the controller

That is what I initially tried to achieve. Do a Send Write Command to the status command I defined for this particular switch.

(My ultimate goal is to work around polling from within OR. At every "value change"event on the RaZberry side, RaZberry should call this OR status command, which in turn asks RaZberry to send the value.)

Posted by pz1 at Oct 31, 2014 10:34

I know your goal but it is not possible unless you create your own protocol and implement this in Java.

Posted by mredeker at Oct 31, 2014 10:51

So in conclusion, a (http) command connected to a switch can be activated with a REST send write, but the almost identical command connected to a sensor, can not.

Posted by pz1 at Oct 31, 2014 11:17

You can call it but the one connected to the sensor will not update the sensor value. It will execute the HTTP call but the result is not evaluated.
If you look into the java source of you will see that the class implements to interfaces "ExecutableCommand" and "EventListener". The call from the REST API will trigger the method related to "ExecutableCommand". The logic to fill a sensor is related to "EventListener" interface.

Posted by mredeker at Oct 31, 2014 12:08

Thanks this helps. So my problem is in the HttpGetCommand, and not in the REST API part?
If so, would it be conceivable to make a variant of the HttpGetCommand, which does fill a sensor? Or is that a silly question?
Sorry for being so tenacious.

Posted by pz1 at Oct 31, 2014 12:39

Looking at the source of the "stuff" happening when calling the REST URL, a modified HttpGetCommand will not work.

Posted by mredeker at Nov 02, 2014 07:37

Marcus, thank you for taking the time to look into this.

Posted by pz1 at Nov 02, 2014 09:04

The required functionality was implemented with UDPListener and a rule. It is described in one of the HowTo's

Posted by pz1 at Dec 24, 2014 09:38
Document generated by Confluence on Jun 05, 2016 09:31