Events system thread (questions and feedback)

Must be cleaned all topics go to the right subforum
anconakip
Posts: 15
Joined: Tuesday 30 September 2014 12:41
Target OS: Raspberry Pi
Domoticz version: 7722
Contact:

Re: Events system thread (questions and feedback)

Postby anconakip » Wednesday 15 October 2014 11:22

i want to make an event that starts to look if my door is open for more than 5 minutes then my heating is going of.
I only don't know how i can start the scene "if door=open for more than 5 minutes"

markk
Posts: 400
Joined: Tuesday 14 January 2014 15:50
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Events system thread (questions and feedback)

Postby markk » Wednesday 22 October 2014 22:53

anconakip wrote:i want to make an event that starts to look if my door is open for more than 5 minutes then my heating is going of.
I only don't know how i can start the scene "if door=open for more than 5 minutes"


You could do this easily with a LUA script. There's an example in the wiki that could be easily amended to do whet you want. Have a look at the garage door warning one here: http://www.domoticz.com/wiki/Event_script_examples
Running Domoticz on Pi3 with RFXtrx433e. LWRF power sockets and dimmer switches. Integrated my existing wirefree alarm PIRs and door contacts with domoticz. Geofencing with Pilot. Harmony Hub. Tado for Heating. Now playing with mysensors.

darrepac
Posts: 149
Joined: Tuesday 04 February 2014 22:31
Target OS: Raspberry Pi
Domoticz version:
Location: Isère, France
Contact:

Re: Events system thread (questions and feedback)

Postby darrepac » Saturday 01 November 2014 11:03

hi,

I would to create a blockly event similar to:
IF TEMPERATURE_A > (TEMPERATURE_B + 3) DO ...

Is it possible to do that? I do not find how to add "3" to the device value.

Could be something also like IF SUNSET + 1hour DO ...

thanks

jake
Posts: 242
Joined: Saturday 30 May 2015 22:40
Target OS: Raspberry Pi
Domoticz version: beta
Contact:

Re: Events system thread (questions and feedback)

Postby jake » Wednesday 10 June 2015 14:30

Running event 2.2536
My 'extended' Blockly event doesn't save anymore. Do you want to overwrite etc? OK. But, the 'event saved' doesn't come up.
I tried to save it under another name, but it doesn't want to do that either.
Original Blockly.JPG
Original Blockly.JPG (136.64 KiB) Viewed 2929 times

I started a new event and that one saves fine. Therefore I made a screen dump of the original event and I started to copy it in a new event, to not waste time on finding the root cause.
However, I now save regularly during the build of the event. It works fine/saves fine until the point of the attached screen dump. If I add 1 more AND or OR statement, it doesn't save the Blockly event anymore. I still get the question 'do you want to overwrite?', but the 'event saved' doesn't come up.
Max New Blockly.JPG
Max New Blockly.JPG (51.26 KiB) Viewed 2929 times

Very strange, since the original Blockly event is much bigger then the limit that I experience right now.

User avatar
bizziebis
Posts: 528
Joined: Saturday 19 October 2013 14:00
Target OS: Raspberry Pi
Domoticz version: latest
Location: The Netherlands
Contact:

Re: Events system thread (questions and feedback)

Postby bizziebis » Wednesday 10 June 2015 17:26

There is a maximum length to an url if you use ngnix as proxy for Domoticz. You can increase it to fix the problem. Don't know the exact parameter at this moment.

jake
Posts: 242
Joined: Saturday 30 May 2015 22:40
Target OS: Raspberry Pi
Domoticz version: beta
Contact:

Re: Events system thread (questions and feedback)

Postby jake » Wednesday 10 June 2015 22:29

jake wrote:Running event 2.2536
My 'extended' Blockly event doesn't save anymore. Do you want to overwrite etc? OK. But, the 'event saved' doesn't come up.
I tried to save it under another name, but it doesn't want to do that either.

I started a new event and that one saves fine. Therefore I made a screen dump of the original event and I started to copy it in a new event, to not waste time on finding the root cause.
However, I now save regularly during the build of the event. It works fine/saves fine until the point of the attached screen dump. If I add 1 more AND or OR statement, it doesn't save the Blockly event anymore. I still get the question 'do you want to overwrite?', but the 'event saved' doesn't come up.

Very strange, since the original Blockly event is much bigger then the limit that I experience right now.

bizziebis wrote:There is a maximum length to an url if you use ngnix as proxy for Domoticz. You can increase it to fix the problem. Don't know the exact parameter at this moment.

Yes, that was it! At the moment of editing the events, I was connected remotely, through the company proxy server. I don't know if that has to do with ngnix, but here at home it worked with the same browser flawlessly.

Ingmar
Posts: 35
Joined: Sunday 04 May 2014 1:34
Target OS: Raspberry Pi
Domoticz version:
Location: The Netherlands
Contact:

Re: Events system thread (questions and feedback)

Postby Ingmar » Friday 19 June 2015 20:39

I just noticed something in the event bit and couldn't find anything about it in this thread with the search function, so here we go :)

When you change the name of a device it will NOT change in the events where it is used IF the device is in a different category than with the old name. However, if the device stays in the same category, it WILL automatically change accordingly.
E.g. if i have a device which is called called "Light 5", and you change it to "5. Light", it will mess up in the event and the event won't work anymore. If however, you have a device called "Light 5" and you change it to "Light 6", it will automatically change in the event and everything keeps working.

Is this a known issue? Is there anything I can do about it (except for sticking to the initial device names hahaha).

User avatar
RvdM
Posts: 25
Joined: Friday 10 July 2015 21:06
Target OS: Raspberry Pi
Domoticz version:
Location: Deventer, NL
Contact:

Re: Events system thread (questions and feedback)

Postby RvdM » Saturday 11 July 2015 1:54

I'm trying to switch off power to my entertainment center when my chargers in the bedroom is detecting usage. (Fibaro Wallplug)
However i'm getting an error when creating a blockly and it doesn't seem to work.

Log:

Code: Select all

015-07-10 21:04:21.564 (Z-StickGen5) Usage (Slaapkamer - Oplader)
2015-07-10 21:04:22.569 Error: EventSystem: Lua script error (Blockly), Name: Standby-Kill_1 => [string "result = 0; weekday = os.date('*t')['wday']; ..."]:1: attempt to compare number with nil

Blocky
Image
Actual:
Image

What am I doing wrong?

Domoticz version: Version 2.2563 (June 14th 2015)

joostvanderlinde
Posts: 11
Joined: Tuesday 23 June 2015 23:06
Target OS: Raspberry Pi
Domoticz version: 3.5877
Contact:

Re: Events system thread (questions and feedback)

Postby joostvanderlinde » Monday 13 July 2015 13:52

I started using Domoticz recently and as I was used to Nodo Domotica I started using the Event system in Domoticz right away.
My goal is to keep things simple and to only use Blocky (so preferably no LUA scripting).

I have 3 events to get my blinds in a particular situation: open, half-closed and closed.

Open should be at a certain time (at 07:00) or when the Off button of a remote switch RL2 is pressed
RL_open.PNG
Blinds Open
RL_open.PNG (20.51 KiB) Viewed 2800 times


Closed should be at a certain time (at sunset) or when the On button of a remote switch RL2 is pressed (in both cases only when the window sensor is Closed)
RL_dicht.PNG
Blinds Closed
RL_dicht.PNG (25.83 KiB) Viewed 2800 times


Half Closed should be at a certain time (at 09:00) or when the On button of a remote switch RL4 is pressed (in both cases only when the window sensor is Closed and the blinds are Open)
RL_halfdicht.PNG
Blinds Half Closed
RL_halfdicht.PNG (34.71 KiB) Viewed 2800 times


To check the actual state of the blinds I maintain a uservariable (Open / Dicht (Closed) / HalfDicht (HalfClosed) )

When I manually open the blinds by pressing Off on the RL2 remote switch, that works and the uservariable is set to "Open".
Now, when I manually want to set the blinds to HalfClosed by pressing On on the RL4 remote switch, this seems to work as well.
BUT: Although no events happen in between (otherwise I would have understood the behaviour), after one minute the blinds go Open again. Apparently because the state of RL2 is still "Off" and Domoticz checks event entry states every minute or so.

I cant imagine I am the first one encountering this issue. More likely my blocky events are not OK.

Any help is greatly appreciated.

BTW: I am using the "External" AND construct, AFAIK no difference with using the "Inlinde" variant, but this one makes the event better readable in my opinion.

UPDATE: Apparently I have overlooked an important remark in the Event wiki pages:
every minute, the system checks all blockly rules that mention a time condition and evaluates them.

Now probably this rule makes that my event decisions are checked every minute.....
So: To avoid this checking I should clearly separate the time-based evens from time-independent events.
Which will make that I will end up with 6 events instead of 3.
Will try and report back!

joostvanderlinde
Posts: 11
Joined: Tuesday 23 June 2015 23:06
Target OS: Raspberry Pi
Domoticz version: 3.5877
Contact:

Re: Events system thread (questions and feedback)

Postby joostvanderlinde » Tuesday 14 July 2015 16:41

Apparently describing my issue here made me help solve it myself.
What I thought yesterday indeed was the cause.

Every event that has a "time" condition in its logic, is evaluated every minute. This means that every minute ALL other conditions in the event are evaluated.
Which might lead to the triggering of the event every minute...

Solution: make sure an event only consists of "time" OR "non-time" conditions (and do not mix them together).
That is: If your events suffer from this behaviour ;-)

User avatar
epierre
Posts: 726
Joined: Wednesday 05 March 2014 14:16
Target OS: Linux
Domoticz version:
Location: France
Contact:

Re: Events system thread (questions and feedback)

Postby epierre » Monday 20 July 2015 10:06

Hello,

I have a strange error, I want to make a script that sends an email when outside temp (Exterieur) is below inside temp (Chambre filles) for us to pen the windows.

To avoid the notification storm, I have an user variable (aeration_chambres) that contains the day value.

Here the message and below the script:

2015-07-20 09:43:42.574 Error: SMTP Mailer: Error sending Email to: !
2015-07-20 09:43:42.575 Error: Notification sent (email) => Failed
2015-07-20 09:43:42.575 Error: EventSystem: commandArray should only return ['string']='actionstring' or [integer]={['string']='actionstring'}
2015-07-20 09:43:42.575 EventSystem: Script event triggered: /home/cubie/domoticz/scripts/lua/script_device_aeration.lua


Code: Select all

s = otherdevices_lastupdate['Exterieur']
-- returns a date time like 2013-07-11 17:23:12

year = string.sub(s, 1, 4)
month = string.sub(s, 6, 7)
day = string.sub(s, 9, 10)
hour = string.sub(s, 12, 13)
minutes = string.sub(s, 15, 16)
seconds = string.sub(s, 18, 19)

dte=year*10000+month*100+day

commandArray = {}
--commandArray['Variable:aeration_chambres']= "20150701"

if (devicechanged['Exterieur']) then

        if ((devicechanged['Exterieur_Temperature']<otherdevices_temperature['Chambre filles'])
        and(otherdevices_temperature['Chambre filles']>=20)) then
            if (uservariables["aeration_chambres"] ~= dte) then
                commandArray['Variable:aeration_chambres']= dte
                commandArray['SendNotification']='Maison à aerer#Il est temps d aerer la maison'
            end
        end
end
return commandArray
ImperiHome & MyDomoAtHome on top of:
868.42Mhz - Vera Lite - Fibaro SS-101, S-211, K-101, FWP - Fortress SSA2
433Mhz - Cubie Domoticz + RFXtrx + Oregon || Foscam 9821W
2,4Ghz - Cubie MySensors Gateway + COV + TempHumidity + Pressure + WaterMeter

User avatar
Luppie
Posts: 24
Joined: Thursday 08 October 2015 14:23
Target OS: Raspberry Pi
Domoticz version: LastBeta
Location: Netherlands
Contact:

Re: Events system thread (questions and feedback)

Postby Luppie » Friday 16 October 2015 16:05

I'm trying to create a simple event to control my heater, but somehow I cant get it to work.

This is the event I created:
Image

When the even is triggered, both actions are executed in stead of the action that is True.
Image

These are the current states:
Image

If I interpret the rule then it says:
If the temperature (19.2) is bigger or equal then the setpoint (20.0) = FALSE
So the else statement should be executed:
If the temperature (19.2) is smaller then the setpoint (20.0) = TRUE

So only the line 'Heater On' should be written to the log.
I'm a domoticz newbee, so probably the error is behind the keyboard, but I'm not seeing what I'm doing wrong.
Raspberry Pi2B | RFLink | MySensors Gateway | 18B20 | P1 | 9x KaKu Old | 3x Kaku New | KaKu PIR | 2x Flamingo Smoke Detector | Chuango PIR | Chuango Door Contact |3x Chinese Therm. Hum. Sensor | 2x SelectPlus DoorBell | RPi 7" Touch Control Panel

User avatar
gizmocuz
Posts: 8250
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi
Domoticz version: beta
Location: Top of the world
Contact:

Re: Events system thread (questions and feedback)

Postby gizmocuz » Sunday 25 October 2015 17:40

Please see updated bug report answer at
https://www.domoticz.com/forum/tracker.php?p=1&t=630

Hope it works... i tried it with comparing a temp sensor against another temp sensor
Quality outlives Quantity!

User avatar
gizmocuz
Posts: 8250
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi
Domoticz version: beta
Location: Top of the world
Contact:

Re: Events system thread (questions and feedback)

Postby gizmocuz » Friday 30 October 2015 10:00

epierre wrote:Hello,

I have a strange error, I want to make a script that sends an email when outside temp (Exterieur) is below inside temp (Chambre filles) for us to pen the windows.

To avoid the notification storm, I have an user variable (aeration_chambres) that contains the day value.

Here the message and below the script:

2015-07-20 09:43:42.574 Error: SMTP Mailer: Error sending Email to: !
2015-07-20 09:43:42.575 Error: Notification sent (email) => Failed
2015-07-20 09:43:42.575 Error: EventSystem: commandArray should only return ['string']='actionstring' or [integer]={['string']='actionstring'}
2015-07-20 09:43:42.575 EventSystem: Script event triggered: /home/cubie/domoticz/scripts/lua/script_device_aeration.lua


Code: Select all

s = otherdevices_lastupdate['Exterieur']
-- returns a date time like 2013-07-11 17:23:12

year = string.sub(s, 1, 4)
month = string.sub(s, 6, 7)
day = string.sub(s, 9, 10)
hour = string.sub(s, 12, 13)
minutes = string.sub(s, 15, 16)
seconds = string.sub(s, 18, 19)

dte=year*10000+month*100+day

commandArray = {}
--commandArray['Variable:aeration_chambres']= "20150701"

if (devicechanged['Exterieur']) then

        if ((devicechanged['Exterieur_Temperature']<otherdevices_temperature['Chambre filles'])
        and(otherdevices_temperature['Chambre filles']>=20)) then
            if (uservariables["aeration_chambres"] ~= dte) then
                commandArray['Variable:aeration_chambres']= dte
                commandArray['SendNotification']='Maison à aerer#Il est temps d aerer la maison'
            end
        end
end
return commandArray


This can easily be done on the web interface (and does not cost cpu for an event), from the temperature sensor, add a notification
In the settings page, set the notification interval to 24 hours (1 day), and you receive only one message a day
Quality outlives Quantity!

Fireblade954
Posts: 1
Joined: Monday 30 November 2015 0:43
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Events system thread (questions and feedback)

Postby Fireblade954 » Monday 30 November 2015 0:52

I would like to use the CounterToday property of my energy meter in my Lua script/even. I see its available in the Json. Is it a possibility it getting added to LUA events or is there a way that i dont know of to get the value in LUA

User avatar
epierre
Posts: 726
Joined: Wednesday 05 March 2014 14:16
Target OS: Linux
Domoticz version:
Location: France
Contact:

Re: Events system thread (questions and feedback)

Postby epierre » Sunday 06 December 2015 22:38

Hello,

is there way to get the nvalue in lua, e.g. sopmething like otherdevices_nvalue ?
ImperiHome & MyDomoAtHome on top of:
868.42Mhz - Vera Lite - Fibaro SS-101, S-211, K-101, FWP - Fortress SSA2
433Mhz - Cubie Domoticz + RFXtrx + Oregon || Foscam 9821W
2,4Ghz - Cubie MySensors Gateway + COV + TempHumidity + Pressure + WaterMeter

User avatar
Leeuwerik
Posts: 3
Joined: Friday 05 June 2015 14:02
Target OS: Raspberry Pi
Domoticz version: Beta
Contact:

Blockly - Cannot save multisensor value in user variable

Postby Leeuwerik » Friday 18 December 2015 16:41

Hello,

I'm using a blockly to save temperature and humidity values from an Aeotec Multisensor6 so that I can determine if humidity and temperature values have increased or decreased. Values are stored in User Variables of type float.

2015-12-18 13_58_51-Domoticz.png
Blocky to save multisensor Humidity value in User variable
2015-12-18 13_58_51-Domoticz.png (19.58 KiB) Viewed 2288 times


This goes well for the temperature, but fails for the humidity value. Domoticz version is 2.3852.

The log shows:

2015-12-18 13:30:42.294 (RaZberry) Temp + Humidity (Badkamer Klimaat)
2015-12-18 13:30:43.047 Error: EventSystem: Error updating variable Vochtigheid: Not a valid float
2015-12-18 13:30:43.048 Badkamer Vochtigheid vorig / huidig:
2015-12-18 13:30:43.048 0
2015-12-18 13:30:43.049 20.0;73;3

It seems that the blockly scipt assigns the value "20.0;73;3" to the user variable instead of the expected value of "73". As "20.0;73;3" is a string value and the user variable has type float this would result in a type mismatch.

Is this "by design" and should I write a LUA script (which I would like to prevent) or is this a bug with the blockly interpreter?

Any advice is appreciated.

Thanks!

User avatar
gizmocuz
Posts: 8250
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi
Domoticz version: beta
Location: Top of the world
Contact:

Re: Events system thread (questions and feedback)

Postby gizmocuz » Friday 18 December 2015 19:48

humidity is an integer
could you try with this type of user variable ?
Quality outlives Quantity!

User avatar
Leeuwerik
Posts: 3
Joined: Friday 05 June 2015 14:02
Target OS: Raspberry Pi
Domoticz version: Beta
Contact:

Re: Events system thread (questions and feedback)

Postby Leeuwerik » Friday 18 December 2015 22:14

I did, the same issue exists when the user variable is an integer. When I change the type to string, the assignment completes successfully.


Sent from my iPhone using Tapatalk

User avatar
jvdz
Posts: 873
Joined: Tuesday 30 December 2014 20:25
Target OS: Raspberry Pi
Domoticz version: Stable
Location: Netherlands
Contact:

Re: Events system thread (questions and feedback)

Postby jvdz » Friday 18 December 2015 22:21

In LUA it will pass a string as described in the Event Wiki:
- v1.867: Temp, hum and baro values are passed to Lua as proper numbers instead of strings. otherdevices_svalues[] is
still passed as a string to access other measurement devices for the time being.


Guess that is the same for Blockly.

Jos


Return to “Scripts [cleaning in progress]”

Who is online

Users browsing this forum: No registered users and 6 guests