28 lines
1.2 KiB
YAML
28 lines
1.2 KiB
YAML
sensor:
|
|
- platform: command_line
|
|
name: Sonos Sleep Timer remains
|
|
command: >
|
|
curl -X POST http://10.0.3.33:1400/MediaRenderer/AVTransport/Control \
|
|
-H 'Content-Type: text/xml; charset=utf-8' \
|
|
-H 'SOAPAction: "urn:schemas-upnp-org:service:AVTransport:1#GetRemainingSleepTimerDuration"' \
|
|
--data '<?xml version="1.0"?>
|
|
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
|
|
<s:Body>
|
|
<u:GetRemainingSleepTimerDuration xmlns:u="urn:schemas-upnp-org:service:AVTransport:1">
|
|
<InstanceID>0</InstanceID>
|
|
</u:GetRemainingSleepTimerDuration>
|
|
</s:Body>
|
|
</s:Envelope>'
|
|
value_template: >
|
|
{% set result = value | regex_findall('<RemainingSleepTimerDuration>([\d:]+)</RemainingSleepTimerDuration>') %}
|
|
{% if result %}
|
|
{{ result[0] }}
|
|
{% else %}
|
|
'00:00:00'
|
|
{% endif %}
|
|
scan_interval: 60
|
|
|
|
- platform: command_line
|
|
name: Simple Test Sensor
|
|
command: "echo 'Test success'"
|
|
scan_interval: 10 |