Hi all,
I currently have a binary sensor that looks something like this.
- platform: command_line
command: ‘usr/bin/curl -X GET http://IP-ADDRESS:1925/6/ambilight/power’
name: Ambilight
device_class: light
scan_interval: 30
Due to it trying to get a response even when the TV is off and spamming the log, I’m looking for a way to poll the TV only when it’s on.
I realise I can filter it out from the log but would prefer a more complete solution.
I was messing around with templates such as -
{% if is_state('switch.switch_tv_on', 'on') %} ********If TV is on********
'{{ value_json.power }}' ********execute curl and extract value********
{% else %}
off ********otherwise Ambilight is off********
{% endif %}
I realise the above isn’t correct but added the comments to indicate how it might work.
Thanks