Intellium schreef op woensdag 04 mei 2016 @ 21:57:
[...]
Ik heb hier ook een on/off vergelijking gehad, maar laatst geprobeert met een level vergelijking, gezien het een dimmer is en ik ergens in dit topic heb gelezen dat het dan wel zou werken. Maar uiteindelijk werkt het dus wel met een on/off.
[...]
Heb de eerste opstelling die je aangeeft geprobeert, en O-M-G het werkt
Ik heb me dus niet gerealiseerd dat Domoticz de Blockly gewoon niet uitvoert bij zo een condition. Ik ging er wel vanuit dat de lamp zou gaan flikkeren of iets dergelijks, maar niet dat er gewoon niks zou gebeuren en niks gelogged zou worden.
Afijn, weer wat geleerd... Conditions die constant af zouden vuren worden dus genegeerd door Domoticz?
PS. Als je nou ook nog mijn overige issues kan fixxen, ben je me nieuwe beste vriendje

Daarom ben ik al snel overgestapt naar LUA.
Zo moeilijk is het niet en complexere handelingen werken wel waar blocky te kort schiet.
En simpele scripts zoals de W.C verlichting werken rete snel zonder dat extra triggers op extra triggers moet schrijven om alles werkende te krijgen.
Blocky is leuk voor AAN/UIT maar verder ook niet.
Bovendien is het met blocky zo dat als je bijvoorbeeld een blocky hebt met een actie die moet gebeuren bij een deurcontact open.
Deze zich zelf blijft herhalen zolang de deur openstaat en je eigenlijk de actie maar 1x wilt hebben.
In LUA hebt je dit niet omdat je simpel een actie uit kan voeren op het moment dat een switch triggered door [devicechanged]
Dus een lamp moet aan bij deur open.
Nu zet je de lamp manueel uit, in blocky en bij de deur nog open gaat de lamp vrolijk branden omdat je zelf aangeven hebt dat bij een open deur de lamp aan moet.
In LUA kan dit niet wat je hebt nu met [devicechanged] aangegeven dat de lamp aan moet als de status van de deur is veranderd.
En zoals
iMars schrijft je compared Level>=1 in blocky.
Dat gaat niet lekker werken, wat wel werkt bij dimmers is om te kijken of hij niet uit is.
Bijvoorbeeld "Toilet-lampen-switch ~= Off" , dit wil zeggen als de verlichting niet uit.
Voor de W.C gebruik ik de hier onderstaande simpele LUA script.
Zoals je ziet heb ik er wel een standby trigger in gezet ondanks het niet echt nodig is.
Komt omdat ik nog met 433mhz spul werk en ten tijde van het schrijven van dit lua scriptje de RFXtrx433E nog wel eens een signaal miste en dus alles freaked.
Na 2 jaar nog steeds niet aangepast ondanks er nooit meer een signaal gemist is.
Maar goed, bottom issue is dat zoals hieronder de verlichting alleen maar geschakeld word als de motion sensor word geactiveerd en niet zoals een blocky aan staat.
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
| commandArray = {}
--
-- **********************************************************
-- WC Verlichting AAN bij Motion en Iemand Thuis
-- **********************************************************
--
if devicechanged['Motion W.C'] == 'On'
and otherdevices['W.C Lamp'] =='Off'
and otherdevices['W.C Standby'] == 'Off'
and otherdevices['Iemand Thuis'] == 'On'
and otherdevices['Iemand Thuis - Standby'] == 'Off'
then
commandArray['W.C Lamp']='Set Level 70'
commandArray['W.C Standby']='On'
print('<font color="blue">W.C Motion aan - W.C Lamp ingeschakeld</font>')
end
--
-- **********************************************************
-- WC Verlichting AAN bij Motion en Iemand Thuis Standby (huis klaar voor vertrek)
-- **********************************************************
--
if devicechanged['Motion W.C'] == 'On'
and otherdevices['W.C Lamp'] =='Off'
and otherdevices['W.C Standby'] == 'Off'
and otherdevices['Iemand Thuis'] == 'Off'
and otherdevices['Iemand Thuis - Standby'] == 'On'
then
commandArray['W.C Lamp']='Set Level 50'
commandArray['W.C Standby']='On'
print('<font color="blue">W.C Motion aan - W.C Lamp ingeschakeld</font>')
end
--
-- **********************************************************
-- WC Verlichting AAN bij Motion en Iemand Thuis UIT (voor snachts)
-- **********************************************************
--
if devicechanged['Motion W.C'] == 'On'
and otherdevices['W.C Lamp'] =='Off'
and otherdevices['W.C Standby'] == 'Off'
and otherdevices['Iemand Thuis'] == 'Off'
and otherdevices['Iemand Thuis - Standby'] == 'Off'
then
commandArray['W.C Lamp']='Set Level 10'
commandArray['W.C Standby']='On'
print('<font color="blue">W.C Motion aan - W.C Lamp ingeschakeld</font>')
end
--
-- **********************************************************
-- WC Verlichting manueel UIT en W.C Standby UIT
-- **********************************************************
--
if (devicechanged['W.C Lamp'] == 'Off'
and otherdevices['W.C Standby'] == 'On')
then
commandArray['W.C Standby']='Off AFTER 15'
print('<font color="blue">W.C Lamp uit - W.C Lamp standby uitgeschakeld</font>')
end
--
-- **********************************************************
-- WC Verlichting Standby UIT als licht UIT is en Motion UIT
-- **********************************************************
--
if (devicechanged['Motion W.C'] == 'Off'
and otherdevices['W.C Lamp'] == 'Off'
and otherdevices['W.C Standby'] == 'On')
then
commandArray['W.C Standby']='Off AFTER 15'
print('<font color="blue">W.C Motion uit - W.C Lamp Standby uitgeschakeld</font>')
end
--
-- **********************************************************
-- WC Verlichting Manueel AAN bij Motion UIT
-- **********************************************************
--
if (devicechanged['W.C Lamp'] == 'On'
and otherdevices['Motion W.C'] == 'Off'
and otherdevices['W.C Standby'] == 'Off')
then
commandArray['W.C Standby']='On'
print('<font color="blue">W.C Lamp manueel aan - W.C Lamp ingeschakeld</font>')
end
return commandArray |
Daarnaast draai ik de volgende LUA time script.
Zodat er als iemand vergeet de verlichting uit te schakelen de verlichting alsnog na 15 min uit gaat.
En tis ook niet zo bij een lange zit dat je in het donker komt te zitten.
Er zit een bypass in dat als de Motion sensor aan gaat en de lamp brand nog dan word de counter gereset.
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
| --
-- **********************************************************
-- W.C. Counter Locals
-- **********************************************************
--
local wc_motion_switch = 'Motion W.C'
local wc_motion_counter = 'IsWCNoMotionCounter'
local wc_light_switch = 'W.C Lamp'
local wc_nomotion_timeout = 14 --(1 minuten counter)
commandArray = {}
--
-- **********************************************************
-- W.C Verlichting Counter
-- **********************************************************
--
wc_motion_minutes = tonumber(uservariables[wc_motion_counter])
wc_remaining = wc_nomotion_timeout - wc_motion_minutes
if (otherdevices[wc_motion_switch] == 'Off' and otherdevices[wc_light_switch] == 'On') then
wc_motion_minutes = wc_motion_minutes + 1
print('<font color="red">Al ' ..tonumber(wc_motion_minutes).. ' minuten geen beweging op de w.c gezien, over ' ..tonumber(wc_remaining).. ' minuten gaat het licht uit!</font>')
commandArray['Variable:' .. wc_motion_counter] = tostring(wc_motion_minutes)
end
if otherdevices[wc_light_switch] == 'On' and wc_motion_minutes > tonumber(wc_nomotion_timeout) then
commandArray[wc_light_switch]='Off'
print('<font color="red">Al ' ..tonumber(wc_motion_minutes).. ' minuten geen beweging op de w.c gezien, licht word uitgeschakeld</font>')
wc_motion_minutes = 0
commandArray['Variable:' .. wc_motion_counter] = tostring(wc_motion_minutes)
end
if otherdevices[wc_light_switch] == 'Off' and wc_motion_minutes > 0 and wc_motion_minutes < tonumber(wc_nomotion_timeout) then
print('<font color="red">W.C lamp is uitgeschakeld, Counter gereset</font>')
wc_motion_minutes = 0
commandArray['Variable:' .. wc_motion_counter] = tostring(wc_motion_minutes)
end
if otherdevices[wc_motion_switch] == 'On' and otherdevices[wc_light_switch] == 'On' and wc_motion_minutes > 1 then
print('<font color="red">Counter gereset, Er zit nog iemand...</font>')
wc_motion_minutes = 0
commandArray['Variable:' .. wc_motion_counter] = tostring(wc_motion_minutes)
end
return commandArray |
[
Voor 19% gewijzigd door
Siewert op 05-05-2016 00:49
. Reden: Timer script toegevoegd ]