Hey Steven,
Yes, I did try a command line switch, but no luck.
- platform: command_line
switches:
kodi_test:
command_on: "/usr/bin/curl -X POST URL"
command_off: "/usr/bin/curl -X POST URL"
Also tried this as just curl instead of /usr/bin/curl, and same happens with the foscam example.
log output:
16-12-23 08:54:49 homeassistant.components.switch.command_line: Command failed: curl -k "http://IP_ADDRESS:PORT/jsonrpc?request={%22jsonrpc%22:%222.0%22,%22id%22:%221%22,%22method%22:%22Player.Open%22,%22params%22:{%22item%22:{%22file%22:%22PATHTOFILE.mp4%22}}}"
Also tried to use shell.yaml
kodi_start_playback: 'curl -k "http://IP_ADDRESS:PORT/jsonrpc?request={%22jsonrpc%22:%222.0%22,%22id%22:%221%22,%22method%22:%22Player.Open%22,%22params%22:{%22item%22:{%22file%22:%22PATHTOFILE.mp4%22}}}"'
kodi_stop_playback: 'curl -k "http://IP_ADDRESS:PORT/jsonrpc?request={%22jsonrpc%22:%20%222.0%22,%20%22method%22:%20%22Player.Stop%22,%20%22params%22:%20{%22playerid%22:1},%20%22id%22:%201}"'
And then added this to script.yaml
Kodi_test1:
sequence:
- service: shell_command.kodi_start_playback
Kodi_test2:
sequence:
- service: shell_command.kodi_stop_playback
But when I activate them I’m getting more errors in the log
16-12-23 09:03:18 homeassistant.components.shell_command: Error rendering command template: TemplateSyntaxError: tag name expected
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/helpers/template.py", line 72, in ensure_valid
self._compiled_code = ENV.compile(self.template)
File "/srv/homeassistant/lib/python3.4/site-packages/jinja2/environment.py", line 565, in compile
self.handle_exception(exc_info, source_hint=source_hint)
File "/srv/homeassistant/lib/python3.4/site-packages/jinja2/environment.py", line 754, in handle_exception
reraise(exc_type, exc_value, tb)
File "/srv/homeassistant/lib/python3.4/site-packages/jinja2/_compat.py", line 37, in reraise
raise value.with_traceback(tb)
File "<unknown>", line 1, in template
File "/srv/homeassistant/lib/python3.4/site-packages/jinja2/environment.py", line 470, in _parse
return Parser(self, source, name, encode_filename(filename)).parse()
File "/srv/homeassistant/lib/python3.4/site-packages/jinja2/parser.py", line 897, in parse
result = nodes.Template(self.subparse(), lineno=1)
File "/srv/homeassistant/lib/python3.4/site-packages/jinja2/parser.py", line 879, in subparse
rv = self.parse_statement()
File "/srv/homeassistant/lib/python3.4/site-packages/jinja2/parser.py", line 116, in parse_statement
self.fail('tag name expected', token.lineno)
File "/srv/homeassistant/lib/python3.4/site-packages/jinja2/parser.py", line 50, in fail
raise exc(msg, lineno, self.name, self.filename)
jinja2.exceptions.TemplateSyntaxError: tag name expected
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/shell_command.py", line 52, in service_handler
rendered_args = args_compiled.render(call.data)
File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/helpers/template.py", line 86, in render
self.hass.loop, self.async_render, kwargs).result()
File "/usr/lib/python3.4/concurrent/futures/_base.py", line 402, in result
return self.__get_result()
File "/usr/lib/python3.4/concurrent/futures/_base.py", line 354, in __get_result
raise self._exception
File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/util/async.py", line 167, in run_callback
future.set_result(callback(*args))
File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/helpers/template.py", line 93, in async_render
self._ensure_compiled()
File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/helpers/template.py", line 143, in _ensure_compiled
self.ensure_valid()
File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/helpers/template.py", line 74, in ensure_valid
raise TemplateError(err)
homeassistant.exceptions.TemplateError: TemplateSyntaxError: tag name expected