arendst / Tasmota

Alternative firmware for ESP8266 and ESP32 based devices with easy configuration using webUI, OTA updates, automation using timers or rules, expandability and entirely local control over MQTT, HTTP, Serial or KNX. Full documentation at
https://tasmota.github.io/docs
GNU General Public License v3.0
22.12k stars 4.79k forks source link

Missing example in the docs/Scripting-Language to retrieve .json from url: how to use gjp("host" "path")? #12964

Closed MagTun closed 3 years ago

MagTun commented 3 years ago

PROBLEM DESCRIPTION

A clear and concise description of what the problem is. I want to use my tasmota smart plug to turn ON/OFF my DIY air filter when my Luftdaten sensor is above a certain threshold). The smart plug should connect to my json local url (like http://192.168.1.39:888/data.json) and based on the data in this json the plug should switch on and off. Following the docs/Scripting-Language, in user_config_override.h, I enabled reading HTTPS JSON WEB Pages with #define SCRIPT_GET_HTTPS_JP but don't find any ressource on how I can use gjp("host" "path") to get the data on the json. The only mention is :

gjp("host" "path") = trigger HTTPS JSON page read as used by Tesla Powerwall (if defined SCRIPT_GET_HTTPS_JP)

A lot of others features are well documented but not this one.

Among other, the missing information are:

An example of the full script from send request/retrieve the request is really needed on the documentation

(After these step I will have to send the command "http://192.168.1.54/cm?cmnd=Power%20On" or "http://192.168.1.54/cm?cmnd=Power%20Off" based on the extracted json value and then recheck the json every 140secs ?

REQUESTED INFORMATION

Make sure your have performed every step and checked the applicable boxes before submitting your issue. Thank you!

Not needed

- [ ] If using rules, provide the output of this command: `Backlog Rule1; Rule2; Rule3`:
```lua
  Rules output here:
- [ ] Set `weblog` to 4 and then, when you experience your issue, provide the output of the Console log:
```lua
  Console output here:

TO REPRODUCE

Steps to reproduce the behavior:

EXPECTED BEHAVIOUR

A clear and concise description of what you expected to happen.

SCREENSHOTS

If applicable, add screenshots to help explain your problem.

ADDITIONAL CONTEXT

Add any other context about the problem here.

(Please, remember to close the issue when the problem has been addressed)

ascillato2 commented 3 years ago

Moving to discussions as this is a question not a Tasmota's bug report.