Logic Machine Forum
Remote Services Objects Limit fields - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: General (https://forum.logicmachine.net/forumdisplay.php?fid=2)
+--- Thread: Remote Services Objects Limit fields (/showthread.php?tid=1432)



Remote Services Objects Limit fields - rocfusion - 07.06.2018

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


RE: Remote Services Objects Limit fields - Erwin van der Zwart - 07.06.2018

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


RE: Remote Services Objects Limit fields - rocfusion - 07.06.2018

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


RE: Remote Services Objects Limit fields - Erwin van der Zwart - 07.06.2018

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