Page 1 of 1
Extraction of equivalent elements from JSON-call's response
Posted: Saturday 26 November 2016 19:44
by Toulon7559
With a json-cal including RID you get a response for that specific device.
With a json-call mentioning type of device you get a selective response over a range of devices.
With /json.htm?type=devices&filter=all&used=true&order=Name
you get a response in one big file which combines the latest information on all devices.
It means that for the latter 2 cases in a response-file you have multiple occurrence of Temp, Humidity or Utility.
Is there an easy&simple way to extract e.g. all Temp-values, all Humidity-values or all Utility-values from such response-file in a such way that you can recognize from which device they originated?
Re: Extraction of equivalent elements from JSON-call's response
Posted: Saturday 26 November 2016 20:16
by Egregius
The type and subtype is in the json array.
Or create roomplans to group your devices.
For example: I use a roomplan that holds 60 devices wich are shown on my floorplan. Because I only pull the devices I need the response time and data transfer is only 1/3 compared to all used devices.
Another example: camera with motion detection, that one only needs the status of 3 switches. Why would I pull all?
Re: Extraction of equivalent elements from JSON-call's response
Posted: Sunday 27 November 2016 8:34
by Toulon7559
@Egregius

This is a case in which a solution triggers a next question.
With
this thread I created a 'chain' between Domoticz and my website from a 'simple' JSON-call to one RID till display at my website.

But if you can deal with one RID, the challenge comes how to deal with a series of JSON-calls without simply repeating the process at the 'transmitting side'. Such simple repetition could e.g. be a cronjob calling a series of equivalent scripts.
Regardless how you setup such cronjob, there must be more clever ways to make the 'extraction' of a collection of values for application at the website.
Re: Extraction of equivalent elements from JSON-call's response
Posted: Sunday 27 November 2016 9:47
by Egregius
You're putting the data from domoticz on your webserver to show it there?
Why not pull it directly in your page so you have realtime data?
Re: Extraction of equivalent elements from JSON-call's response
Posted: Sunday 27 November 2016 14:04
by Toulon7559
@ Egregius
The 'pull' you mention is exactly the critical aspect: it requires calling from the internet to my LAN.
I do not want access from the internet to my LAN.
Instead I am looking for a 'pushing' solution, with controlled upload to the webserver.
Perhaps MQTT is the solution, but I have absolutely no experience with that function/application:

a good example may be useful ........
Re: Extraction of equivalent elements from JSON-call's response
Posted: Sunday 27 November 2016 16:47
by Egregius
My domoticz isn't available on the internet, only my webserver

Guess it depends on weither you use server side or client side language. Another advantage of PHP then?
To push: Maybe my pass2php can be altered easily.
Basically it encodes the complete LUA tables and posts them to a PHP page.
If you capture them theire to store them in memcached or anything like that you would have realtime data without opening your lan.
Re: Extraction of equivalent elements from JSON-call's response
Posted: Sunday 27 November 2016 17:52
by Toulon7559

For the upcoming winter-evenings perhaps some time to be spent for study of PHP and MQTT (besides Python-scripts and Javascripts).
Somebody a good hint for literature for Dummies on the subjects PHP and MQTT?
In which 'literature' may also mean an online quick course or instruction.
Re: Extraction of equivalent elements from JSON-call's response
Posted: Sunday 27 November 2016 18:33
by Egregius
Google is your best friend.
Everything I did/do in shell,Python,PHP,... I learned from Google.