Page 1 of 1
Read actual sensor value using API
Posted: Monday 22 May 2017 12:33
by eiaro
I've read and searched, but haven't been able to find a way to get the current last reading of a sensor using the API.
Any suggestions before I start changing source code?
Re: Read actual sensor value using API
Posted: Monday 22 May 2017 14:08
by Egregius
Did you even look at the API wiki page? It's full of explanation.
Re: Read actual sensor value using API
Posted: Monday 22 May 2017 14:08
by Egregius
Did you even look at the API wiki page? It's full of explanation.
Re: Read actual sensor value using API
Posted: Monday 22 May 2017 14:34
by eiaro
Of course I did.
I *can* use /json.htm?type=devices&rid=IDX, but it return a lot of data I dont need.
Re: Read actual sensor value using API
Posted: Monday 22 May 2017 15:34
by Egregius
Just use the ones you need and skip the rest.
Re: Read actual sensor value using API
Posted: Thursday 06 July 2017 10:36
by stlaha2007
Look at the python, lua examples for a way to filter the exact value...
In bash {cli} i do simular thing like: curl 'domosite:8080/json.htm.....' | grep 'value' | awk {}
Sent from my D6603 using Tapatalk
Re: Read actual sensor value using API
Posted: Sunday 31 May 2020 11:58
by tvurce
Anybody hawe a good solution to read value fron Json returned String on Arduino (C++)? No problem to get info from Domoticz with
Code: Select all
int httpCode = http.GET();
if (httpCode > 0) {
if (httpCode == 200) {
String payload = http.getString();
Serial.println("Domoticz response ");
Serial.println(payload);
}
}
http.end();
But what now with that string? A lot of stuff there...
Re: Read actual sensor value using API
Posted: Sunday 31 May 2020 14:19
by tvurce
Probably need to transform from string to char a than use ArduinoJson.h
Re: Read actual sensor value using API
Posted: Sunday 31 May 2020 14:41
by tvurce
Oh god, its so stupid. In JASON API output are values not in number format, but in text with kWh word.