vzorglub
(Vincent Regaud)
September 23, 2018, 9:00pm
21
It is.
I don’t know wky it doesn’t go above 5%
Add some log info:
logInfo("PERCENT 1: ", percent.toString)
percent = percent + 5 // increase slowly
logInfo("PERCENT 2: ", percent.toString)
if (percent <= 80) { // up to 80%
logInfo("PERCENT 3: ", percent.toString)
LivingRoomDim1.sendCommand(percent)
fade_timer.reschedule(now.plusMillis(450))
} else {
What does the log show?
Remember that you MUST start from LivingRoomDim1 turned off
dastrix80
(Kris K)
September 23, 2018, 9:04pm
22
Doesnt like that symbol
07:03:09.097 [ERROR] [untime.internal.engine.RuleEngineImpl] - Rule 'When Kodi Player changed to STOP': Unknown variable or command '<'; line 66, column 39, length 18
vzorglub
(Vincent Regaud)
September 23, 2018, 9:12pm
23
if (LivingRoomSw1.state == OFF && FibaroEye1Lux.state as Number < 20) {
dastrix80
(Kris K)
September 23, 2018, 9:29pm
24
Doesnt like it Vincent
07:28:31.641 [WARN ] [del.core.internal.ModelRepositoryImpl] - Configuration model 'Scene_Watch_Vero.rules' has errors, therefore ignoring it: [66,72]: no viable alternative at input '20'
I use something similiar with success in another rule,
var int Dim = 0
try {Dim = Integer::parseInt(LivingRoomDim1.state.toString)} catch (Exception e) {}
if (FibaroEye1Lux.state < 20 && Dim < 6) {
vzorglub
(Vincent Regaud)
September 23, 2018, 9:42pm
25
It work for me but…
if (LivingRoomSw1.state == OFF && FibaroEye1Lux.state < 20) {
dastrix80
(Kris K)
September 23, 2018, 9:52pm
26
Odd. Ill do some testing tonight when its dark
Thanks mate, ill report back!
dastrix80
(Kris K)
September 24, 2018, 10:36am
27
hi Vincent
so its working. I see some rather odd behaviour when stop is pressed.
The log indicates it goes from 0, to 5%, then 5% to 2% then starts to increment by 2% which is what it should do.
Im confused as to why it goes up to 5 first…
Rule attached, I cant see any reason why it would do that.
rule "When Kodi Player changed to PLAY"
when
Item myKodi_control changed to PLAY
then
//Slowly Dim the Lights if they are on
if (LivingRoomSw1.state == ON) {
if (fade_timer === null) {
percent = LivingRoomDim1.state as Number
fade_timer = createTimer(now.plusMillis(100), [ |
if (percent > 0) {
percent = percent - 2
if (percent < 0) percent = 0
LivingRoomDim1.sendCommand(percent)
fade_timer.reschedule(now.plusMillis(100))
} else {
fade_timer = null
}
])
}
}
end
rule "When Kodi Player changed to PAUSE"
when
Item myKodi_control changed to PAUSE
then
if (FibaroEye1Lux.state < 20 && LivingRoomSw1.state == OFF)
LivingRoomDim1.sendCommand(5)
end
rule "When Kodi Player changed to STOP"
when
Item myKodi_stop changed to ON
then
//Slowly Brighten the Lights at the end of the Movie
if (LivingRoomSw1.state == OFF && FibaroEye1Lux.state < 20) {
if (fade_timer === null) {
percent = LivingRoomDim1.state as Number
if (percent == 0) {
fade_timer = createTimer(now.plusMillis(100), [ |
percent = percent + 2 // increase slowly
if (percent <= 30) { // up to 30%
LivingRoomDim1.sendCommand(percent)
fade_timer.reschedule(now.plusMillis(100))
} else {
fade_timer = null
}
])
}
}
}
end
dastrix80
(Kris K)
September 24, 2018, 10:42am
29
20:42:18.537 [INFO ] [smarthome.event.ItemStateChangedEvent] - LivingRoomDim1 changed from 0 to 5
20:42:18.576 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'LivingRoomDim1' received command 2
20:42:18.584 [INFO ] [smarthome.event.ItemStateChangedEvent] - LivingRoomDim1 changed from 5 to 2
20:42:18.679 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'LivingRoomDim1' received command 4
20:42:18.688 [INFO ] [smarthome.event.ItemStateChangedEvent] - LivingRoomDim1 changed from 2 to 4
20:42:18.782 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'LivingRoomDim1' received command 6
20:42:18.789 [INFO ] [smarthome.event.ItemStateChangedEvent] - LivingRoomDim1 changed from 4 to 6
20:42:18.886 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'LivingRoomDim1' received command 8
20:42:18.893 [INFO ] [smarthome.event.ItemStateChangedEvent] - LivingRoomDim1 changed from 6 to 8
20:42:18.989 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'LivingRoomDim1' received command 10
20:42:18.996 [INFO ] [smarthome.event.ItemStateChangedEvent] - LivingRoomDim1 changed from 8 to 10
20:42:19.092 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'LivingRoomDim1' received command 12
20:42:19.099 [INFO ] [smarthome.event.ItemStateChangedEvent] - LivingRoomDim1 changed from 10 to 12
20:42:19.195 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'LivingRoomDim1' received command 14
20:42:19.201 [INFO ] [smarthome.event.ItemStateChangedEvent] - LivingRoomDim1 changed from 12 to 14
20:42:19.298 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'LivingRoomDim1' received command 16
20:42:19.306 [INFO ] [smarthome.event.ItemStateChangedEvent] - LivingRoomDim1 changed from 14 to 16
20:42:19.400 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'LivingRoomDim1' received command 18
20:42:19.406 [INFO ] [smarthome.event.ItemStateChangedEvent] - LivingRoomDim1 changed from 16 to 18
20:42:19.504 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'LivingRoomDim1' received command 20
20:42:19.511 [INFO ] [smarthome.event.ItemStateChangedEvent] - LivingRoomDim1 changed from 18 to 20
20:42:19.607 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'LivingRoomDim1' received command 22
20:42:19.614 [INFO ] [smarthome.event.ItemStateChangedEvent] - LivingRoomDim1 changed from 20 to 22
20:42:19.710 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'LivingRoomDim1' received command 24
20:42:19.717 [INFO ] [smarthome.event.ItemStateChangedEvent] - LivingRoomDim1 changed from 22 to 24
20:42:19.813 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'LivingRoomDim1' received command 26
20:42:19.821 [INFO ] [smarthome.event.ItemStateChangedEvent] - LivingRoomDim1 changed from 24 to 26
20:42:19.916 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'LivingRoomDim1' received command 28
20:42:19.923 [INFO ] [smarthome.event.ItemStateChangedEvent] - LivingRoomDim1 changed from 26 to 28
20:42:20.019 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'LivingRoomDim1' received command 30
20:42:20.026 [INFO ] [smarthome.event.ItemStateChangedEvent] - LivingRoomDim1 changed from 28 to 30
vzorglub
(Vincent Regaud)
September 24, 2018, 10:50am
30
Does the kodi binding send a PAUSE command before STOP
Then that would explain the 5, because of your PAUSE rule
dastrix80
(Kris K)
September 24, 2018, 10:53am
31
Seems it is…I wonder why it would do that
20:52:59.288 [INFO ] [smarthome.event.ItemStateChangedEvent] - myKodi_control changed from PLAY to PAUSE
20:52:59.309 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'LivingRoomDim1' received command 5
20:52:59.334 [INFO ] [smarthome.event.ItemStateChangedEvent] - myKodi_stop changed from OFF to ON
20:52:59.340 [INFO ] [smarthome.event.ItemStateChangedEvent] - myKodi_title changed from Blade Runner 2049 to UNDEF
20:52:59.346 [INFO ] [smarthome.event.ItemStateChangedEvent] - myKodi_artist changed from Denis Villeneuve to UNDEF
20:52:59.352 [INFO ] [smarthome.event.ItemStateChangedEvent] - myKodi_mediatype changed from movie to UNDEF
20:52:59.357 [INFO ] [smarthome.event.ItemStateChangedEvent] - myKodi_genrelist changed from Mystery, Science Fiction, Thriller to UNDEF
20:52:59.363 [INFO ] [smarthome.event.ItemStateChangedEvent] - myKodi_ctp changed from 0.43340978026390076 % to -1.0 %
20:52:59.369 [INFO ] [smarthome.event.ItemStateChangedEvent] - myKodi_currenttime changed from 42 s to -1 s
20:52:59.374 [INFO ] [smarthome.event.ItemStateChangedEvent] - myKodi_duration changed from 9807 s to -1 s
20:52:59.379 [INFO ] [smarthome.event.ItemStateChangedEvent] - LivingRoomDim1 changed from 0 to 5
20:52:59.394 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'LivingRoomDim1' received command 2
20:52:59.400 [INFO ] [smarthome.event.ItemStateChangedEvent] - LivingRoomDim1 changed from 5 to 2
20:52:59.497 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'LivingRoomDim1' received command 4
20:52:59.505 [INFO ] [smarthome.event.ItemStateChangedEvent] - LivingRoomDim1 changed from 2 to 4
20:52:59.600 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'LivingRoomDim1' received command 6
20:52:59.606 [INFO ] [smarthome.event.ItemStateChangedEvent] - LivingRoomDim1 changed from 4 to 6
20:52:59.702 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'LivingRoomDim1' received command 8
20:52:59.709 [INFO ] [smarthome.event.ItemStateChangedEvent] - LivingRoomDim1 changed from 6 to 8
20:52:59.805 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'LivingRoomDim1' received command 10
20:52:59.812 [INFO ] [smarthome.event.ItemStateChangedEvent] - LivingRoomDim1 changed from 8 to 10
20:52:59.908 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'LivingRoomDim1' received command 12
20:52:59.915 [INFO ] [smarthome.event.ItemStateChangedEvent] - LivingRoomDim1 changed from 10 to 12
20:53:00.011 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'LivingRoomDim1' received command 14
20:53:00.018 [INFO ] [smarthome.event.ItemStateChangedEvent] - LivingRoomDim1 changed from 12 to 14
20:53:00.113 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'LivingRoomDim1' received command 16
20:53:00.120 [INFO ] [smarthome.event.ItemStateChangedEvent] - LivingRoomDim1 changed from 14 to 16
20:53:00.216 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'LivingRoomDim1' received command 18
20:53:00.223 [INFO ] [smarthome.event.ItemStateChangedEvent] - LivingRoomDim1 changed from 16 to 18
20:53:00.319 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'LivingRoomDim1' received command 20
20:53:00.326 [INFO ] [smarthome.event.ItemStateChangedEvent] - LivingRoomDim1 changed from 18 to 20
20:53:00.423 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'LivingRoomDim1' received command 22
20:53:00.430 [INFO ] [smarthome.event.ItemStateChangedEvent] - LivingRoomDim1 changed from 20 to 22
20:53:00.524 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'LivingRoomDim1' received command 24
20:53:00.531 [INFO ] [smarthome.event.ItemStateChangedEvent] - LivingRoomDim1 changed from 22 to 24
20:53:00.627 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'LivingRoomDim1' received command 26
20:53:00.634 [INFO ] [smarthome.event.ItemStateChangedEvent] - LivingRoomDim1 changed from 24 to 26
20:53:00.730 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'LivingRoomDim1' received command 28
20:53:00.737 [INFO ] [smarthome.event.ItemStateChangedEvent] - LivingRoomDim1 changed from 26 to 28
20:53:00.832 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'LivingRoomDim1' received command 30
20:53:00.840 [INFO ] [smarthome.event.ItemStateChangedEvent] - LivingRoomDim1 changed from 28 to 30
vzorglub
(Vincent Regaud)
September 24, 2018, 11:07am
32
rule "When Kodi Player changed to PAUSE"
when
Item myKodi_control changed to PAUSE
then
Thread::sleep(200)
if (FibaroEye1Lux.state < 20 && LivingRoomSw1.state == OFF && myKody_stop == OFF)
LivingRoomDim1.sendCommand(5)
end
dastrix80
(Kris K)
September 24, 2018, 11:20am
34
vzorglub:
Thread::sleep(200)
Ha, its even weirder!
21:19:50.600 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'LivingRoomDim1' received command 2
21:19:50.608 [INFO ] [smarthome.event.ItemStateChangedEvent] - LivingRoomDim1 changed from 0 to 2
21:19:50.694 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'LivingRoomDim1' received command 5
21:19:50.703 [INFO ] [smarthome.event.ItemStateChangedEvent] - LivingRoomDim1 changed from 2 to 5
21:19:50.708 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'LivingRoomDim1' received command 4
21:19:50.716 [INFO ] [smarthome.event.ItemStateChangedEvent] - LivingRoomDim1 changed from 5 to 4
21:19:50.804 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'LivingRoomDim1' received command 6
21:19:50.811 [INFO ] [smarthome.event.ItemStateChangedEvent] - LivingRoomDim1 changed from 4 to 6
21:19:50.907 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'LivingRoomDim1' received command 8
21:19:50.913 [INFO ] [smarthome.event.ItemStateChangedEvent] - LivingRoomDim1 changed from 6 to 8
21:19:51.009 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'LivingRoomDim1' received command 10
21:19:51.015 [INFO ] [smarthome.event.ItemStateChangedEvent] - LivingRoomDim1 changed from 8 to 10
21:19:51.111 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'LivingRoomDim1' received command 12
21:19:51.118 [INFO ] [smarthome.event.ItemStateChangedEvent] - LivingRoomDim1 changed from 10 to 12
21:19:51.214 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'LivingRoomDim1' received command 14
21:19:51.221 [INFO ] [smarthome.event.ItemStateChangedEvent] - LivingRoomDim1 changed from 12 to 14
21:19:51.316 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'LivingRoomDim1' received command 16
21:19:51.323 [INFO ] [smarthome.event.ItemStateChangedEvent] - LivingRoomDim1 changed from 14 to 16
21:19:51.419 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'LivingRoomDim1' received command 18
21:19:51.426 [INFO ] [smarthome.event.ItemStateChangedEvent] - LivingRoomDim1 changed from 16 to 18
21:19:51.521 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'LivingRoomDim1' received command 20
21:19:51.527 [INFO ] [smarthome.event.ItemStateChangedEvent] - LivingRoomDim1 changed from 18 to 20
21:19:51.623 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'LivingRoomDim1' received command 22
21:19:51.630 [INFO ] [smarthome.event.ItemStateChangedEvent] - LivingRoomDim1 changed from 20 to 22
21:19:51.727 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'LivingRoomDim1' received command 24
21:19:51.732 [INFO ] [smarthome.event.ItemStateChangedEvent] - LivingRoomDim1 changed from 22 to 24
21:19:51.829 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'LivingRoomDim1' received command 26
21:19:51.838 [INFO ] [smarthome.event.ItemStateChangedEvent] - LivingRoomDim1 changed from 24 to 26
21:19:51.932 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'LivingRoomDim1' received command 28
21:19:51.939 [INFO ] [smarthome.event.ItemStateChangedEvent] - LivingRoomDim1 changed from 26 to 28
21:19:52.035 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'LivingRoomDim1' received command 30
21:19:52.042 [INFO ] [smarthome.event.ItemStateChangedEvent] - LivingRoomDim1 changed from 28 to 30
21:19:53.576 [INFO ] [smarthome.event.ItemStateChangedEvent] - LivingRoomSw1 changed from OFF to ON
vzorglub
(Vincent Regaud)
September 24, 2018, 11:24am
35
Forgot the .state
rule "When Kodi Player changed to PAUSE"
when
Item myKodi_control changed to PAUSE
then
Thread::sleep(200)
if (FibaroEye1Lux.state < 20 && LivingRoomSw1.state == OFF && myKody_stop.state == OFF)
LivingRoomDim1.sendCommand(5)
end
dastrix80
(Kris K)
September 24, 2018, 11:35am
36
Its working but ive no idea why.
The issue is present in STOP, yet you made changes to PAUSE. Ill test it out a little bit more but that looks to have done the trick. I just need to now play with the Percentage amount and the time, to try and ‘smooth’ the dimming, its quite abrupt
Thanks Vincent, as usual!
vzorglub
(Vincent Regaud)
September 24, 2018, 11:56am
37
Yes because the PAUSE rule was send the 5 command so I disabled it when when the kodi receives STOP
The Thread Pause is to give time to OH for myKody_stop
to change to ON
1 Like
dastrix80
(Kris K)
September 24, 2018, 11:57am
38
I dont understand time for bed, ill sleep on it
Thanks Vincent!