Shelly UNI + Command line switch using curl

Hi there,

Looking for some help here, trying to control a cloud shelly UNI using command line switch.

Turning ON and OFF is working fine.

Problem is getting the state, somehow, I cannot get the state of the switch.

command_line:
  switch:
    name: Garage Remote
    command_on: curl -X POST https://shelly-xx-eu.shelly.cloud/device/relay/control -d "channel=0&turn=on&id=XXXX&auth_key=XXXXX"
    command_off: curl -X POST https://shelly-xx-eu.shelly.cloud/device/relay/control -d "channel=0&turn=off&id=XXXXX&auth_key=XXXXX"
    command_state: curl -X POST https://shelly-xx-eu.shelly.cloud/device/status -d "id=XXXXX&auth_key=XXXXXX"
    value_template: "{{ value_json['data']['relays']['ison'] }}"

Tried many value_templates with no success.

Can anyone help?

Postman output when making a post to status.

{
    "isok": true,
    "data": {
        "online": true,
        "device_status": {
            "ram_total": 50776,
            "_updated": "2023-09-20 16:30:34",
            "update": {
                "status": "idle",
                "has_update": false,
                "new_version": "20230913-114521/v1.14.0-gcb84623",
                "old_version": "20230913-114521/v1.14.0-gcb84623"
            },
            "has_update": false,
            "cfg_changed_cnt": 2,
            "serial": xxxxxx,
            "ext_temperature": [],
            "wifi_sta": {
                "connected": true,
                "ssid": "xxxxxxxxxxxxxx",
                "ip": "xxxxxxxxxxx",
                "rssi": -82
            },
            "fs_size": 233681,
            "cloud": {
                "enabled": true,
                "connected": true
            },
            "mqtt": {
                "connected": false
            },
            "adcs": [
                {
                    "voltage": 0.07
                }
            ],
            "ext_sensors": [],
            "ext_humidity": [],
            "inputs": [
                {
                    "input": 0,
                    "event": "",
                    "event_cnt": 0
                },
                {
                    "input": 0,
                    "event": "",
                    "event_cnt": 0
                }
            ],
            "fs_free": 147337,
            "actions_stats": {
                "skipped": 0
            },
            "relays": [
                {
                    "ison": true,
                    "has_timer": true,
                    "timer_started": 1695231033,
                    "timer_duration": 60,
                    "timer_remaining": 59,
                    "source": "cloud"
                },
                {
                    "ison": false,
                    "has_timer": false,
                    "timer_started": 0,
                    "timer_duration": 0,
                    "timer_remaining": 0,
                    "source": "timer"
                }
            ],
            "unixtime": 1695227433,
            "getinfo": {
                "fw_info": {
                    "device": "shellyuni-xxxxxxx",
                    "fw": "20230913-114521/v1.14.0-gcb84623"
                }
            },
            "mac": "xxxxxx",
            "uptime": 91567,
            "time": "17:30",
            "ram_free": 39408
        }
    }
}

Any suggestion is welcome :slight_smile:

Thanks

Bump, anyone?