Read actual sensor value using API
Moderator: leecollings
-
eiaro
- Posts: 12
- Joined: Monday 22 May 2017 12:30
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Norway
- Contact:
Read actual sensor value using API
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?
Any suggestions before I start changing source code?
- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Read actual sensor value using API
Did you even look at the API wiki page? It's full of explanation.
- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Read actual sensor value using API
Did you even look at the API wiki page? It's full of explanation.
-
eiaro
- Posts: 12
- Joined: Monday 22 May 2017 12:30
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Norway
- Contact:
Re: Read actual sensor value using API
Of course I did. 
I *can* use /json.htm?type=devices&rid=IDX, but it return a lot of data I dont need.
I *can* use /json.htm?type=devices&rid=IDX, but it return a lot of data I dont need.
- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Read actual sensor value using API
Just use the ones you need and skip the rest.
-
stlaha2007
- Posts: 370
- Joined: Monday 05 October 2015 10:16
- Target OS: -
- Domoticz version:
- Contact:
Re: Read actual sensor value using API
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
In bash {cli} i do simular thing like: curl 'domosite:8080/json.htm.....' | grep 'value' | awk {}
Sent from my D6603 using Tapatalk
-
tvurce
- Posts: 30
- Joined: Saturday 27 October 2018 19:12
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Read actual sensor value using API
Anybody hawe a good solution to read value fron Json returned String on Arduino (C++)? No problem to get info from Domoticz with
But what now with that string? A lot of stuff there...
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();-
tvurce
- Posts: 30
- Joined: Saturday 27 October 2018 19:12
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Read actual sensor value using API
Probably need to transform from string to char a than use ArduinoJson.h
-
tvurce
- Posts: 30
- Joined: Saturday 27 October 2018 19:12
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Read actual sensor value using API
Oh god, its so stupid. In JASON API output are values not in number format, but in text with kWh word.