Page 1 of 1
new lightswitch problems
Posted: Monday 22 January 2018 21:43
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 (39.57 KiB) Viewed 11548 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,
Re: new lightswitch problems
Posted: Tuesday 23 January 2018 8:18
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
Re: new lightswitch problems
Posted: Tuesday 23 January 2018 17:17
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?
Re: new lightswitch problems
Posted: Tuesday 23 January 2018 18:03
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
Re: new lightswitch problems
Posted: Wednesday 24 January 2018 18:29
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?
Re: new lightswitch problems
Posted: Wednesday 24 January 2018 19:28
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
Re: new lightswitch problems
Posted: Wednesday 24 January 2018 19:31
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
Re: new lightswitch problems
Posted: Thursday 25 January 2018 8:58
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..
Re: new lightswitch problems
Posted: Thursday 25 January 2018 9:39
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
Re: new lightswitch problems
Posted: Thursday 25 January 2018 10:11
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
Re: new lightswitch problems
Posted: Thursday 25 January 2018 11:33
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
Re: new lightswitch problems
Posted: Thursday 25 January 2018 16:00
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
Re: new lightswitch problems
Posted: Thursday 25 January 2018 16:17
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.
Re: new lightswitch problems
Posted: Thursday 25 January 2018 21:10
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 !
Re: new lightswitch problems
Posted: Friday 26 January 2018 0:30
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
Re: new lightswitch problems
Posted: Saturday 27 January 2018 12:54
by Pasibun
Well guys thanks for helping!
The virtual switch worked out!
The lamps are now responding on my virtual switch!