This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Set KNX object's value via HTTP?
#1
Hi
I can read exported objects values. But
Is it possible to set a new value to KNX object through LM via REST API, SOAP etc?
If so do you have any excample?
 
Thank you
LM5Lp, firmware: 2018.08.22 and 2021.12.15, FlashSYS v2, ARMv7 Processor rev 5 (v7l), kernel 4.4.151 and 4.4.259
Reply
#2
Here you have a full description of read/set function:
http://openrb.com/docs/remote-new.htm

Write value of 50 to 1/1/1:
Code:
http://remote:remote@192.168.0.10/scada-remote?m=json&r=grp&fn=write&alias=1/1/1&value=50

To use this function you must first enable Remote services in "System config" and set some login and password for this service.
Reply
#3
Hi,

Here is a full sample:

You must enable remote services and check the objects for export and use this LUA command to have HTTP communication for older FW use:

Code:
require('socket.http')
socket.http.TIMEOUT = 5

-- Read from object
local reply = socket.http.request('http://remote:remote@192.168.0.10/cgi-bin/scada-remote/request.cgi?m=json&r=grp&fn=getvalue&alias=0/0/8')
grp.write('0/0/7', reply)

-- Write to object
value = grp.getvalue('0/0/7')
local reply = socket.http.request('http://remote:remoter@192.168.0.10/cgi-bin/scada-remote/request.cgi?m=json&r=grp&fn=write&alias=0/0/8&value=' .. value .. '')

See for all possible syntax this URL: http://www.openrb.com/docs/remote.htm

For new (and BETA) FW use:

Code:
require('socket.http')
socket.http.TIMEOUT = 5

-- Read from object
local reply = socket.http.request('http://remote:remote@192.168.0.10/scada-remote?m=json&r=grp&fn=getvalue&alias=0/0/8')
grp.write('0/0/7', reply)

-- Write to object
value = grp.getvalue('0/0/7')
local reply = socket.http.request('http://remote:remote@192.168.0.10/scada-remote?m=json&r=grp&fn=write&alias=0/0/8&value=' .. value .. '')

See for all possible syntax this URL: http://www.openrb.com/docs/remote-new.htm

I strongly recommend to change the default remote password..

BR,

Erwin
Reply
#4
Thank you
It works perfectly!
LM5Lp, firmware: 2018.08.22 and 2021.12.15, FlashSYS v2, ARMv7 Processor rev 5 (v7l), kernel 4.4.151 and 4.4.259
Reply
#5
how to get this working over https? port 443
Reply
#6
(08.05.2017, 10:03)gjniewenhuijse Wrote: how to get this working over https? port 443

Hi Gert-Jan,

Like this:

Code:
require('ssl.https')
ssl.https.TIMEOUT = 5

-- Read from object
local reply = ssl.https.request('https://remote:remote@www.yourdomain.com/scada-remote?m=json&r=grp&fn=getvalue&alias=1/1/1')
log(reply)

BR,

Erwin
Reply
#7
(08.05.2017, 10:18)Erwin van der Zwart Wrote:
(08.05.2017, 10:03)gjniewenhuijse Wrote: how to get this working over https? port 443

Hi Gert-Jan,

Like this:

Code:
require('ssl.https')
ssl.https.TIMEOUT = 5

-- Read from object
local reply = ssl.https.request('https://remote:remote@www.yourdomain.com/scada-remote?m=json&r=grp&fn=getvalue&alias=1/1/1')
log(reply)

BR,

Erwin

Hello,

It doesn't work. When i use this link in a browser without user/password it works (after entering my credentials in the popup).
Reply
#8
Does your password contain any special characters?
Reply
#9
(08.05.2017, 13:45)admin Wrote: Does your password contain any special characters?

nope, in the format: abc12345

result log:
* arg: 1
  * nil
* arg: 2
  * string: revcd alert fatal error
* arg: 3
  * nil
* arg: 4
  * nil

or is there a better/safer way to sync some groupaddresses between a homelynk and a logicmachine?
Reply
#10
Have you tried RC1 firmware?
Reply
#11
(08.05.2017, 14:44)admin Wrote: Have you tried RC1 firmware?

nope its our production environment.

HL 1.5.1 <-> LM4 20160927

(08.05.2017, 14:44)admin Wrote: Have you tried RC1 firmware?

its works with RC1 instead of using the HL.

LM4 RC1 -> LM4 2060927
Reply
#12
Hi,

I tested it on HL FW 2.0.0 and it should work, but ssl.https should also work on older HL FW as i use it for Pushover also..

BR,

Erwin
Reply
#13
(08.05.2017, 15:47)Erwin van der Zwart Wrote: Hi,

I tested it on HL FW 2.0.0 and it should work, but ssl.https should also work on older HL FW as i use it for Pushover also..

BR,

Erwin

Problem solved after installing HL FW 2.0.0
Reply
#14
Hi,

I'm new to this, so please excuse any obvious question...
I'd like to use a remote url, like https://remote:remote@www.yourdomain.com/scada-remote?
I know how to write a value for an object, say 2/2/6:
http://remote:remote@192.168.0.10/scada-...6&value=50
so far so good.

All my blinds are on 2/2/x, and I'd like to write a value (say 0) to all the 2/2/x objects.
Is that possible with a single request? (I tagged all my objects and I tried to use the "&tags=xxx" parameters, but it doesn't work).
Any help much appreciated.
Thx
Reply
#15
Hi,

'tags' is not a valid parameter for the remote services 'grp' function.

What you can do is create a new (virtual) object and attach this script to it (change tag name to your tag name):
Code:
value = event.getvalue()
myobjects = grp.tag('tag name')
myobjects:write(value)
You can now send a single command to the new created (virtual) object with the remote service to trigger multiple objects.

BR,

Erwin
Reply
#16
Thx a mil!
Exactly what I needed Smile
Reply


Forum Jump: