Remote Services Objects Limit fields
#1
Hi,

I use the remote services to receive status of all group addresses over the network, which is faster than reading from the KNX bus.  Is it possible to limit the fields returned?

/scada-remote?m=json&r=objects

returns

[{"id":24576,"address":"12\/0\/0","data":false,"datatype":1,"date":"Thu, 07 Jun 2018 12:22:43 -0700","comment":"","name":"AC \/ Home Away","time":1528399363}]

What I would like to receive is just

[{"data":false,"datatype":1,"name":"AC \/ Home Away"}]

Thanks,


Roger
Reply
#2
Hi,

What you can do is create a .lp file and do the request grp.all() and put the wanted fields in the JSON reply.

But why do you want to drop those few extra bytes? IP won’t notice it at all..

BR,

Erwin
Reply
#3
Hi Erwin,

I used the export button on those status objects I need. I guess I will need to tag them instead, since grp.all() will bring everything.

I try to keep everything to minimum, no need sending something when your not going to use it.

Thanks,

Roger
Reply
#4
Hi Roger,

No need to tag, as we can use the export value as condition, see code:
Code:
<?
require('apps')
print(json.encode(db:getall('SELECT "name", "data", "datatype" FROM objects WHERE "export" = 1')))
?>
BR,

Erwin
Reply


Forum Jump: