Page 1 of 1
Blink device script
Posted: Wednesday 10 February 2016 20:10
by groetg
I tried to get the following script working on my rpi:
https://www.domoticz.com/wiki/Device_blink
Where is the part my dymmy switch puts the blink.py script on? It feels like somethings missing? nothing happens when the dunny switch is on...
I want to blink not 1 device, but 3, is that possible? I want al the lights in the room blink when alarm is ringing.
Re: Blink device script
Posted: Tuesday 16 February 2016 20:12
by groetg
I got it so far the blink.py script runs when I SSH sudo python blink.py. So the script works, but now I try to copy i to a switch:
I did:
In the virtual switch set the on command to script:///home/pi/domoticz/scripts/blink.py
nothing happens when I press the device on.
changed the command to: script://home/pi/domoticz/scripts/blink.py (one / less)
still nothing happens
What am I doing wrong?

- alarma1.PNG (14.73 KiB) Viewed 3081 times

- alarm2.PNG (94.84 KiB) Viewed 3081 times
Re: Blink device script
Posted: Tuesday 16 February 2016 20:37
by SweetPants
This has been answered many times on the forum.
chmod +x /home/pi/domoticz/scripts/blink.py
Aan actie:
script:///home/pi/domoticz/scripts/blink.py
Re: Blink device script
Posted: Tuesday 16 February 2016 20:45
by groetg
Sorry, this is my first script.
I got the script running, but in the log I see:
Error: Error executing script command (/home/pi/domoticz/scripts/blink.py). returned: 512
Through SSH the scripts is running, so my conclusion is that the script is allright.
Re: Blink device script
Posted: Tuesday 16 February 2016 20:51
by jvdz
It likely needs 3 slashes (/) not 2 after script:.
Jos
Re: Blink device script
Posted: Tuesday 16 February 2016 21:06
by SweetPants
Create file "blink.sh" with content:
#!/bin/bash
/home/pi/domoticz/scripts/blink.py&
chmod +x blink.sh
Aan actie:
script:///home/pi/domoticz/scripts/blink.sh
This works for me
Re: Blink device script
Posted: Tuesday 16 February 2016 21:39
by Westcott
The script has Windows newlines, not Unix style.
The last line needs to be terminated.
Perhaps remove indentation of first line.
See -
viewtopic.php?t=5315
Unfortunately my TKB TZ68 switch, or my Zwave network, doesn't respond quickly enough to create regular flashes.
It also fills the log up!
Re: Blink device script
Posted: Wednesday 17 February 2016 19:59
by groetg
@Sweetpants: Did what you said, nothing happens. Run the blink.sh script in Putty gives:
Code: Select all
pi@raspberrypi ~/domoticz/scripts $ /home/pi/domoticz/scripts/blink.py: line 2: import: command not found
/home/pi/domoticz/scripts/blink.py: line 3: import: command not found
/home/pi/domoticz/scripts/blink.py: line 4: import: command not found
/home/pi/domoticz/scripts/blink.py: line 5: import: command not found
/home/pi/domoticz/scripts/blink.py: line 6: import: command not found
/home/pi/domoticz/scripts/blink.py: line 7: import: command not found
/home/pi/domoticz/scripts/blink.py: line 8: import: command not found
/home/pi/domoticz/scripts/blink.py: line 10: syntax error near unexpected token `('
/home/pi/domoticz/scripts/blink.py: line 10: `def open_port():'
blink.sh is:
Code: Select all
#!/bin/bash
/home/pi/domoticz/scripts/blink.py&
Again: running /home/pi/domoticz/scripts/blink.py straight in putty gives flashing light, zo blink.py works, only to get it run in Domoticz seems to be the problem.
Re: Blink device script
Posted: Wednesday 17 February 2016 20:42
by groetg
I changed some things in notepath and now I got it running even in Domoticz. Thanx for the help, something with open en save in notepath did the trick...