door sensor how to Topic is solved
Moderator: leecollings
-
- Posts: 141
- Joined: Tuesday 31 January 2017 20:34
- Target OS: -
- Domoticz version:
- Contact:
door sensor how to
can someone please help me with a blocky setup for my toilet door.
I would like to have the lights on when I open the door but not to switch off when I close the door.
then when I,m done to switch of the light not when opening but when closing the door.
but I m stuck with with the double on/off
I would like to have the lights on when I open the door but not to switch off when I close the door.
then when I,m done to switch of the light not when opening but when closing the door.
but I m stuck with with the double on/off
-
- Posts: 5
- Joined: Thursday 29 December 2016 12:49
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Contact:
Re: door sensor how to
Why do not you use a motion sensor for this?
Raspberry 3 - RaZberry2 Module - RFXtrx433E - Domoticz beta
Z-Wave: Popp Smoke Detector, Fibaro Motion Sensor, Fibaro Wall Plug, Popp Wall Plug
RFXtrx433E: Bresser Temp.+Hygro Sensor, rohrmotor24 RMF Blindmotor
Other: AVM Fritz!DECT200
Z-Wave: Popp Smoke Detector, Fibaro Motion Sensor, Fibaro Wall Plug, Popp Wall Plug
RFXtrx433E: Bresser Temp.+Hygro Sensor, rohrmotor24 RMF Blindmotor
Other: AVM Fritz!DECT200
-
- Posts: 10
- Joined: Saturday 13 June 2015 13:44
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V2.2284
- Contact:
Re: door sensor how to
You can use for example the Blockly 'SET lamp=ON FOR 10 minutes'
Change the 10 minutes to your maximum toilet visit!
I think it's better to use a motion switch for this.
Good luck!
Rob
Change the 10 minutes to your maximum toilet visit!
I think it's better to use a motion switch for this.
Good luck!
Rob
-
- Posts: 113
- Joined: Friday 08 January 2016 12:32
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: door sensor how to
Motion would prob be the best option.
However, you could do something like this with a 2nd virtual switch- which I will call x for simplicity.
If door= open. And x = off and y= off
Set light =on
Set x = on.
Else if door = closed and x= on and y=off
Set y = on.
Else if door = open and x = on and y=on
Set x= off
Else if door = closed and x = off and y=on
Set y=off
Set light =off
The problem with this is while it works in theory, if some one opens the door, doesn't go in, and then closes it, they system gets confused.
I would go for a motion sensor, with a safe off time after last motion. You wouldn't want the lights going out with someone in there!!
However, you could do something like this with a 2nd virtual switch- which I will call x for simplicity.
If door= open. And x = off and y= off
Set light =on
Set x = on.
Else if door = closed and x= on and y=off
Set y = on.
Else if door = open and x = on and y=on
Set x= off
Else if door = closed and x = off and y=on
Set y=off
Set light =off
The problem with this is while it works in theory, if some one opens the door, doesn't go in, and then closes it, they system gets confused.
I would go for a motion sensor, with a safe off time after last motion. You wouldn't want the lights going out with someone in there!!
running domoticz 3.4834 on rpi2, with
Hue bridge / bulbs.
lightwave rf sockets, mood controlers, sensors & contacts.
Home bridge / Siri.
Ha bridge / echo Alexa.
Hard wired alarm system - setting home / away status.
Next: harmony hub.
Hue bridge / bulbs.
lightwave rf sockets, mood controlers, sensors & contacts.
Home bridge / Siri.
Ha bridge / echo Alexa.
Hard wired alarm system - setting home / away status.
Next: harmony hub.
-
- Posts: 141
- Joined: Tuesday 31 January 2017 20:34
- Target OS: -
- Domoticz version:
- Contact:
Re: door sensor how to
Thanks for all the good examples and great ideas!!
But for me a motion sensor is not what I want.
For example short visits will keep the light like 10 min on for nothing!!
And a long visit maybe longer than 10 min you will be in the dark waving to get the light on.
I have found a lua script for the Fibaro home center
This should do the trick like i like it. But I'm running on domoticz. And as a beginner this seems like abracadabra to me.
Maybe some one here knows how to convert to get it working in domoticz??
What does the script exactly?
When the doorsensor detects open (or close) the script is executed. When the door is opened (and the light is off) we write the actual time in Linux format to a variable called 'ToiletGeopend'. When the door is closed we check if the passed time is more than 20 seconds since the door was opened. When the time has passed we turn of the lights.
ID 8 the ID of the doorsensor
ID 45 is the ID of the Fibaro dimmer (or switch)
Create the following variables in the variable panel.
- ToiletGeopend
- TijdToiletOpen
The script
--[[
%% properties
8 value
%% globals
--]]
IDlamp =45 -- ID of toiletlight
local ToiletGeopend =tonumber(fibaro:getModificationTime(IDlamp, "value"));
local TijdToiletOpen = tonumber( os.time() ) - tonumber(fibaro:getModificationTime(IDlamp, "value"));
local StatusDeur =fibaro:getValue(8, "value")
local LampAan =fibaro:getValue(IDlamp, "value")
fibaro:debug(TijdToiletOpen)
if ( tonumber(StatusDeur) == 1 ) then
if ( tonumber(LampAan) == 0 ) then
fibaro:call(IDlamp, "setValue", "50");
fibaro:setGlobal("ToiletGeopend", tonumber(os.time() )); --write actual time to variable
fibaro:sleep(2*1000)
fibaro:call(IDlamp, "setValue", "50") -- in this case we use a dimmer and its set to 50%
end
elseif ( tonumber(StatusDeur) == 0 ) then --door is being close
if ( tonumber(TijdToiletOpen) > 20 ) then --Turn of light when more than 20 seconds are passed
fibaro:call(IDlamp, "setValue", "00");
end
end
-- End of the toilet light script
But for me a motion sensor is not what I want.
For example short visits will keep the light like 10 min on for nothing!!
And a long visit maybe longer than 10 min you will be in the dark waving to get the light on.
I have found a lua script for the Fibaro home center
This should do the trick like i like it. But I'm running on domoticz. And as a beginner this seems like abracadabra to me.
Maybe some one here knows how to convert to get it working in domoticz??
What does the script exactly?
When the doorsensor detects open (or close) the script is executed. When the door is opened (and the light is off) we write the actual time in Linux format to a variable called 'ToiletGeopend'. When the door is closed we check if the passed time is more than 20 seconds since the door was opened. When the time has passed we turn of the lights.
ID 8 the ID of the doorsensor
ID 45 is the ID of the Fibaro dimmer (or switch)
Create the following variables in the variable panel.
- ToiletGeopend
- TijdToiletOpen
The script
--[[
%% properties
8 value
%% globals
--]]
IDlamp =45 -- ID of toiletlight
local ToiletGeopend =tonumber(fibaro:getModificationTime(IDlamp, "value"));
local TijdToiletOpen = tonumber( os.time() ) - tonumber(fibaro:getModificationTime(IDlamp, "value"));
local StatusDeur =fibaro:getValue(8, "value")
local LampAan =fibaro:getValue(IDlamp, "value")
fibaro:debug(TijdToiletOpen)
if ( tonumber(StatusDeur) == 1 ) then
if ( tonumber(LampAan) == 0 ) then
fibaro:call(IDlamp, "setValue", "50");
fibaro:setGlobal("ToiletGeopend", tonumber(os.time() )); --write actual time to variable
fibaro:sleep(2*1000)
fibaro:call(IDlamp, "setValue", "50") -- in this case we use a dimmer and its set to 50%
end
elseif ( tonumber(StatusDeur) == 0 ) then --door is being close
if ( tonumber(TijdToiletOpen) > 20 ) then --Turn of light when more than 20 seconds are passed
fibaro:call(IDlamp, "setValue", "00");
end
end
-- End of the toilet light script
-
- Posts: 141
- Joined: Tuesday 31 January 2017 20:34
- Target OS: -
- Domoticz version:
- Contact:
Re: door sensor how to
Nobody??
-
- Posts: 10
- Joined: Monday 12 September 2016 14:19
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: door sensor how to
maybe you can use user variables
When door is open and uservariable is 0
Set toilet light = on
Set uservariable = 1
When door is open and uservariable is 1
Set toilet light = on
When door is open and uservariable is 0
Set toilet light = on
Set uservariable = 1
When door is open and uservariable is 1
Set toilet light = on
-
- Posts: 625
- Joined: Thursday 02 October 2014 6:36
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2022.2
- Location: Geleen
- Contact:
Re: door sensor how to
You could use detection on the flush buttons, may be in conjunction with a pir.
-
- Posts: 141
- Joined: Tuesday 31 January 2017 20:34
- Target OS: -
- Domoticz version:
- Contact:
Re: door sensor how to
chatjozef wrote:maybe you can use user variables
When door is open and uservariable is 0
Set toilet light = on
Set uservariable = 1
When door is open and uservariable is 1
Set toilet light = on
As you can see in the fibaro homecenter script they use do use uservariable. But then with time??
As a beginner(first Lua script ever) I'm not able to translate this Lua script? Only some parts...
Is it really so different a lua script for homecenter or domoticz??
Can someone maybe explaine how uservariables works??
-
- Posts: 10
- Joined: Monday 12 September 2016 14:19
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: door sensor how to
Sorry, my first post was not a lua script.astrapowerrr wrote:chatjozef wrote:maybe you can use user variables
When door is open and uservariable is 0
Set toilet light = on
Set uservariable = 1
When door is open and uservariable is 1
Set toilet light = on
As you can see in the fibaro homecenter script they use do use uservariable. But then with time??
As a beginner(first Lua script ever) I'm not able to translate this Lua script? Only some parts...
Is it really so different a lua script for homecenter or domoticz??
Can someone maybe explaine how uservariables works??
Maybe you can try it with blocky.
IF -> Toiletdoor = open AND Uservariable Toilet = 0
Then ->
SET Toilet Light = on
SET Uservariable Toilet = 1
ELSE IF -> Toiletdoor = OPEN AND Uservariable Toilet = 1
SET Toilet Light = off
SET Uservariable Toilet = 0
When you use the uservariable set to 0 for the option to set the light on when the door is open.
If the door is open again (and in the most cases you're done on the toilet The status will be 1
The light will be off and the status of the uservariable is set to 0.
You can make uservariables via Setup -> More Options -> User Variables
I hope this will work for you!
-
- Posts: 317
- Joined: Thursday 12 January 2017 15:30
- Target OS: Linux
- Domoticz version: Beta Ch
- Location: Finland
- Contact:
Re: door sensor how to
Easiest way i can think off if you happend to have RFLINK, order 3€ door sensor from ebay that send notification once(when magnet departs from sensor).astrapowerrr wrote:can someone please help me with a blocky setup for my toilet door.
I would like to have the lights on when I open the door but not to switch off when I close the door.
then when I,m done to switch of the light not when opening but when closing the door.
but I m stuck with with the double on/off
There you have it
-T
-----------------------------------------
Smartthings
zigbee2mqtt
RFLink 433mhz / Nrf 2.4Ghz
Mi Light
esp8266MiLight Hub
OpenHab/HomeAssistant/Domoticz
HP T610 & Debian 5.10.19-1 x86_64[/b]
Smartthings
zigbee2mqtt
RFLink 433mhz / Nrf 2.4Ghz
Mi Light
esp8266MiLight Hub
OpenHab/HomeAssistant/Domoticz
HP T610 & Debian 5.10.19-1 x86_64[/b]
-
- Posts: 141
- Joined: Tuesday 31 January 2017 20:34
- Target OS: -
- Domoticz version:
- Contact:
Re: door sensor how to
@chatjozef thanks.. a little puzzle how to use the variables .
i used integer?? but ok it works...
the script i had for a example used time like i told before, i think this is used to not confuse the sensor like on a party when some people just hop on and off the toilet...
for now i am going to test it and if i want to adjust i maybe have the knowledge to set some parameters or you will see me again on this post!!
but for now a thousand thanks!!
i used integer?? but ok it works...
the script i had for a example used time like i told before, i think this is used to not confuse the sensor like on a party when some people just hop on and off the toilet...
for now i am going to test it and if i want to adjust i maybe have the knowledge to set some parameters or you will see me again on this post!!
but for now a thousand thanks!!
-
- Posts: 10
- Joined: Monday 12 September 2016 14:19
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: door sensor how to
Yes, use integer
NIce to hear that this is a solution for you.!
NIce to hear that this is a solution for you.!
Who is online
Users browsing this forum: No registered users and 0 guests