The easiest way to get data from Domoticz is via JSON. You call a special URL and Domoticz returns information in the JSON format.
First you need to know the IDX number of the device you want to query. You can get this from Domoticz, Setup, Devices.
Here the IRX I want to use is 4
Now you can construct your JSON URL. Take a look at the Domoticz Wiki for more info.
For this example we want return information about a single device, so we use a URL like this:
http://yourserver:8080/json.htm?type=devices&rid=4where rid is the IRX number you looked up.
If you paste that URL in to a browser you should get a JSON string returned, something like this:
Not very well formatted, but you can see that all the data from the sensor is there.
Correctly formatted, it looks more like this, you can clearly see the format of the data, and what all the fields are called.:
The best way to get this data in to Tasker is with the Javascript JSON.parse command. This is best shown by an example.
1. Variable Set
%rid = 4, set this to whatever IDX number you want
2. HTTP Get
http://yourserver:8080/json.htm?type=devices&rid=%rid
3. If HTTPR = 200
Checks that the HTTP Get returned without error.
4. JavaScript
Call JavaScript domdev2.js. This is where the parsing happens.
This script parses the JSON text and creates 5 new variables in Tasker
%domstatus - Status of device
%domhumidity - Humidity
%domtemp - Temperature
%domlast - Human readable last update date/time
%domlasts - Number of seconds since last update
5. Flash the variables to prove its worked
6. End If
And thats it.