Doorbell script question

Moderator: leecollings

Post Reply
gschmidt
Posts: 200
Joined: Thursday 20 December 2018 11:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Doorbell script question

Post by gschmidt »

Hi,

I have bought a cheap 433mhz doorbell (from the Action).
With "learned" it created a "Doorbell" switch in Domoticz.

My goal is to send a notification e-mail to my phones when the fysical doorbell button is pushed.
The problem is that when the knob is pushed, a series of packages is send (in the Log I see in a short time 3 to 5 records)

2019-02-09 11:10:28.192 (RFXtrx433XL) Lighting 4 (Deurbel)
2019-02-09 11:10:28.240 (RFXtrx433XL) Lighting 4 (Deurbel)
2019-02-09 11:10:28.269 (RFXtrx433XL) Lighting 4 (Deurbel)


Which means 3 to 5 e-mail notifications...which is not what i want.

So as a workaround, I created a dummy switch, and with a blockly script I set the dummy switch to ON, when the doorbell is pushed.
With another blockly script I create the e-mail notification and also set the dummy switch OFF after 180s (see attachments)

I thought that the blockly script would understand that if the dummy switch is set to ON, it cannot be set to ON again (since the doorbell is sending 3 to 5 packages.) However, I still receive 3-5 e-mail notifications.

Somebody got an idea how approach this?
Attachments
Notification Script.JPG
Notification Script.JPG (120.67 KiB) Viewed 2091 times
Deurbel.JPG
Deurbel.JPG (16.41 KiB) Viewed 2091 times
tozzke
Posts: 135
Joined: Friday 02 January 2015 9:22
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands
Contact:

Re: Doorbell script question

Post by tozzke »

What happens if you add a user variable (string in this case)?
So you'll get something like:

Code: Select all

If [ [ [Bel Schakelaar] = [On] ] and [ [var Deurbel] = ["niet aangebeld"] ] ]
Do [Set [var Deurbel] = ["er is aangebeld"] ]
   [Send email]
   [Set [var Deurbel] = ["niet aangebeld"] after [10] seconds]
This way it should only trigger once
unless it triggers faster than the user variable changes...
gschmidt
Posts: 200
Joined: Thursday 20 December 2018 11:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Doorbell script question

Post by gschmidt »

First time for me creating a user variable.
Don't exactly know where and how to create this.
I guess a LUA script type user variable?

When I paste this into the LUA editor, it says : [29:5] <expression> expected near ' [ '

Code: Select all

If [ [ [Bel Schakelaar] = [On] ] and [ [var Deurbel] = ["niet aangebeld"] ] ]
Do [Set [var Deurbel] = ["er is aangebeld"] ]
   [Send email]
   [Set [var Deurbel] = ["niet aangebeld"] after [10] seconds]
tozzke
Posts: 135
Joined: Friday 02 January 2015 9:22
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands
Contact:

Re: Doorbell script question

Post by tozzke »

it was just a blockly in text...
gschmidt
Posts: 200
Joined: Thursday 20 December 2018 11:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Doorbell script question

Post by gschmidt »

But to use in blocky a user variable I need to create it first before I can add it as a block is it?
gschmidt
Posts: 200
Joined: Thursday 20 December 2018 11:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Doorbell script question

Post by gschmidt »

I have created a User Variable Deurbel ["Niet aangebeld","Er is aangebeld"] in **/#/UserVariables (see picture)
And a blockly script as you suggested (blockly picture)
Although de "Deurbel Schakelaar" is set to ON, the script is not activated (according to the Log)

What I don't understand is how does the blockly script knows that "var Deurbel" is default set to "Niet Aangebeld"?
I just typed the text "Niet Aangebeld" en "Er is aangebeld" in a text field....???
Attachments
User_Variable.JPG
User_Variable.JPG (16.73 KiB) Viewed 2027 times
Blockly.JPG
Blockly.JPG (44.76 KiB) Viewed 2027 times
gschmidt
Posts: 200
Joined: Thursday 20 December 2018 11:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Doorbell script question

Post by gschmidt »

Hmmm think I figured it out...I first have to set "var Deurbel".
So I added it to the blockly script that triggers "Bel Schakelaar"
This appears to work

But isn't there a way to set "var Deurbel" to "Niet aangebeld" by default?
Attachments
Blockly Deurbel.JPG
Blockly Deurbel.JPG (21.67 KiB) Viewed 2025 times
gschmidt
Posts: 200
Joined: Thursday 20 December 2018 11:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Doorbell script question

Post by gschmidt »

Nope not working....I need to set the variable value to "Niet aangebeld" before the (physical button) "Deurbel" is pushed, otherwise the blockly script is setting the variable again to "Niet aangebeld" and sends an e-mail again.....arggghhhh
tozzke
Posts: 135
Joined: Friday 02 January 2015 9:22
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands
Contact:

Re: Doorbell script question

Post by tozzke »

Of course you'll have to do that, else the if condition won't be true. Where you can create the variables you can also give it a certain value 'Niet aangebeld' in this case.

Code: Select all

If [ [ [Bel Schakelaar] = [On] ] and [ [var Deurbel] = ["Niet aangebeld"] ] ]
Do [Set [var Deurbel] = ["Er is aangebeld"] ]
   [Send email]
   [Set [Bel Schakelaar] = [Off] after [3] seconds]
   [Set [var Deurbel] = ["Niet aangebeld"] after [10] seconds]
The time after which the switch has to go off again has to be shorter than the time for the variable, else the condition might be true again because of a small overlap.
I didn't know the 'Bel Schakelaar' didn't go to 'Off' after being pressed... You can also set an Off delay on the switch itself so it'll go off automatically after switched on.
gschmidt
Posts: 200
Joined: Thursday 20 December 2018 11:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Doorbell script question

Post by gschmidt »

I think I confused you a bit:

I have a doorbell learned in domoticz as (Deurbel). This showed not up as an ON/OFF switch but is shown in domoticz as
Deurbel.JPG
Deurbel.JPG (11.41 KiB) Viewed 2003 times
when the bell button at the frontdoor is pressed 1 time, domoticz log shows in a very short time 3 x a notification (sometimes 4 or 5):

Code: Select all

2019-02-10 11:44:04.926 (RFXtrx433XL) Lighting 4 (Deurbel)
2019-02-10 11:44:04.935 (RFXtrx433XL) Lighting 4 (Deurbel)
2019-02-10 11:44:04.949 (RFXtrx433XL) Lighting 4 (Deurbel)
Now I could add a (e-mail) notification to Deurbel, but I don't want >3 notifications.
So as a workaround I created a dummy ON/OFF switch "Bel Schakelaar". And use the "Bel Schakelaar" for the notifications.
In blockly I created a 1st script which sets "Bel Schakelaar" to ON when Deurbel is pressed at the frontdoor.
Trigger Dummy Switch.JPG
Trigger Dummy Switch.JPG (16.54 KiB) Viewed 2003 times
But this blockly script is also triggered 3 times, although "Bel Schakelaar" is already set to ON

So I understand your suggestion to add a variable. This is the script you suggested:
Blockly.JPG
Blockly.JPG (45.58 KiB) Viewed 2003 times
But this script is not triggered, and I have created a variable "Deurbel" with value "Niet aangebeld"
So I really don't know what I am missing here??
tozzke
Posts: 135
Joined: Friday 02 January 2015 9:22
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands
Contact:

Re: Doorbell script question

Post by tozzke »

gschmidt wrote: Sunday 10 February 2019 12:54 I think I confused you a bit:

I have a doorbell learned in domoticz as (Deurbel). This showed not up as an ON/OFF switch but is shown in domoticz as
Deurbel.JPG
when the bell button at the frontdoor is pressed 1 time, domoticz log shows in a very short time 3 x a notification (sometimes 4 or 5):

Code: Select all

2019-02-10 11:44:04.926 (RFXtrx433XL) Lighting 4 (Deurbel)
2019-02-10 11:44:04.935 (RFXtrx433XL) Lighting 4 (Deurbel)
2019-02-10 11:44:04.949 (RFXtrx433XL) Lighting 4 (Deurbel)
Now I could add a (e-mail) notification to Deurbel, but I don't want >3 notifications.
So as a workaround I created a dummy ON/OFF switch "Bel Schakelaar". And use the "Bel Schakelaar" for the notifications.
In blockly I created a 1st script which sets "Bel Schakelaar" to ON when Deurbel is pressed at the frontdoor.

Trigger Dummy Switch.JPG

But this blockly script is also triggered 3 times, although "Bel Schakelaar" is already set to ON

So I understand your suggestion to add a variable. This is the script you suggested:

Blockly.JPG

But this script is not triggered, and I have created a variable "Deurbel" with value "Niet aangebeld"
So I really don't know what I am missing here??
And this script won't trigger because you're using the wrong If-blockly... If you're only using 1 If statement, you'll have to use the If-blockly WITHOUT the blue gear icon on the top left
gschmidt
Posts: 200
Joined: Thursday 20 December 2018 11:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Doorbell script question

Post by gschmidt »

Yep...I also figured out...I modified a script and forgot to change
Now its working, Thanx man!
BarryT
Posts: 371
Joined: Tuesday 31 March 2015 22:06
Target OS: Linux
Domoticz version: 2024.3
Location: east netherlands
Contact:

Re: Doorbell script question

Post by BarryT »

Just had some similair problems before..
just for asking, are you using a full 3v battery in your doorbell?
When the battery is almost empty, it also sends a lot of rf in the air wich also mess up the noise and spectrum in the 433 area when someone push the doorbell....
I did a rf scan @433.92mhz wich leads me to my old doorbell with a empty battery, when some pushes the knob, it was sending 9 times a signal.
In that time there was no nothing possible on the 433 band because the doorbell "hangs" for 15! seconds and domoticz recieved 9 times a "on" signal.
After replaced the battery everything was normal again.

Ps, i really started to hate the 433 stuff because of its lacky and bad signals...
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest