Page 1 of 1

Retrieve status of specific device using dzVents

Posted: Saturday 06 March 2021 9:19
by Number8
Hello
I'm wondering whether there is an equivalent in dzVents to this API. I searched the Wiki without success so far

Code: Select all

/json.htm?type=devices&rid=IDX
that returns among other things current

"AstrTwilightEnd": "19:39",
"AstrTwilightStart": "06:06",
"CivTwilightEnd": "18:20",
"CivTwilightStart": "07:24",
"DayLength": "09:46",
"NautTwilightEnd": "19:00",
"NautTwilightStart": "06:45",
"SunAtSouth": "12:52",
"Sunrise": "08:00",
"Sunset": "17:45"

Thank you

Re: Retrieve status of specific device using dzVents

Posted: Saturday 06 March 2021 9:32
by waaren
Number8 wrote: Saturday 06 March 2021 9:19 I'm wondering whether there is an equivalent in dzVents to this API. I searched the Wiki without success so far

Code: Select all

/json.htm?type=devices&rid=IDX
these values are stored in Lua table _G.timeofday

To show them use something like

Code: Select all

return
{
    on =
    {
        timer =
        {
            'every minute',
        },
    },

    execute = function(dz)

        for timeOfDay, value in pairs(_G.timeofday) do
            dz.log(timeOfDay .. ': ' .. tostring(value) )
        end

    end
}
To get all attributes of a specific device use

Code: Select all

dz.devices(idx).dump()

Re: Retrieve status of specific device using dzVents

Posted: Saturday 06 March 2021 14:03
by Number8
Hum, I tried both. I don't think it gives the same kind of output; JSON API returns

Code: Select all

{
	"ActTime" : 1615017135,
	"AstrTwilightEnd" : "20:26",
	"AstrTwilightStart" : "05:41",
	"CivTwilightEnd" : "19:15",
	"CivTwilightStart" : "06:52",
	"DayLength" : "11:23",
	"NautTwilightEnd" : "19:50",
	"NautTwilightStart" : "06:16",
	"ServerTime" : "2021-03-06 08:52:15",
	"SunAtSouth" : "13:03",
	"Sunrise" : "07:22",
	"Sunset" : "18:45",
	"app_version" : "2020.2 (build 12485)",
	"status" : "OK",
	"title" : "Devices"
}
Thanks

Re: Retrieve status of specific device using dzVents

Posted: Saturday 06 March 2021 18:12
by waaren
Number8 wrote: Saturday 06 March 2021 14:03 Hum, I tried both. I don't think it gives the same kind of output; JSON API returns
Thanks
I consider hh:mm the "same kind' as time in minutes since midnight but if you think differently you have to do some calculation yourself.