new lightswitch problems Topic is solved

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

new lightswitch problems

Post by Pasibun » Monday 22 January 2018 22:43

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 1966 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 1963 times

User avatar
waaren
Posts: 1218
Joined: Tuesday 03 January 2017 15:18
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Netherlands
Contact:

Re: new lightswitch problems

Post by waaren » Tuesday 23 January 2018 9: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
Raspberry (debian stretch via berryboot on Synology DS916+) , Domoticz (almost) latest Beta, , dzVents 2.6, RFLink, RFXtrx433e, P1, Youless, Harmony, Hue, Yeelight, Xiaomi, HomeWizard, Zwave, Amazon echo

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

Re: new lightswitch problems

Post by Pasibun » Tuesday 23 January 2018 18:17

waaren wrote:
Tuesday 23 January 2018 9: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: 1218
Joined: Tuesday 03 January 2017 15:18
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Netherlands
Contact:

Re: new lightswitch problems

Post by waaren » Tuesday 23 January 2018 19:03

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
Raspberry (debian stretch via berryboot on Synology DS916+) , Domoticz (almost) latest Beta, , dzVents 2.6, RFLink, RFXtrx433e, P1, Youless, Harmony, Hue, Yeelight, Xiaomi, HomeWizard, Zwave, Amazon echo

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

Re: new lightswitch problems

Post by Pasibun » Wednesday 24 January 2018 19:29

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: 509
Joined: Tuesday 03 November 2015 12:01
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Netherlands
Contact:

Re: new lightswitch problems

Post by htilburgs » Wednesday 24 January 2018 20:28

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 20:03
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: new lightswitch problems

Post by Pasibun » Wednesday 24 January 2018 20:31

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 20:03
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: new lightswitch problems

Post by Pasibun » Thursday 25 January 2018 9: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..

User avatar
waaren
Posts: 1218
Joined: Tuesday 03 January 2017 15:18
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Netherlands
Contact:

Re: new lightswitch problems

Post by waaren » Thursday 25 January 2018 10:39

Pasibun wrote:
Thursday 25 January 2018 9: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
Raspberry (debian stretch via berryboot on Synology DS916+) , Domoticz (almost) latest Beta, , dzVents 2.6, RFLink, RFXtrx433e, P1, Youless, Harmony, Hue, Yeelight, Xiaomi, HomeWizard, Zwave, Amazon echo

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

Re: new lightswitch problems

Post by Pasibun » Thursday 25 January 2018 11:11

waaren wrote:
Thursday 25 January 2018 10:39
Pasibun wrote:
Thursday 25 January 2018 9: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: 1218
Joined: Tuesday 03 January 2017 15:18
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Netherlands
Contact:

Re: new lightswitch problems

Post by waaren » Thursday 25 January 2018 12: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
Raspberry (debian stretch via berryboot on Synology DS916+) , Domoticz (almost) latest Beta, , dzVents 2.6, RFLink, RFXtrx433e, P1, Youless, Harmony, Hue, Yeelight, Xiaomi, HomeWizard, Zwave, Amazon echo

Lokonli
Posts: 109
Joined: Monday 29 August 2016 22:40
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: new lightswitch problems

Post by Lokonli » Thursday 25 January 2018 17: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


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

Re: new lightswitch problems

Post by Pasibun » Thursday 25 January 2018 17:17

Lokonli wrote:
Thursday 25 January 2018 17: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 12: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 20:03
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: new lightswitch problems

Post by Pasibun » Thursday 25 January 2018 22:10

waaren wrote:
Thursday 25 January 2018 12: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: 1218
Joined: Tuesday 03 January 2017 15:18
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Netherlands
Contact:

Re: new lightswitch problems

Post by waaren » Friday 26 January 2018 1:30

Pasibun wrote:
Thursday 25 January 2018 22:10
waaren wrote:
Thursday 25 January 2018 12: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
Raspberry (debian stretch via berryboot on Synology DS916+) , Domoticz (almost) latest Beta, , dzVents 2.6, RFLink, RFXtrx433e, P1, Youless, Harmony, Hue, Yeelight, Xiaomi, HomeWizard, Zwave, Amazon echo

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

Re: new lightswitch problems

Post by Pasibun » Saturday 27 January 2018 13:54

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 1 guest