Blink device script

Moderator: leecollings

Post Reply
User avatar
groetg
Posts: 39
Joined: Tuesday 06 January 2015 20:41
Target OS: Raspberry Pi / ODroid
Domoticz version: V2.4025
Location: Heerhugowaard, Holland
Contact:

Blink device script

Post 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.
Master: RPI Model 2B
Sub 1: RPI Model 2B
RFX transmitter/receiver 433 Mhz
13 KAKU units (3 window sensors, 1 door sensor, 7 light switches, 1 dusk sensor, 1 motion sensor)
4 IP cam
Meteostick
OTGW
P1 cable
Davis Vantage Pro weatherstation (incl. solar/UV)
User avatar
groetg
Posts: 39
Joined: Tuesday 06 January 2015 20:41
Target OS: Raspberry Pi / ODroid
Domoticz version: V2.4025
Location: Heerhugowaard, Holland
Contact:

Re: Blink device script

Post 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
alarma1.PNG (14.73 KiB) Viewed 3079 times
alarm2.PNG
alarm2.PNG (94.84 KiB) Viewed 3079 times
Master: RPI Model 2B
Sub 1: RPI Model 2B
RFX transmitter/receiver 433 Mhz
13 KAKU units (3 window sensors, 1 door sensor, 7 light switches, 1 dusk sensor, 1 motion sensor)
4 IP cam
Meteostick
OTGW
P1 cable
Davis Vantage Pro weatherstation (incl. solar/UV)
SweetPants

Re: Blink device script

Post 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
User avatar
groetg
Posts: 39
Joined: Tuesday 06 January 2015 20:41
Target OS: Raspberry Pi / ODroid
Domoticz version: V2.4025
Location: Heerhugowaard, Holland
Contact:

Re: Blink device script

Post 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.
Master: RPI Model 2B
Sub 1: RPI Model 2B
RFX transmitter/receiver 433 Mhz
13 KAKU units (3 window sensors, 1 door sensor, 7 light switches, 1 dusk sensor, 1 motion sensor)
4 IP cam
Meteostick
OTGW
P1 cable
Davis Vantage Pro weatherstation (incl. solar/UV)
User avatar
jvdz
Posts: 2334
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: Blink device script

Post by jvdz »

It likely needs 3 slashes (/) not 2 after script:.

Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
SweetPants

Re: Blink device script

Post 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
User avatar
Westcott
Posts: 423
Joined: Tuesday 09 December 2014 17:04
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: UK - Glos
Contact:

Re: Blink device script

Post 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!
Zwave - Sigma Z+ stick, Fibaro, Horstmann, Neo Coolcam, EUROtronic
RFlink - IR detectors and temperatures
Wifi - YeeLights, ESP32s, Anoop sockets
Zigbee - lots with zigbee2mqtt and ZbBridge
User avatar
groetg
Posts: 39
Joined: Tuesday 06 January 2015 20:41
Target OS: Raspberry Pi / ODroid
Domoticz version: V2.4025
Location: Heerhugowaard, Holland
Contact:

Re: Blink device script

Post 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.
Master: RPI Model 2B
Sub 1: RPI Model 2B
RFX transmitter/receiver 433 Mhz
13 KAKU units (3 window sensors, 1 door sensor, 7 light switches, 1 dusk sensor, 1 motion sensor)
4 IP cam
Meteostick
OTGW
P1 cable
Davis Vantage Pro weatherstation (incl. solar/UV)
User avatar
groetg
Posts: 39
Joined: Tuesday 06 January 2015 20:41
Target OS: Raspberry Pi / ODroid
Domoticz version: V2.4025
Location: Heerhugowaard, Holland
Contact:

Re: Blink device script

Post 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...
Master: RPI Model 2B
Sub 1: RPI Model 2B
RFX transmitter/receiver 433 Mhz
13 KAKU units (3 window sensors, 1 door sensor, 7 light switches, 1 dusk sensor, 1 motion sensor)
4 IP cam
Meteostick
OTGW
P1 cable
Davis Vantage Pro weatherstation (incl. solar/UV)
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest