This question is related to Home Assistant AND Shelly REST commands.
I need the status of the enabled io-url-actions of my Shelly as a Switch entity in Home Assistant
I already have it enabled for the ‘real’ switch of a Shelly like this:
switch:
- platform: rest
name: “Shelly REST Switch”
scan_interval: 10
resource: http://192.168.1.2/relay/0
body_on: "turn=on"
body_off: "turn=off"
is_on_template: '{{ value_json.ison == true }}'
headers:
content_type: application/x-www-form-urlencoded
I want to create a switch entity in Home Assistant so I can enable and disable local action urls
How can I get this done?
The resource for the action url is:
http://192.168.1.2/settings/actions
Part of the REST response is:
{
"actions":
{
"out_on_url": [{
"index": 0,
"urls": ["http://ip.she.lly.two/relay/0?turn=on"],
"enabled": true
}],
"out_off_url": [{
"index": 0,
"urls": ["http://ip.she.lly.two/relay/0?turn=off"],
"enabled": true
}]
}
}
The common HTTP API command would be:
To switch OFF:
http://192.168.1.2/settings/actions?index=0&name=out_on_url&enabled=false
To switch ON:
http://192.168.1.2/settings/actions?index=0&name=out_on_url&enabled=true