Posts: 411
Threads: 103
Joined: Oct 2016
Reputation:
9
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
Posts: 940
Threads: 161
Joined: Jul 2015
Reputation:
33
10.01.2017, 21:10
(This post was last modified: 10.01.2017, 21:10 by buuuudzik.)
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.
Posts: 1764
Threads: 6
Joined: Jul 2015
Reputation:
117
11.01.2017, 13:47
(This post was last modified: 11.01.2017, 13:51 by Erwin van der Zwart.)
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
Posts: 411
Threads: 103
Joined: Oct 2016
Reputation:
9
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
Posts: 449
Threads: 94
Joined: Jun 2015
Reputation:
6
how to get this working over https? port 443
Posts: 1764
Threads: 6
Joined: Jul 2015
Reputation:
117
(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
Posts: 449
Threads: 94
Joined: Jun 2015
Reputation:
6
(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).
Posts: 7758
Threads: 42
Joined: Jun 2015
Reputation:
447
Does your password contain any special characters?
Posts: 449
Threads: 94
Joined: Jun 2015
Reputation:
6
08.05.2017, 13:55
(This post was last modified: 08.05.2017, 14:19 by gjniewenhuijse.)
(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?
Posts: 7758
Threads: 42
Joined: Jun 2015
Reputation:
447
Have you tried RC1 firmware?
Posts: 449
Threads: 94
Joined: Jun 2015
Reputation:
6
08.05.2017, 14:47
(This post was last modified: 08.05.2017, 15:02 by gjniewenhuijse.)
(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
Posts: 1764
Threads: 6
Joined: Jul 2015
Reputation:
117
08.05.2017, 15:47
(This post was last modified: 08.05.2017, 15:49 by Erwin van der Zwart.)
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
Posts: 449
Threads: 94
Joined: Jun 2015
Reputation:
6
(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
Posts: 2
Threads: 0
Joined: Jan 2018
Reputation:
0
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
Posts: 1764
Threads: 6
Joined: Jul 2015
Reputation:
117
04.01.2018, 07:59
(This post was last modified: 04.01.2018, 08:00 by Erwin van der Zwart.)
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
Posts: 2
Threads: 0
Joined: Jan 2018
Reputation:
0
Thx a mil!
Exactly what I needed
|