new lightswitch problems Topic is solved

Moderator: leecollings

Post Reply
Pasibun
Posts: 10
Joined: Sunday 21 January 2018 19:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

new lightswitch problems

Post by Pasibun »

Hej guys,

First of all, im new with domoticz. So mayby i missed something..
I want to control my Milight lamps with Domoticz. I have it working without domoticz, here for i use a nrf24l01 chip, combined with this projct: http://torsten-traenkner.de/wissen/smar ... ilight.php.
I want to add this functionality to domoticz so i follows the GPIO guide: https://www.domoticz.com/wiki/GPIO

Some information on the raspberry GPIO:
pi@raspberrypi:~ $ gpio exports
GPIO Pins exported:
19: in 0 both
21: out 0 none

In my /etc/init.d/domoticz.sh i added this:

Code: Select all

#Run export GPIO Raspberry
/usr/local/bin/gpio export 19 in
/usr/local/bin/gpio edge 19 both
/usr/local/bin/gpio export 21 out
In my domoticz environment i created a new hardware like this (see Attachments, something went wrong, cannot place a inline link)
And created a new lightswitch like this:
Knipsel2.PNG
Knipsel2.PNG (39.57 KiB) Viewed 8454 times
On this images you see the bash files, i created them to call the openmilight script. When i call this bash script normaly it works.

Code: Select all

#!/bin/bash
cd /home/pi/openmilight_pi
sudo ./openmilight -d -q 14 -r 35 -c 52 -b 00 -k 01 -v CD -n 30
When i press the light switch button i get this msg in the consol:
2018-01-22 20:34:12.058 User: pasibun initiated a switch command (1/Milight woonkamer/On)
It looks like it works, but if doesn't..

Can some one tell me what i did wrong here?

Thanks,
Attachments
Knipsel1.PNG
Knipsel1.PNG (33.48 KiB) Viewed 8451 times
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: new lightswitch problems

Post by waaren »

You need an extra /

two for the syntax: script:// and one for your path to script.

script:///home/pi/dev-domoticz/scripts/milightMasterOff.sh
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Pasibun
Posts: 10
Joined: Sunday 21 January 2018 19:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: new lightswitch problems

Post by Pasibun »

waaren wrote: Tuesday 23 January 2018 8:18 You need an extra /

two for the syntax: script:// and one for your path to script.

script:///home/pi/dev-domoticz/scripts/milightMasterOff.sh
Hej waaren,

thanks for responding!
I changes the lines with an extra "/" but still no succes..
Any other ideas?
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: new lightswitch problems

Post by waaren »

Could be several things:

-Check acces rights of your script
-Try to find out if your bash script is executed at all by adding some echo commands to a logfile using:
echo "Domoticz was here" > logfile
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Pasibun
Posts: 10
Joined: Sunday 21 January 2018 19:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: new lightswitch problems

Post by Pasibun »

File permissions:
pi@raspberrypi:~ $ ls -l dev-domoticz/scripts/milightMasterOn.sh
-rwxr-xr-x 1 root root 138 Jan 24 17:26 dev-domoticz/scripts/milightMasterOn.sh
pi@raspberrypi:~ $ ls -l dev-domoticz/scripts/milightMasterOff.sh
-rwxr-xr-x 1 pi pi 138 Jan 24 17:26 dev-domoticz/scripts/milightMasterOff.sh

And i added the echo line but where can i find the logfile?
User avatar
htilburgs
Posts: 464
Joined: Tuesday 03 November 2015 11:01
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: new lightswitch problems

Post by htilburgs »

Just create one on a place you like ;-)

Example:
pi@raspberrypi:~ $ cd /tmp
pi@raspberrypi:/tmp $ sudo touch logfile.tst

Now you've created a logfile with the name logfile.tst in the /tmp directory

Then "echo "Domoticz was here" > /tmp/logfile.tst"

Succes
Hardware:
RPi3 - Aeon Labs Z-Stick GEN5 - Fibaro Dimmer 2 - Fibaro Roller Shutter 2 - Fibaro Smoke Sensor - Yeelight RGBW Led bulb - Yeelight Smart LED Light Strip - Neo Coolcam PIR Motion Sensor - Neo Coolcam PowerPlug - Nest Thermostat v3
Pasibun
Posts: 10
Joined: Sunday 21 January 2018 19:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: new lightswitch problems

Post by Pasibun »

htilburgs wrote:Just create one on a place you like ;-)

Example:
pi@raspberrypi:~ $ cd /tmp
pi@raspberrypi:/tmp $ sudo touch logfile.tst

Now you've created a logfile with the name logfile.tst in the /tmp directory

Then "echo "Domoticz was here" > /tmp/logfile.tst"

Succes
Ahh lol, sorry long day...
Thanks, will update status of the log when I'm back home.

Verstuurd vanaf mijn SM-G930F met Tapatalk

Pasibun
Posts: 10
Joined: Sunday 21 January 2018 19:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: new lightswitch problems

Post by Pasibun »

Well, when i use the Domoticz light switch, it issnt creating a logfile, so script issn't called properly.
I changed the location of the script but still no luck.
When i run "/home/pi/dev-domoticz/scripts/milightMasterOn.sh" in the console it just works.

So.. still no luck and still no idea what i'm doing wrong..
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: new lightswitch problems

Post by waaren »

Pasibun wrote: Thursday 25 January 2018 8:58 Well, when i use the Domoticz light switch, it issnt creating a logfile, so script issn't called properly.
I changed the location of the script but still no luck.
When i run "/home/pi/dev-domoticz/scripts/milightMasterOn.sh" in the console it just works.

So.. still no luck and still no idea what i'm doing wrong..
Do you see anything in your domoticz log like below ?

Code: Select all

2018-01-25 09:28:21.336  User: Admin initiated a switch command (548/scripttest/On)
2018-01-25 09:28:21.358  (Virtual) Light/Switch (scripttest)
2018-01-25 09:28:21.543  Executing script: /bashdir/test.sh
 
or

Code: Select all

2018-01-25 09:35:33.790  Error: SQLHelper: Error script not found '/bashdir/test.shh'
or

Code: Select all

2018-01-25 09:37:48.005  Error: Error executing script command (/bashdir/test.sh). returned: 32256
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Pasibun
Posts: 10
Joined: Sunday 21 January 2018 19:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: new lightswitch problems

Post by Pasibun »

waaren wrote: Thursday 25 January 2018 9:39
Pasibun wrote: Thursday 25 January 2018 8:58 Well, when i use the Domoticz light switch, it issnt creating a logfile, so script issn't called properly.
I changed the location of the script but still no luck.
When i run "/home/pi/dev-domoticz/scripts/milightMasterOn.sh" in the console it just works.

So.. still no luck and still no idea what i'm doing wrong..
Do you see anything in your domoticz log like below ?

Code: Select all

2018-01-25 09:28:21.336  User: Admin initiated a switch command (548/scripttest/On)
2018-01-25 09:28:21.358  (Virtual) Light/Switch (scripttest)
2018-01-25 09:28:21.543  Executing script: /bashdir/test.sh
 
or

Code: Select all

2018-01-25 09:35:33.790  Error: SQLHelper: Error script not found '/bashdir/test.shh'
or

Code: Select all

2018-01-25 09:37:48.005  Error: Error executing script command (/bashdir/test.sh). returned: 32256
The only thing i see when i use it is:

Code: Select all

2018-01-25 08:04:32.338  User: pasibun initiated a switch command (1/Milight woonkamer/On)
This is the pinout i use for this project:
https://imgur.com/D9H6ILY

mayby i messed something up with this:

Code: Select all

pi@raspberrypi:~ $ gpio exports
GPIO Pins exported:
19: in 0 both
21: out 0 none
In my /etc/init.d/domoticz.sh i added this:

Code: Select all

#Run export GPIO Raspberry
/usr/local/bin/gpio export 19 in
/usr/local/bin/gpio edge 19 both
/usr/local/bin/gpio export 21 out
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: new lightswitch problems

Post by waaren »

could you setup a new virtual switch that triggers the same script on the on action and see what it does ?
maybe start without on delay

what version of domoticz are you on
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Lokonli
Posts: 2271
Joined: Monday 29 August 2016 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: new lightswitch problems

Post by Lokonli »

Looking at the second post it seems that for the 'On' action you call the MasterOff script as well.

Verstuurd vanaf mijn SM-G800F met Tapatalk

Pasibun
Posts: 10
Joined: Sunday 21 January 2018 19:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: new lightswitch problems

Post by Pasibun »

Lokonli wrote: Thursday 25 January 2018 16:00 Looking at the second post it seems that for the 'On' action you call the MasterOff script as well.

Verstuurd vanaf mijn SM-G800F met Tapatalk
True, i did that because my lights were on, so i forced it to go off.
I currently have call the "on" bash script instead of off.
waaren wrote: Thursday 25 January 2018 11:33 could you setup a new virtual switch that triggers the same script on the on action and see what it does ?
maybe start without on delay

what version of domoticz are you on
I will try this when im back home again.
Pasibun
Posts: 10
Joined: Sunday 21 January 2018 19:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: new lightswitch problems

Post by Pasibun »

waaren wrote: Thursday 25 January 2018 11:33 could you setup a new virtual switch that triggers the same script on the on action and see what it does ?
maybe start without on delay

what version of domoticz are you on
Domoticz version: 3.8833

And what exactly do you mean by "new virtual switch"?

I removed the delay and now i get a error:

Code: Select all

Error sending switch command, check device/hardware !
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: new lightswitch problems

Post by waaren »

Pasibun wrote: Thursday 25 January 2018 21:10
waaren wrote: Thursday 25 January 2018 11:33 could you setup a new virtual switch that triggers the same script on the on action and see what it does ?
maybe start without on delay

what version of domoticz are you on
Domoticz version: 3.8833

And what exactly do you mean by "new virtual switch"?

I removed the delay and now i get a error:

Code: Select all

Error sending switch command, check device/hardware !
So version is most likely not the cause of your problem. (I ran bash scripts triggered by an On command on the same version)
Virtual switch: https://www.letscontrolit.com/wiki/inde ... ual_sensor
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Pasibun
Posts: 10
Joined: Sunday 21 January 2018 19:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: new lightswitch problems

Post by Pasibun »

Well guys thanks for helping!
The virtual switch worked out!
The lamps are now responding on my virtual switch!
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests