Ich brauche mal wieder Eure Hilfe für eine OpenHAB Rule.
Ziel ist es zu einer bestimmten Zeit meine Aquarienbeleuchtung langsam hoch bzw runter zu dimmen.
Ich habe mir hier eine Rule als Grundlage genommen, die etwas komplexer als meine Aufgabe ist.
Zum Einschalten habe ich mir die Rule folgendermaßen abgeändert.
Code: AquariumSonnenaufgang.rules
var Timer tAquaLicht = null
var Number nAquaCount = 0
rule "Aquarium Sonnenaufgang"
when
Time cron "0 25 19 * * ?" // Test
//Time cron "0 0 7 * * ?" // täglich um 07:00:00 Uhr
then
tAquaLicht?.cancel
nAquaCount = 0
tAquaLicht = createTimer(now.plusMillis(50),[|
nAquaCount += 1
if(nAquaCount < 101)
MyWiFiLight_color2.sendCommand((MyWiFiLight_color2.state as Number) + 1)
if(nAquaCount < 201)
tAquaLicht.reschedule(now.plusSeconds(6))
])
end
Alles anzeigen
irgendwo bei 50%
hängt es dann.
Code
2020-11-02 19:29:24.384 [ome.event.ItemCommandEvent] - Item 'MyWiFiLight_color2' received command 42.5686279535293579101562500
2020-11-02 19:29:24.390 [nt.ItemStatePredictedEvent] - MyWiFiLight_color2 predicted to become 42.5686279535293579101562500
2020-11-02 19:29:24.393 [vent.ItemStateChangedEvent] - MyWiFiLight_color2 changed from 41.5686279535293579101562500 to 42.5686279535293579101562500
2020-11-02 19:29:30.388 [ome.event.ItemCommandEvent] - Item 'MyWiFiLight_color2' received command 43.5686279535293579101562500
2020-11-02 19:29:30.417 [nt.ItemStatePredictedEvent] - MyWiFiLight_color2 predicted to become 43.5686279535293579101562500
2020-11-02 19:29:30.431 [vent.ItemStateChangedEvent] - MyWiFiLight_color2 changed from 42.5686279535293579101562500 to 43.5686279535293579101562500
2020-11-02 19:29:36.401 [ome.event.ItemCommandEvent] - Item 'MyWiFiLight_color2' received command 44.5686279535293579101562500
2020-11-02 19:29:36.405 [nt.ItemStatePredictedEvent] - MyWiFiLight_color2 predicted to become 44.5686279535293579101562500
2020-11-02 19:29:36.415 [vent.ItemStateChangedEvent] - MyWiFiLight_color2 changed from 43.5686279535293579101562500 to 44.5686279535293579101562500
2020-11-02 19:29:42.403 [ome.event.ItemCommandEvent] - Item 'MyWiFiLight_color2' received command 45.5686279535293579101562500
2020-11-02 19:29:42.410 [nt.ItemStatePredictedEvent] - MyWiFiLight_color2 predicted to become 45.5686279535293579101562500
2020-11-02 19:29:42.418 [vent.ItemStateChangedEvent] - MyWiFiLight_color2 changed from 44.5686279535293579101562500 to 45.5686279535293579101562500
2020-11-02 19:29:48.408 [ome.event.ItemCommandEvent] - Item 'MyWiFiLight_color2' received command 46.5686279535293579101562500
2020-11-02 19:29:48.414 [nt.ItemStatePredictedEvent] - MyWiFiLight_color2 predicted to become 46.5686279535293579101562500
2020-11-02 19:29:48.422 [vent.ItemStateChangedEvent] - MyWiFiLight_color2 changed from 45.5686279535293579101562500 to 46.5686279535293579101562500
2020-11-02 19:29:52.990 [vent.ItemStateChangedEvent] - wifiled_wifiled_40F520C82B33_color changed from 60.00000178813934326171875000,100,41.5686279535293579101562500 to 60.00000178813934326171875000,100,46.2745100259780883789062500
2020-11-02 19:29:52.994 [vent.ItemStateChangedEvent] - MyWiFiLight_color2 changed from 46.5686279535293579101562500 to 46.2745100259780883789062500
2020-11-02 19:29:54.414 [ome.event.ItemCommandEvent] - Item 'MyWiFiLight_color2' received command 47.2745100259780883789062500
2020-11-02 19:29:54.420 [nt.ItemStatePredictedEvent] - MyWiFiLight_color2 predicted to become 47.2745100259780883789062500
2020-11-02 19:29:54.436 [vent.ItemStateChangedEvent] - MyWiFiLight_color2 changed from 46.2745100259780883789062500 to 47.2745100259780883789062500
2020-11-02 19:30:00.416 [ome.event.ItemCommandEvent] - Item 'MyWiFiLight_color2' received command 48.2745100259780883789062500
2020-11-02 19:30:00.419 [nt.ItemStatePredictedEvent] - MyWiFiLight_color2 predicted to become 48.2745100259780883789062500
2020-11-02 19:30:00.425 [vent.ItemStateChangedEvent] - MyWiFiLight_color2 changed from 47.2745100259780883789062500 to 48.2745100259780883789062500
2020-11-02 19:30:06.419 [ome.event.ItemCommandEvent] - Item 'MyWiFiLight_color2' received command 49.2745100259780883789062500
2020-11-02 19:30:06.427 [nt.ItemStatePredictedEvent] - MyWiFiLight_color2 predicted to become 49.2745100259780883789062500
2020-11-02 19:30:06.430 [vent.ItemStateChangedEvent] - MyWiFiLight_color2 changed from 48.2745100259780883789062500 to 49.2745100259780883789062500
2020-11-02 19:30:12.423 [ome.event.ItemCommandEvent] - Item 'MyWiFiLight_color2' received command 50.2745100259780883789062500
2020-11-02 19:30:12.429 [nt.ItemStatePredictedEvent] - MyWiFiLight_color2 predicted to become 50.2745100259780883789062500
2020-11-02 19:30:12.442 [vent.ItemStateChangedEvent] - MyWiFiLight_color2 changed from 49.2745100259780883789062500 to 50.2745100259780883789062500
2020-11-02 19:30:18.426 [ome.event.ItemCommandEvent] - Item 'MyWiFiLight_color2' received command 51.2745100259780883789062500
2020-11-02 19:30:18.430 [nt.ItemStatePredictedEvent] - MyWiFiLight_color2 predicted to become 51.2745100259780883789062500
2020-11-02 19:30:18.434 [vent.ItemStateChangedEvent] - MyWiFiLight_color2 changed from 50.2745100259780883789062500 to 51.2745100259780883789062500
2020-11-02 19:30:23.113 [vent.ItemStateChangedEvent] - wifiled_wifiled_40F520C82B33_color changed from 60.00000178813934326171875000,100,46.2745100259780883789062500 to 60.00000178813934326171875000,100,49.0196079015731811523437500
2020-11-02 19:30:23.115 [vent.ItemStateChangedEvent] - MyWiFiLight_color2 changed from 51.2745100259780883789062500 to 49.0196079015731811523437500
2020-11-02 19:30:24.436 [ome.event.ItemCommandEvent] - Item 'MyWiFiLight_color2' received command 50.0196079015731811523437500
2020-11-02 19:30:24.439 [nt.ItemStatePredictedEvent] - MyWiFiLight_color2 predicted to become 50.0196079015731811523437500
2020-11-02 19:30:24.444 [vent.ItemStateChangedEvent] - MyWiFiLight_color2 changed from 49.0196079015731811523437500 to 50.0196079015731811523437500
2020-11-02 19:30:30.433 [ome.event.ItemCommandEvent] - Item 'MyWiFiLight_color2' received command 51.0196079015731811523437500
2020-11-02 19:30:30.438 [nt.ItemStatePredictedEvent] - MyWiFiLight_color2 predicted to become 51.0196079015731811523437500
2020-11-02 19:30:30.448 [vent.ItemStateChangedEvent] - MyWiFiLight_color2 changed from 50.0196079015731811523437500 to 51.0196079015731811523437500
2020-11-02 19:30:36.439 [ome.event.ItemCommandEvent] - Item 'MyWiFiLight_color2' received command 52.0196079015731811523437500
2020-11-02 19:30:36.442 [nt.ItemStatePredictedEvent] - MyWiFiLight_color2 predicted to become 52.0196079015731811523437500
2020-11-02 19:30:36.447 [vent.ItemStateChangedEvent] - MyWiFiLight_color2 changed from 51.0196079015731811523437500 to 52.0196079015731811523437500
2020-11-02 19:30:42.442 [ome.event.ItemCommandEvent] - Item 'MyWiFiLight_color2' received command 53.0196079015731811523437500
2020-11-02 19:30:42.446 [nt.ItemStatePredictedEvent] - MyWiFiLight_color2 predicted to become 53.0196079015731811523437500
2020-11-02 19:30:42.461 [vent.ItemStateChangedEvent] - MyWiFiLight_color2 changed from 52.0196079015731811523437500 to 53.0196079015731811523437500
2020-11-02 19:30:48.449 [ome.event.ItemCommandEvent] - Item 'MyWiFiLight_color2' received command 54.0196079015731811523437500
2020-11-02 19:30:48.452 [nt.ItemStatePredictedEvent] - MyWiFiLight_color2 predicted to become 54.0196079015731811523437500
2020-11-02 19:30:48.456 [vent.ItemStateChangedEvent] - MyWiFiLight_color2 changed from 53.0196079015731811523437500 to 54.0196079015731811523437500
2020-11-02 19:30:53.314 [vent.ItemStateChangedEvent] - wifiled_wifiled_40F520C82B33_color changed from 60.00000178813934326171875000,100,49.0196079015731811523437500 to 60.00000178813934326171875000,100,49.8039215803146362304687500
2020-11-02 19:30:53.314 [vent.ItemStateChangedEvent] - MyWiFiLight_color2 changed from 54.0196079015731811523437500 to 49.8039215803146362304687500
2020-11-02 19:30:54.456 [ome.event.ItemCommandEvent] - Item 'MyWiFiLight_color2' received command 50.8039215803146362304687500
2020-11-02 19:30:54.461 [nt.ItemStatePredictedEvent] - MyWiFiLight_color2 predicted to become 50.8039215803146362304687500
2020-11-02 19:30:54.466 [vent.ItemStateChangedEvent] - MyWiFiLight_color2 changed from 49.8039215803146362304687500 to 50.8039215803146362304687500
2020-11-02 19:31:00.449 [ome.event.ItemCommandEvent] - Item 'MyWiFiLight_color2' received command 51.8039215803146362304687500
Alles anzeigen
Zum Ausschalten habe ich folgende Rule.
Code: AquariumSonnenuntergang.rules
var Timer tAquaLicht = null
var Number nAquaCount = 0
rule "Aquarium Sonnenuntergang"
when
Time cron "0 08 19 * * ?" // Test
//Time cron "0 0 7 * * ?" // täglich um 07:00:00 Uhr
then
tAquaLicht?.cancel
nAquaCount = 100
tAquaLicht = createTimer(now.plusMillis(50),[|
nAquaCount -= 1
if(nAquaCount < 101)
MyWiFiLight_color2.sendCommand((MyWiFiLight_color2.state as Number) - 1)
if(nAquaCount < 201)
tAquaLicht.reschedule(now.plusSeconds(6))
])
end
Alles anzeigen
Die produziert dann am Ende folgenden Fehler
Code
2020-11-02 19:17:42.875 [vent.ItemStateChangedEvent] - MyWiFiLight_color2 changed from 1.0980392843484878540039062500 to 0.0980392843484878540039062500
2020-11-02 19:17:48.665 [vent.ItemStateChangedEvent] - wifiled_wifiled_40F520C82B33_color changed from 0,100,5.0980392843484878540039062500 to 0,0,0
2020-11-02 19:17:48.667 [vent.ItemStateChangedEvent] - MyWiFiLight_color2 changed from 0.0980392843484878540039062500 to 0
==> /var/[definition='1','0']log[/definition]/openhab2/openhab.[definition='1','0']log[/definition] <==
2020-11-02 19:17:48.869 [WARN ] [rthome.model.script.actions.BusEvent] - Cannot convert '-1' to a command type which item 'MyWiFiLight_color2' accepts: [PercentType, OnOffType, IncreaseDecreaseType, RefreshType].
Ich hoffe, ihr könnt mir mal wieder helfen.
Gruß
Patrick