Events system thread (questions and feedback)

Moderator: leecollings

anconakip
Posts: 17
Joined: Tuesday 30 September 2014 12:41
Target OS: Raspberry Pi / ODroid
Domoticz version: 7722
Contact:

Re: Events system thread (questions and feedback)

Post 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"
markk
Posts: 267
Joined: Tuesday 14 January 2014 14:50
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Events system thread (questions and feedback)

Post 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
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: 133
Joined: Tuesday 04 February 2014 21:31
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Isère, France
Contact:

Re: Events system thread (questions and feedback)

Post 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
jake
Posts: 742
Joined: Saturday 30 May 2015 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Contact:

Re: Events system thread (questions and feedback)

Post 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 12745 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 12745 times
Very strange, since the original Blockly event is much bigger then the limit that I experience right now.
User avatar
bizziebis
Posts: 182
Joined: Saturday 19 October 2013 14:00
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8805
Location: The Netherlands
Contact:

Re: Events system thread (questions and feedback)

Post 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.
jake
Posts: 742
Joined: Saturday 30 May 2015 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Contact:

Re: Events system thread (questions and feedback)

Post 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.
Ingmar
Posts: 51
Joined: Sunday 04 May 2014 1:34
Target OS: NAS (Synology & others)
Domoticz version:
Location: The Netherlands
Contact:

Re: Events system thread (questions and feedback)

Post 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).
Synology NAS with stable release, AEON Z-wave, RFXCOM, Toon, Echo Dot, HAbridge, HarmonyHUB, Dashticz.
User avatar
RvdM
Posts: 39
Joined: Friday 10 July 2015 21:06
Target OS: Linux
Domoticz version: 2020.2 1
Location: Deventer, NL
Contact:

Re: Events system thread (questions and feedback)

Post 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)
Running virtualized domoticz server on a proxmox cluster with a slave for optimal RFX communication. Using Aeotec Z-Stick Gen5, rfxtrx433e, Homebridge and a Philips HUE bridge for all sort of home automation.
joostvanderlinde
Posts: 44
Joined: Tuesday 23 June 2015 23:06
Target OS: Linux
Domoticz version: 2023.2
Location: NL + SE
Contact:

Re: Events system thread (questions and feedback)

Post 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 12617 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 12617 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 12617 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!
Domoticz on BPI-M2-Pro (compiled on Ubuntu 22.04) and RPI (binary on Raspian 10)
RFXCom, Sonoff Zigbee stick, eBusd Adapter 5, P1, S0, Husdata H60 integration
Zigbee2MQTT AD, MQTT local, AirconWithMe, Ebusd, VolvoRecharge, PSA Car Controller
joostvanderlinde
Posts: 44
Joined: Tuesday 23 June 2015 23:06
Target OS: Linux
Domoticz version: 2023.2
Location: NL + SE
Contact:

Re: Events system thread (questions and feedback)

Post 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 ;-)
Domoticz on BPI-M2-Pro (compiled on Ubuntu 22.04) and RPI (binary on Raspian 10)
RFXCom, Sonoff Zigbee stick, eBusd Adapter 5, P1, S0, Husdata H60 integration
Zigbee2MQTT AD, MQTT local, AirconWithMe, Ebusd, VolvoRecharge, PSA Car Controller
User avatar
epierre
Posts: 522
Joined: Wednesday 05 March 2014 13:16
Target OS: Linux
Domoticz version:
Location: France
Contact:

Re: Events system thread (questions and feedback)

Post 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
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: 16
Joined: Thursday 08 October 2015 14:23
Target OS: Raspberry Pi / ODroid
Domoticz version: LastBeta
Location: Netherlands
Contact:

Re: Events system thread (questions and feedback)

Post 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.
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: 2350
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Events system thread (questions and feedback)

Post 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
Quality outlives Quantity!
User avatar
gizmocuz
Posts: 2350
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Events system thread (questions and feedback)

Post 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
Quality outlives Quantity!
Fireblade954
Posts: 1
Joined: Sunday 29 November 2015 23:43
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Events system thread (questions and feedback)

Post 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
User avatar
epierre
Posts: 522
Joined: Wednesday 05 March 2014 13:16
Target OS: Linux
Domoticz version:
Location: France
Contact:

Re: Events system thread (questions and feedback)

Post by epierre »

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 / ODroid
Domoticz version: Beta
Contact:

Blockly - Cannot save multisensor value in user variable

Post 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 12104 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: 2350
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Events system thread (questions and feedback)

Post by gizmocuz »

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 / ODroid
Domoticz version: Beta
Contact:

Re: Events system thread (questions and feedback)

Post 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
User avatar
jvdz
Posts: 2189
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: Events system thread (questions and feedback)

Post 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
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest