HTTP get command for sensor value
Moderators: grovkillen, Stuntteam, TD-er
HTTP get command for sensor value
Hello
how can i get a specific sensor value by the generic
http://<espeasyip>/control?cmd=<command>
espeasy is clear so far, but what is the specific command ?
Thank
how can i get a specific sensor value by the generic
http://<espeasyip>/control?cmd=<command>
espeasy is clear so far, but what is the specific command ?
Thank
Re: HTTP get command for sensor value
You can get the data as JSON.
All sensor data: http://<ip>/json?view=sensorupdate
Specific for a single task: http://<ip>/json?view=sensorupdate&tasknr=2 (tasknr 2)
All sensor data: http://<ip>/json?view=sensorupdate
Specific for a single task: http://<ip>/json?view=sensorupdate&tasknr=2 (tasknr 2)
Re: HTTP get command for sensor value
Thank you very much. Exactly what i need 

Re: HTTP get command for sensor value
Hi,
Thanks for the answer.
But it looks like we get the latest taskX record value, not the actual value.
Is there any command to trigger to read the value of the device?
As I do not speak very well english I'm not sure you'll understand me
. So, here is what I would like:
I've configured a task which work on a ADS1115 to measure a voltage. The voltage is measured every 300 seconds and sended to domoticz through an MQTT broker.
Sometime Domoticz need to have the actual value (not the latest measured), so it will be nice to send a request to the ESP to measure immediatly the device and send the value to the controller(s).
Is it possible ?
Thank you very much.
Thanks for the answer.
But it looks like we get the latest taskX record value, not the actual value.
Is there any command to trigger to read the value of the device?
As I do not speak very well english I'm not sure you'll understand me

I've configured a task which work on a ADS1115 to measure a voltage. The voltage is measured every 300 seconds and sended to domoticz through an MQTT broker.
Sometime Domoticz need to have the actual value (not the latest measured), so it will be nice to send a request to the ESP to measure immediatly the device and send the value to the controller(s).
Is it possible ?
Thank you very much.
- grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
- Contact:
Re: HTTP get command for sensor value
First run a "taskrun" command and you will have the latest value.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you

ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you



Re: HTTP get command for sensor value
Hi,
Thank you very much for this so quick answer !!!
I did'nt knew this command, I will give it a try.
Thank's again.
[EDIT] Yes!! It works as expected!
Thank you:
Thank you very much for this so quick answer !!!
I did'nt knew this command, I will give it a try.
Thank's again.
[EDIT] Yes!! It works as expected!

Re: HTTP get command for sensor value
Hi,
1) Is there a way to obtain the same result for 1 task without json (simplier) ?
2) Where can I find a list of such commands like json, taskrun etc.
Thanks a lot
1) Is there a way to obtain the same result for 1 task without json (simplier) ?
2) Where can I find a list of such commands like json, taskrun etc.
Thanks a lot
Re: HTTP get command for sensor value
See here for a list of the commands: https://espeasy.readthedocs.io/en/lates ... mmand.html
What do you need to get, not in JSON format?
For example like this? (tasks and value numbers start counting at 0)
All values of a task: http://<ip>/csv?tasknr=1
A single value of a task: http://<ip>/csv?tasknr=1&valnr=0
A single value of a task without header: http://<ip>/csv?tasknr=1&valnr=0&header=0
What do you need to get, not in JSON format?
For example like this? (tasks and value numbers start counting at 0)
All values of a task: http://<ip>/csv?tasknr=1
A single value of a task: http://<ip>/csv?tasknr=1&valnr=0
A single value of a task without header: http://<ip>/csv?tasknr=1&valnr=0&header=0
Re: HTTP get command for sensor value
How to request only 1 sensor. For exapmle i need only Temperature, so how can i get it with this json?view=sensorupdate=2
Re: HTTP get command for sensor value
For CSV like output it is possible to address per sensor value.
See: https://espeasy.readthedocs.io/en/lates ... =json#json
See: https://espeasy.readthedocs.io/en/lates ... =json#json
Re: HTTP get command for sensor value
mb i did something wrong, but when i send this
i get this
URI: /csv
Method: GET
Arguments: 1
NAME:tasknr
VALUE:1
works finehttp://<espeasyip>/json?view=sensorupdate&tasknr=2
Re: HTTP get command for sensor value
Could You help me with CSV, where am i wrongTD-er wrote: ↑06 Oct 2020, 20:52 For CSV like output it is possible to address per sensor value.
See: https://espeasy.readthedocs.io/en/lates ... =json#json
Re: HTTP get command for sensor value
What ESPEasy version are you running?
Also keep in mind you need to count from 0.
So tasknr and valnr start counting at 0.
Also keep in mind you need to count from 0.
So tasknr and valnr start counting at 0.
Re: HTTP get command for sensor value
Build:⋄ 20104 - Mega
System Libraries:⋄ ESP82xx Core 3d128e5c, NONOS SDK 2.2.2-dev(38a443e), LWIP: 2.1.2 PUYA support
Git Build:⋄ mega-20200222
Plugin Count:⋄ 46 [Normal]
Build Md5: 19a2bba130d3a8159d57546732ba46
Md5 check: passed.
Build Time:⋄ Feb 21 2020 23:33:15
Binary Filename:⋄ ESP_Easy_mega-20200222_normal_ESP8285_1M.bin
Re: HTTP get command for sensor value
It was merged on May 21st this year: https://github.com/letscontrolit/ESPEas ... 2956/files
So your build doesn't have it yet.
So your build doesn't have it yet.
Re: HTTP get command for sensor value
Please tell me how to convert data from into a readable view, for example from:
{"Sensors": [
{
"TaskValues": [
{"ValueNumber": 1,
"Name": "Temperature",
"NrDecimals": 2,
"Value": 23.50
},
need to get
Temperature: 23.50?
Code: Select all
/ json? View = sensorupdate & taskrun = 2
{"Sensors": [
{
"TaskValues": [
{"ValueNumber": 1,
"Name": "Temperature",
"NrDecimals": 2,
"Value": 23.50
},
need to get
Temperature: 23.50?
Re: HTTP get command for sensor value
Have you tested the csv option as suggested here: https://espeasy.readthedocs.io/en/lates ... ht=csv#csv
???
???
Re: HTTP get command for sensor value
Yes, but I have an old version and is not supported csv.TD-er wrote: ↑14 Oct 2020, 22:57 Have you tested the csv option as suggested here: https://espeasy.readthedocs.io/en/lates ... ht=csv#csv
???
I can not install the new version because the plug-in for the thermostat from here is used.
https://github.com/enesbcs/ESPEasyPlugi ... rmOLED.ino
Thanks.
Re: HTTP get command for sensor value
Please tell me how to get clean data from a json request?
If possible
If possible
Code: Select all
/ json? View = sensorupdate & taskrun = 2
Re: HTTP get command for sensor value
What exactly do you want?
The json URL only outputs JSON formatted text.
The csv URL was added to output a string which was way simpler to parse on other devices without the need to interpret JSON.
So if you don't want to upgrade to a later version, then I don't know how to help here.
Unless I don't understand your question...
The json URL only outputs JSON formatted text.
The csv URL was added to output a string which was way simpler to parse on other devices without the need to interpret JSON.
So if you don't want to upgrade to a later version, then I don't know how to help here.
Unless I don't understand your question...
Re: HTTP get command for sensor value
Or you parse the json output on the receiving platform, if you have the option of processing it using javascript or python, that's really easy.
/Ton (PayPal.me)
Re: HTTP get command for sensor value
So tnank you. Updated to the latest version.
But for some reason, the latest version does not add the _P159_Pushbutton plugin. The rest after being added to define_plugin_sets.h are displayed normally. And _P159_Pushbutton is not visible after adding.
But for some reason, the latest version does not add the _P159_Pushbutton plugin. The rest after being added to define_plugin_sets.h are displayed normally. And _P159_Pushbutton is not visible after adding.
Re: HTTP get command for sensor value
Did you get that source from the Plugin PlayGround? Then it will only be included if PLUGIN_BUILD_TESTING is #defined, you might want to comment out the #ifdef PLUGIN_BUILD_TESTING line at the start of the _P159 source, and also the corresponding #endif at the end of that file.
/Ton (PayPal.me)
Re: HTTP get command for sensor value
I thought enough to put it inAth wrote: ↑18 Oct 2020, 21:24 Did you get that source from the Plugin PlayGround? Then it will only be included if PLUGIN_BUILD_TESTING is #defined, you might want to comment out the #ifdef PLUGIN_BUILD_TESTING line at the start of the _P159 source, and also the corresponding #endif at the end of that file.
// EXPERIMENTAL (playground) #######################
#ifdef PLUGIN_SET_EXPERIMENTAL
turns out to be wrong.
Ok thanks frend.
Re: HTTP get command for sensor value
And now the error, commented out #ifdef PLUGIN_BUILD_TESTING и #endif
When I added _P168_ThermOLED there was this error too, but I replacedexit status 1
'SENSOR_TYPE_SWITCH' was not declared in this scope
onDevice [deviceCount] .VType = SENSOR_TYPE_QUAD;
as elsewhere and everything was compiled.Device [deviceCount] .VType = Sensor_VType :: SENSOR_TYPE_QUAD;
Last edited by 2007-i on 18 Oct 2020, 21:47, edited 1 time in total.
Re: HTTP get command for sensor value
I think that's also a more recent change in the ESPEasy core source code.
Add: #include src/DataStructs/DeviceStruct.h
And append Sensor_VType:: in front of the SENSOR_TYPE_...
Like this: Sensor_VType::SENSOR_TYPE_SWITCH:
Add: #include src/DataStructs/DeviceStruct.h
And append Sensor_VType:: in front of the SENSOR_TYPE_...
Like this: Sensor_VType::SENSOR_TYPE_SWITCH:
Re: HTTP get command for sensor value
In event->sensorType = SENSOR_TYPE_DUAL;'SENSOR_TYPE_DUAL' was not declared in this scope
add too
event->sensorType = Sensor_VType::SENSOR_TYPE_DUAL; ?
Re: HTTP get command for sensor value
Yes, all SENSOR_TYPE_xxx should be prefixed by Sensor_VType::
Re: HTTP get command for sensor value
Hey! I did not saw tour answer (no mail ? "Notify me when a reply is posted" checked now)TD-er wrote: ↑28 Jul 2020, 20:12 See here for a list of the commands: https://espeasy.readthedocs.io/en/lates ... mmand.html
What do you need to get, not in JSON format?
For example like this? (tasks and value numbers start counting at 0)
All values of a task: http://<ip>/csv?tasknr=1
A single value of a task: http://<ip>/csv?tasknr=1&valnr=0
A single value of a task without header: http://<ip>/csv?tasknr=1&valnr=0&header=0
Great!
Thank you very much.
Where did you find all the external http commands?
(sorry, you already answered in next post)
Re: HTTP get command for sensor value
What do you mean by "external http commands" ?DMike92 wrote: ↑16 Aug 2021, 15:02Hey! I did not saw tour answer (no mail ? "Notify me when a reply is posted" checked now)TD-er wrote: ↑28 Jul 2020, 20:12 See here for a list of the commands: https://espeasy.readthedocs.io/en/lates ... mmand.html
What do you need to get, not in JSON format?
For example like this? (tasks and value numbers start counting at 0)
All values of a task: http://<ip>/csv?tasknr=1
A single value of a task: http://<ip>/csv?tasknr=1&valnr=0
A single value of a task without header: http://<ip>/csv?tasknr=1&valnr=0&header=0
Great!
Thank you very much.
Where did you find all the external http commands?
(sorry, you already answered in next post)
You can try commands via the command field on the "tools" page via the web interface.
This will give you some feedback (not always very insightful) on the success of the command.
And maybe also very important, it will show you how the command you gave should be formatted using URL encoding in the URL bar of your browser.
This URL you can then use (and modify to your needs) for calls from other nodes/hosts in your network.
N.B. you can also use "system variables" in the commands, like %uptime% and others shown on the "sysvars" page of your ESPEasy node. (only included in "custom" or "normal" builds due to build size limitations)
Re: HTTP get command for sensor value
Sorry to have bothered you, I saw a little later that your answered my question in the next post of my initial post. The answer was:TD-er wrote: ↑16 Aug 2021, 16:07What do you mean by "external http commands" ?DMike92 wrote: ↑16 Aug 2021, 15:02Hey! I did not saw tour answer (no mail ? "Notify me when a reply is posted" checked now)TD-er wrote: ↑28 Jul 2020, 20:12 See here for a list of the commands: https://espeasy.readthedocs.io/en/lates ... mmand.html
What do you need to get, not in JSON format?
For example like this? (tasks and value numbers start counting at 0)
All values of a task: http://<ip>/csv?tasknr=1
A single value of a task: http://<ip>/csv?tasknr=1&valnr=0
A single value of a task without header: http://<ip>/csv?tasknr=1&valnr=0&header=0
Great!
Thank you very much.
Where did you find all the external http commands?
(sorry, you already answered in next post)
You can try commands via the command field on the "tools" page via the web interface.
This will give you some feedback (not always very insightful) on the success of the command.
And maybe also very important, it will show you how the command you gave should be formatted using URL encoding in the URL bar of your browser.
This URL you can then use (and modify to your needs) for calls from other nodes/hosts in your network.
N.B. you can also use "system variables" in the commands, like %uptime% and others shown on the "sysvars" page of your ESPEasy node. (only included in "custom" or "normal" builds due to build size limitations)
https://espeasy.readthedocs.io/en/lates ... ht=csv#csv
Thanks again. I'm happy now:)
My version does not have the CSV but I can get all variables values with JSON format.
Who is online
Users browsing this forum: Ahrefs [Bot] and 19 guests