abbrechen
Suchergebnisse werden angezeigt für 
Anzeigen  nur  | Stattdessen suchen nach 
Meintest du: 
Beantwortet! Gehe zur Lösung.

API usage questions (2)

After getting my API-Token (and refreshing it) I stumbled on the following questions:

 

-Since the number of API-Calls are limited the use a single call for each requested value is not the intended way, how shall we concentate multiple requests in one API-Call? An example of such a request on the Portal would help users to create such calls, which in turn would reduce the load on your server.

 

-Currently I am using 

getHeatingBurnerStatistics("hours") and
getHeatingBurnerStatistics("starts"), however both are not listed on the Developer Portal (Tab IOT). Are these the ones that are no longes accesible in the new API.
1 AKZEPTIERTE LÖSUNG

Akzeptierte Lösungen

I just tried it out and works like a charm:

 

I don't know if it is necessary to urlencode all the brackets but it certainly doesn't hurt.

 

Edit: the url is cropped when I post it - it ends with:

 

  •  ?regex=heating.solar.%28pumps.circuit%7Csensors.temperature.%28collector%7Cdhw%29%29

Lösung in ursprünglichem Beitrag anzeigen

13 ANTWORTEN 13

I would second that request, as those are some of the most important properties of a heating system  - how often did the burner start and how long did it run, as well as ideally also the current modulation of the burner.

 

heating.burner.modulation

heating.burner.statistics.hours

heating.burner.statistics.starts

 

Please enable access to those simple three number values for the Developer Portal API Keys  - thanks a lot in advance!

@phildaub23 

Do you have an idea how to concentate several API Calls or shall we allways call for all features (I don't think/hope so). 

@JueBag yes sure, just call the device features api and you get all sensor values of your device at once in one single request.

@JueBag or did I understand you wrong? If you need only a few specific values and not everything all the time, you can filter with a regex in the request, like described in the API documentation:

 

  • regex
  • heating.circuits.%5b0-2%5d.operating.programs.\w+$
  • regular expression query for returning only matched features

Thanks for the answer, however I was hoping for another answer (from Viessmann!). IMHO most users won't need all those data points (for me its only 91). That (desired?) procedure will be causing unneccessary load, wasn't that reason to come up with an API limit?

??

I migth have missunderstood that part of the docs.

Is that filtering with regex working on the request (i.e. really limiting what is sent to me), I (miss?)understood that as filtering the response. 

Yes you understood that right, it filters the response.

 

Did you try it? You can do ranges, wildcards, or select multiple different data points via regex "or" operators.

 

if you need lets say those three features:

 

  • heating.solar.pumps.circuit 
  • heating.solar.sensors.temperature.collector 
  • heating.solar.sensors.temperature.dhw

 

you can request it via the regex:

 

  • heating.solar.(pumps.circuit|sensors.(temperature.collector|temperature.dhw))

This allows you to "concentate several API Calls"

Thanks for those insights.

If its really filtering on the received response ( in other words I do get the whole answer) I'll probaly stick with parsing the JSON string.

 

No, you do not get the whole answer, you get only those data points you are interested in. Also, this (much shorter) response also needs less data transfer of course. The response has to be JSON parsed anyways, the only difference is whether you are getting one huge JSON or a much smaller JSON that is only containing interesting data.

Now I got! (.stupid.me!)

 

Could I ask you for an example call, because I do not understand how to do this concetation with REGEX.

The example in the docs just show 

https://api.viessmann.com/iot/v1/equipment/installations/{installationId}/gateways/{gatewaySerial}/d...features{?regex,filter}

The problem is what to put in for bold part.

-the term "features" is needed, but no "/" afterwards?

-Is the "?" and/or the term "regex" needed?

- Would such:

  • heating.solar.(pumps.circuit|sensors.(temperature.collector|temperature.dhw))

be a correct concentated input for the filter?

 

 

 

I just tried it out and works like a charm:

 

I don't know if it is necessary to urlencode all the brackets but it certainly doesn't hurt.

 

Edit: the url is cropped when I post it - it ends with:

 

  •  ?regex=heating.solar.%28pumps.circuit%7Csensors.temperature.%28collector%7Cdhw%29%29

Thank you very much!

 

I'll incooperate that into my requests.

 

Since I'm coming from the openHAB community, I'll post my (more correctly yours!) findings in a tutorial thread on the openHAB forum.

Glad I could help!