Hi,
as a hobby programmer i am trying to buid a ConnectIQ app for my Garmin Forerunner which can control my domoticz instance. Basic functionality is
- Query my favoruite devices
- Present them including the values.
- and if i select a switch i want sent control commands.
I got stuck at the 1st step. Accoording to the documentation i should be using the "/json.htm?type=devices&used=true&filter=all&favorite=1" command to query my favourite devices. The output is there, but i get way too much information in the response. The response is about 23k for about 10 devices, and i get an error (http response is only allowed to be 16k for connect iq devices, beacuse i only have 64kb ram on my garmin watch) on my watch, so it is not useable.
For the 1st call i only need a list containing
- the device names
- idx
- device type
- optional: value (would be nice if i get it in the 1st api call. If not possible: if i have the 1st 3 fields, I can query each individual device in a later stage of the user journey)
as output of a json command
something like the ouput of json.htm?type=command¶m=getlightswitches or /json.htm?type=command¶m=getplandevices&idx=idx , would be work, however these commands give back the wrong selection.
So does anyone know how to do this? (or know another way, so it i can the limit the response to 16k max)?
reduce json API output
Moderator: leecollings
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: reduce json API output
Could this work for you ?akamming wrote: ↑Wednesday 02 January 2019 9:44 According to the documentation i should be using the "/json.htm?type=devices&used=true&filter=all&favorite=1" command to query my favorite devices. The output is there, but i get way too much information in the response. The response is about 23k for about 10 devices.
For the 1st call i only need a list containing
- the device names
- idx
- device type
- optional: value (would be nice if i get it in the 1st api call. If not possible: if i have the 1st 3 fields, I can query each individual device in a later stage of the user journey)
as output of a json command
Put the required devices in a scene
http://domoticzIP:domoticzPORT/json.htm?type=command¶m=getscenedevices&idx=<your scene id>&isscene=true
or put them in a roomplan
http://domoticzIP:domoticzPORT/json.htm?type=command¶m=getplandevices&idx=<your roomplan id>
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Re: reduce json API output
akamming wrote: ↑Wednesday 02 January 2019 9:44 Hi,
as a hobby programmer i am trying to buid a ConnectIQ app for my Garmin Forerunner which can control my domoticz instance. Basic functionality is
- Query my favoruite devices
- Present them including the values.
- and if i select a switch i want sent control commands.
I got stuck at the 1st step. Accoording to the documentation i should be using the "/json.htm?type=devices&used=true&filter=all&favorite=1" command to query my favourite devices. The output is there, but i get way too much information in the response. The response is about 23k for about 10 devices, and i get an error (http response is only allowed to be 16k for connect iq devices, beacuse i only have 64kb ram on my garmin watch) on my watch, so it is not useable.
For the 1st call i only need a list containing
- the device names
- idx
- device type
- optional: value (would be nice if i get it in the 1st api call. If not possible: if i have the 1st 3 fields, I can query each individual device in a later stage of the user journey)
as output of a json command
something like the ouput of json.htm?type=command¶m=getlightswitches or /json.htm?type=command¶m=getplandevices&idx=idx , would be work, however these commands give back the wrong selection.
So does anyone know how to do this? (or know another way, so it i can the limit the response to 16k max)?
or use this script

thanks to warren
viewtopic.php?f=72&t=25168
-
- Posts: 368
- Joined: Friday 17 August 2018 14:03
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: reduce json API output
Hi, yes. This is my current workaround, so i can continue developing. But this requires configuration on domoticz side before the app on the watch works. When i publish my app, i need to apply the KISS (Keep it Stupid Simple) principle and use the app as a simple fronted for an existing domoticz instance. For that purpose i need to be able to do a json request which retrieves my favorite devices, but gives less ouput.waaren wrote: ↑Wednesday 02 January 2019 10:15 Could this work for you ?
Put the required devices in a scene
http://domoticzIP:domoticzPORT/json.htm?type=command¶m=getscenedevices&idx=<your scene id>&isscene=true
or put them in a roomplan
http://domoticzIP:domoticzPORT/json.htm?type=command¶m=getplandevices&idx=<your roomplan id>
-
- Posts: 368
- Joined: Friday 17 August 2018 14:03
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: reduce json API output
Thanks for the answer, but i do not understand how i can apply this to an app which is run on the watch (a forerunner 630). Can you clarify?devros wrote: ↑Wednesday 02 January 2019 12:35akamming wrote: ↑Wednesday 02 January 2019 9:44 Hi,
as a hobby programmer i am trying to buid a ConnectIQ app for my Garmin Forerunner which can control my domoticz instance. Basic functionality is
- Query my favoruite devices
- Present them including the values.
- and if i select a switch i want sent control commands.
I got stuck at the 1st step. Accoording to the documentation i should be using the "/json.htm?type=devices&used=true&filter=all&favorite=1" command to query my favourite devices. The output is there, but i get way too much information in the response. The response is about 23k for about 10 devices, and i get an error (http response is only allowed to be 16k for connect iq devices, beacuse i only have 64kb ram on my garmin watch) on my watch, so it is not useable.
For the 1st call i only need a list containing
- the device names
- idx
- device type
- optional: value (would be nice if i get it in the 1st api call. If not possible: if i have the 1st 3 fields, I can query each individual device in a later stage of the user journey)
as output of a json command
something like the ouput of json.htm?type=command¶m=getlightswitches or /json.htm?type=command¶m=getplandevices&idx=idx , would be work, however these commands give back the wrong selection.
So does anyone know how to do this? (or know another way, so it i can the limit the response to 16k max)?
or use this script
thanks to warren
viewtopic.php?f=72&t=25168
- gizmocuz
- Posts: 2546
- Joined: Thursday 11 July 2013 18:59
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Top of the world
- Contact:
Re: reduce json API output
You can put them in a 'room' and retrieve all sensors from a specific room
Quality outlives Quantity!
-
- Posts: 368
- Joined: Friday 17 August 2018 14:03
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: reduce json API output
Yes, that' technically works (i use it currently as a workaround, so i can develop the rest of the code). It is basically the same suggestion i got from waaren. however I would like the watch app to show me my favourite devices and their values (like on the domoticz dashboard) and not from a specific room.
Based on the answers you and waaren gave me: Can i conclude there is no API call which can retrieve the favorite devices with a http response below 16kb? Cause then indeed the 2nd best option is using roomplans.
Re: reduce json API output
With this advents script you can create own json file in domoticz, and set witch IDX and value ... then you can create small json file with specific data you want...akamming wrote: ↑Wednesday 02 January 2019 17:42Thanks for the answer, but i do not understand how i can apply this to an app which is run on the watch (a forerunner 630). Can you clarify?devros wrote: ↑Wednesday 02 January 2019 12:35akamming wrote: ↑Wednesday 02 January 2019 9:44 Hi,
as a hobby programmer i am trying to buid a ConnectIQ app for my Garmin Forerunner which can control my domoticz instance. Basic functionality is
- Query my favoruite devices
- Present them including the values.
- and if i select a switch i want sent control commands.
I got stuck at the 1st step. Accoording to the documentation i should be using the "/json.htm?type=devices&used=true&filter=all&favorite=1" command to query my favourite devices. The output is there, but i get way too much information in the response. The response is about 23k for about 10 devices, and i get an error (http response is only allowed to be 16k for connect iq devices, beacuse i only have 64kb ram on my garmin watch) on my watch, so it is not useable.
For the 1st call i only need a list containing
- the device names
- idx
- device type
- optional: value (would be nice if i get it in the 1st api call. If not possible: if i have the 1st 3 fields, I can query each individual device in a later stage of the user journey)
as output of a json command
something like the ouput of json.htm?type=command¶m=getlightswitches or /json.htm?type=command¶m=getplandevices&idx=idx , would be work, however these commands give back the wrong selection.
So does anyone know how to do this? (or know another way, so it i can the limit the response to 16k max)?
or use this script
thanks to warren
viewtopic.php?f=72&t=25168
Who is online
Users browsing this forum: No registered users and 1 guest