Script Files No Longer Working

Did something change with the script files between 0.64 and 0.67.1 Mine no longer seems to be working.

Error running command: bash /bash/take_doorbell_snapshot.sh, return code: 127

It seemed to work in previous versions however now it is not. From 0.65.0 on I have seemed to have a lot of issues with multiple components (Asus router, honeywell (which seems to have gotten fixed in 0.67.1), MyQ garage, and google chromecast)

127 is command not found - what’s the script?

I know there is probably a more efficient way to write this but I am no expert and it works. Well at least it did.

 #!/bin/bash

    outdir=/Cameras/Front_Porch

    if [[ ! -d "$outdir" ]]; then
      mkdir -p "$outdir"
    fi

    ffmpeg -y -i rtsp://CameraName:[email protected]/h264Preview_01_main -frames 2 -strftime 1 /Cameras/Front_Porch/Front_Door-%Y-%m-%d_%H-%M-%S.jpg

    cd /Cameras/Front_Porch
    ls > /Cameras/Front_Porch/Extra/contents
    cd

    tail -n 1 /Cameras/Front_Porch/Extra/contents > /Cameras/Front_Porch/Extra/lastfile
    var1="/Cameras/Front_Porch/Extra/lastfile"
    echo $var1 > /Cameras/Front_Porch/Extra/echotocompare

    var2=$(cat $var1) 
    echo $var2 >> /Cameras/Front_Porch/Extra/echotocompare

    cd /Cameras/Front_Porch
    cp $var2 CurrentFrontDoor.jpg

Maybe permissions issue on /cameras/ ?

What’s the shell command you’ve got?

alias: Take Doorbell Snapshot
sequence:
  - service: shell_command.take_doorbell_snapshot

I don’t think it is permissions because it was working previously.

But what is the shell command?

Sometimes permissions get accidentally changed, have a look at all the “can’t upgrade” threads kicking around.

Another random thought, have you whitelisted /camera/ ?

I am not sure which shell command it is. the only error i am grtting is

Error running command:bash /bash/take_doorbell_snapshot.sh, return code: 127

i verified the permissions. everything was set to 755

i have not whitelisted anything yet

Somewhere in your configuration you have an entry like…

shell_command:
  take_doorbell_snapshot: SOMETHING_HERE

Which we could do with seeing.

Under homeassistant try whitelisting /camera/, eg…

homeassistant:
  name: Home
  latitude: 1.2345678
  longitude: 1.2345678
  elevation: 100
  unit_system: metric
  time_zone: Europe/Paris
  whitelist_external_dirs:
    - /Camera

Here is my shell command.

take_doorbell_snapshot: 'bash /bash/take_doorbell_snapshot.sh'

Ok i think the shell command fixed it. I had to change the path for some reason as it was no longer pointing to the correct file. Thanks for the help. Now I will begin trying to fix my other issues.

1 Like