I need to get an HTTP element value of the form “input:0” or “switch:0” but I do not know how to do it.
The following is part of the HTTP Get sentence result (pretty print indentation is not captured in the published text, sorry):
{
“ble”: {
“enable”: false
},
“cloud”: {
“enable”: true,
“server”: “shelly-20-eu.shelly.cloud:6022/jrpc”
},
“eth”: {
“enable”: true,
“ipv4mode”: “dhcp”,
“ip”: null,
“netmask”: null,
“gw”: null
},
“input:0”: {
“id”: 0,
“name”: null,
“type”: “switch”,
“invert”: false
},
“input:1”: {
“id”: 1,
“name”: null,
“type”: “switch”,
“invert”: false
},
“input:2”: {
“id”: 2,
“name”: null,
“type”: “switch”,
“invert”: false
},
“input:3”: {
“id”: 3,
“name”: null,
“type”: “switch”,
“invert”: false
},
“mqtt”: {
“enable”: false,
“server”: null,
“user”: null,
“pass”: null
},
“switch:0”: {
“id”: 0,
“name”: “ProEra-1-1”,
“in_mode”: “flip”,
“initial_state”: “off”,
“auto_on”: false,
“auto_on_delay”: 60.00,
“auto_off”: false,
“auto_off_delay”: 60.00,
“power_limit”: 3500
},
“switch:1”: {
etc
How can I get for example the “type” of “input:0”, or the “name” of “switch:0” parameters?
It might be something of the form:
mode = getConfig.data.input[channel].type;
sh_name = getConfig.data.switch[channel].name;
Forgive me for my lack of knowledge.
Thank you very much.