Page 14 of 16

Re: Events system thread (questions and feedback)

Posted: Wednesday 15 October 2014 11:22
by anconakip
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"

Re: Events system thread (questions and feedback)

Posted: Wednesday 22 October 2014 22:53
by markk
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

Re: Events system thread (questions and feedback)

Posted: Saturday 01 November 2014 10:03
by darrepac
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

Re: Events system thread (questions and feedback)

Posted: Wednesday 10 June 2015 14:30
by jake
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 13460 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 13460 times
Very strange, since the original Blockly event is much bigger then the limit that I experience right now.

Re: Events system thread (questions and feedback)

Posted: Wednesday 10 June 2015 17:26
by bizziebis
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.

Re: Events system thread (questions and feedback)

Posted: Wednesday 10 June 2015 22:29
by jake
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.

Re: Events system thread (questions and feedback)

Posted: Friday 19 June 2015 20:39
by Ingmar
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).

Re: Events system thread (questions and feedback)

Posted: Saturday 11 July 2015 1:54
by RvdM
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)

Re: Events system thread (questions and feedback)

Posted: Monday 13 July 2015 13:52
by joostvanderlinde
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
Blinds Open
Blinds Open
RL_open.PNG (20.51 KiB) Viewed 13332 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)
Blinds Closed
Blinds Closed
RL_dicht.PNG (25.83 KiB) Viewed 13332 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)
Blinds Half Closed
Blinds Half Closed
RL_halfdicht.PNG (34.71 KiB) Viewed 13332 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!

Re: Events system thread (questions and feedback)

Posted: Tuesday 14 July 2015 16:41
by joostvanderlinde
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 ;-)

Re: Events system thread (questions and feedback)

Posted: Monday 20 July 2015 10:06
by epierre
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

Re: Events system thread (questions and feedback)

Posted: Friday 16 October 2015 16:05
by Luppie
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.

Re: Events system thread (questions and feedback)

Posted: Sunday 25 October 2015 16:40
by gizmocuz
Please see updated bug report answer at
tracker.php?p=1&t=630

Hope it works... i tried it with comparing a temp sensor against another temp sensor

Re: Events system thread (questions and feedback)

Posted: Friday 30 October 2015 9:00
by gizmocuz
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

Re: Events system thread (questions and feedback)

Posted: Sunday 29 November 2015 23:52
by Fireblade954
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

Re: Events system thread (questions and feedback)

Posted: Sunday 06 December 2015 21:38
by epierre
Hello,

is there way to get the nvalue in lua, e.g. sopmething like otherdevices_nvalue ?

Blockly - Cannot save multisensor value in user variable

Posted: Friday 18 December 2015 15:41
by Leeuwerik
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.
Blocky to save multisensor Humidity value in User variable
Blocky to save multisensor Humidity value in User variable
2015-12-18 13_58_51-Domoticz.png (19.58 KiB) Viewed 12819 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!

Re: Events system thread (questions and feedback)

Posted: Friday 18 December 2015 18:48
by gizmocuz
humidity is an integer
could you try with this type of user variable ?

Re: Events system thread (questions and feedback)

Posted: Friday 18 December 2015 21:14
by Leeuwerik
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

Re: Events system thread (questions and feedback)

Posted: Friday 18 December 2015 21:21
by jvdz
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