Page 1 of 1

newbee problem with dusk sensor

Posted: Tuesday 18 April 2017 9:30
by roloz
Hello, i’m a new with RPI and after reading an trying a lot of things I have for now 1 thing that doesn’t work for me. I installed Raspian Jessie Lite, 433Utils, wrinigPi, domoticz and some other stuff. I bought a 433MHz transmitter, 433MHz receiver, Dusk sensor, PIR sensor, small breadboard and a lot of cables. I connected de transmitter (pin 2, 6 and 11), Receiver (pin 4, 14 and 13) and Dusk sensor (Pin 1, 9 and 7) to the RPI, made GPIO4 and GPIO21 input and GPIO17 output.
With RPi_utils I found the code of my old KaKu/CoCo transmitter and use these to switch the lights on and off in domoticz with
script://///home/pi//433Utils/RPi_utils//codesend **code**
In domoticz I created 2 switches and a dusk sensor, the switches are working and even with sunset or sunrise, but my dusk sensor seems death in domoticz When I run an py script then I see it switching the GPIO4 between 0 and 1. But my question is how can I use this in domoticz, I tried it with Blocky, (not successfully) and with lua script:

commandArray = {}

if (devicechanged[lichtsensor] == ‘0’) -- also tried 'On'
then
print( ‘het is donker, lampen aan’) -- it’s dark, lights on
commandArray['autoaanuit']= ‘On’
end
if (devicechanged[lichtsensor] == ‘1’) --also tried 'Off'
then
print( ‘het is licht, lampen uit’)
commandArray['autoaanuit']= ‘Off’
end

return commandArray

also tried a lot of other examples from this forum, but nothing seems to work, what do I do wrong??

--lichtsensor = my dusk sensor name
hardware-setup
name: lichtsensor
type: raspberry gpio port
data timeout: disabled

--autoaanuit name of my dusk sensor in switches
Switches-setup:
hardware: lichtsensor
name: autoaanuit
switch type: dusk sensor
type: GPIO
GPIO: gpio4 (GPIO. 7) on pin 7(INPUT)

On script: script://///home/pi//433Utils/RPi_utils//codesend **code*1
Off script: script://///home/pi//433Utils/RPi_utils//codesend **code*0

What is it that i'm doing wrong or forgot in this, who can help me with a working script/blocky example.

this is my sensor: only VCC GND AND DO, no analoge output.
Image

Thanks!!

Re: newbee problem with dusk sensor

Posted: Thursday 20 April 2017 18:34
by roloz
Problem seems to be solved for now.
I also put the gpio setting in /etc/init.d/domoticz.sh before the DAEMON settings, and in /etc/init.d/domoticz.sh.save file at the end,
rebooted the RPi an now I see the input chancing when it's dark or light.

I hope this will also work for other user.. ;)