avraham / hass_radarr_sonarr_search_by_voice

Add movies to radarr by voice
GNU General Public License v3.0
46 stars 8 forks source link

better guide #1

Closed armdan closed 5 years ago

armdan commented 6 years ago

A better guide for dummies would have been great, like where to put what file thanks

avraham commented 6 years ago

Hi armdan,

This script is only 1 file (hass_radarr_search_by_voice.py), it can be placed wherever you want as long as it has execute permission.

I would gladly answer any other question and see how to make a better guide.

EDIT

I just remembered the script and configuration files within example/homeassistant, you might be wondering what to do with those, right?

armdan commented 6 years ago

Hello, Yes, I don't know what to do with the files in the example folder. Here is what I did. I put download.sh , remove_download.sh and hass_radarr_search_by_voice.py files in to my /homeassistant/shell_scripts folder. Then I put shellcommand.yaml file in to /homeassistant/shell_command folder. Scripts.yaml file I put in to /homeassistant/script folder. I mage IFTTT applet just like on the sample picture. When I ask google to download movie, I get reply from google " sure" and I get errors in homeassisntant logs .

2018-09-01 16:51:52 ERROR (MainThread) [homeassistant.core] Error executing service <ServiceCall shell_command.download_movie (c:26cede7e0f0c4e4db96dc7f87f68ec5e): movie=TextField> Traceback (most recent call last): File "/usr/src/app/homeassistant/core.py", line 1117, in _event_to_service_call await service_handler.func(service_call) File "/usr/src/app/homeassistant/components/shell_command.py", line 88, in async_service_handler process = yield from create_process File "/usr/local/lib/python3.6/asyncio/subprocess.py", line 225, in create_subprocess_exec stderr=stderr, **kwds) File "uvloop/loop.pyx", line 2603, in subprocess_exec File "uvloop/loop.pyx", line 2563, in __subprocess_run File "uvloop/handles/process.pyx", line 595, in uvloop.loop.UVProcessTransport.new File "uvloop/handles/process.pyx", line 102, in uvloop.loop.UVProcess._init FileNotFoundError: [Errno 2] No such file or directory

Thanks for your help

avraham commented 6 years ago

Homeassistant is just not finding the scripts and commands.

Here's a small description on the files within the example folder and what to do with them. I can provide further details if needed.

Example folder Files overview:

homeassistant folder. This is your homeassistant folder where the configuration yalm files are.

homeassistant/scripts.yaml.
A separate configuration file for your own scripts instead of including everything in configuration.yaml. It’s required to add the line script: !include scripts.yaml in the configuration.yaml file to let know homeassistant about the separation.

homeassistant/shellcommand.yaml.
A separate configuration file for your own Shell commands instead of including everything in configuration.yaml. It’s required to add the line shell_command: !include shellcommand.yaml in the configuration.yaml file to let know homeassistant about the separation.

homeassistant/scripts/download.sh.
Shell script for homeassistant that will call the python script.

homeassistant/scripts/remove_download.sh Bonus shell script for removing the last movie added to radarr by this script.

Steps

  1. Copy the content of the example/homeassistant folder to your homeassistant folder. If you already have a custom yalm file for your own scripts and shell commands then just add the content of each files (scripts.yaml and shellcommand.yaml) to your own files.
  2. Let homeassistant know where your scripts and shell commands will be by adding the following lines to your configuration.yaml (in case you are using the same file structure as me). script: !include scripts.yaml shell_command: !include shellcommand.yaml
  3. In your homeassistant/scripts/download.sh. file replace ‘/path/to/hass_radarr_search_by_voice.py’ with the actual path where you saved the python file.
  4. Fill up the User defined variables in your _hass_radarr_search_byvoice.py
  5. Make sure the give executable permissions to everything inside homeassistant/scripts folder and to _hass_radarr_search_byvoice.py file.
  6. Bonus. Fill up the User defined variables in _homeassistant/scripts/removedownload.sh