Hi,
I have a google assistant and am using HA to control various electronic including my TIVO box.
I have setup a command line switch
- platform: command_line
switches:
virgin_pause:
command_on: ‘echo IRCODE PAUSE | telnet 192.168.0.11 31339’
command_off: ‘echo IRCODE PAUSE | telnet 192.168.0.11 31339’
friendly_name: Virgin Pause
Using this python code I can read the status of the switch
import requests
headers = {‘Content-Type’: ‘application/json’,}
response = requests.get(‘http://192.168.0.16:8123/api/states/switch.virgin_pause’, headers=headers)
data = response.json()
print(data)
returns to me
{‘last_updated’: ‘2017-09-27T13:49:40.040269+00:00’, ‘last_changed’: ‘2017-09-27T13:49:40.040269+00:00’, ‘state’: ‘off’, ‘attributes’: {‘assumed_state’: True, ‘friendly_name’: ‘Virgin Pause’}, ‘entity_id’: ‘switch.virgin_pause’}
If I then use the following python code
import requests
headers = {“entity_id”: “switch.virgin_pause”}
requests.post(‘http://192.168.0.16:8123/api/services/switch/turn_on’, headers=headers)
Not only does it pause my TIVO box but it also turns on all my other switches such as my power outlets.
I am trying to just pause the tivo and I assumed headers = {“entity_id”: “switch.virgin_pause”} would do that.
Please advise whether I am going about this correctly