Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not execute all the lines in the .sh file. #32

Open
DavideVito opened this issue Sep 17, 2020 · 1 comment
Open

Does not execute all the lines in the .sh file. #32

DavideVito opened this issue Sep 17, 2020 · 1 comment

Comments

@DavideVito
Copy link

Hi,

I do have a lamp that I can control using a IR Remote, I've bought IR Receiver and Transmitter and made a Python script that can Turn on and turn off the light.

Then I've created 2 files, accendiLampada.sh and spegniLampada.sh, and both works using the command line, so I thought, I'm ok, just add another configuration inside the hombridge's config.json file , but it seems to not completely execute the 2 scripts.

Code of: accendiLampada.sh

#!/bin/sh
echo "ON"
echo "LAMPADA ON" > ~/statoLampada.flag
python3 AccendiLuce.py

Code of: spegniLampada.sh

#!/bin/sh
echo "Spengo la luce"
rm ~/statoLampada.flag
python3 SpengiLuce.py

When I tap on the switch on my Apple Device I can see that te statoLampada.flag is removed or created, but the status led on the IR Transmitter doesn't blink and my light doesn't shut down/turn on.

Here's part of my config.json

"accessories": [
                {
                        "accessory": "GPIODevice",
                        "name": "Leddino",
                        "type": "Switch",
                        "pin": 1
                },
                {
                        "accessory": "Script2",
                        "name": "LED Strip",
                        "on": "./USBPowerOn.sh",
                        "off": "./USBPowerOff.sh",
                        "fileState": "./script.flag",
                        "on_value" : "true"
                },
                {
                        "accessory": "Script2",
                        "name": "Luce Grande",
                        "on": "~/accendiLampada.sh",
                        "off": "~/spegniLampada.sh",
                        "fileState": "~/statoLampada.flag",
                        "on_value" : "true"
                }
        ],

Any ideas?

@DavideVito DavideVito changed the title Does not execute all line in the .sh file. Does not execute all the lines in the .sh file. Sep 17, 2020
@pponce
Copy link
Owner

pponce commented Sep 18, 2020

This is usually a permissions related issue.
Make sure that you test the script as the same user that you run homebridge with.
Make sure that homebridge user can run the script.
Another thing to try is to use the full path when executing your scripts. Both the execution of the py script within the shell script you created and also in the homebridge config file.though it looks like the shell scripts are being run. So it’s probably a permission issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants