Licht einschalten dauert ab und zu lange

Allgemeine Fragen rund um die "Smart Home" Hardware/Komponenten

Moderatoren: seppy, udo1toni

Benutzeravatar
udo1toni
Beiträge: 13858
Registriert: 11. Apr 2018 18:05
Answers: 222
Wohnort: Darmstadt

Re: Licht einschalten dauert ab und zu lange

Beitrag von udo1toni »

Quautiputzli hat geschrieben: 22. Apr 2021 18:29 Hi, so wie meine Configuration im Moment ist, funktioniert es ja.
Dann brauchst Du ja gar nichts weiter!?!
Quautiputzli hat geschrieben: 22. Apr 2021 18:29 Wie kann ich mehrere Transformationen verknüpfen?
Wenn Du Deinen Screenshot aufmerksam anschaust (insbesondere den Hilfstext, der bei Incoming Value Transformations dabei steht), findest Du die Antwort. Tipp: Der Text steht auch da, damit man das zu verwendende Zeichen einfach aus dem Text kopieren kann...

Aber die Transformation brauchst Du in diesem Fall ja nicht, oder?
openHAB4.1.2 stable in einem Debian-Container (bookworm) (Proxmox 8.1.5, LXC), mit openHABian eingerichtet

Quautiputzli
Beiträge: 317
Registriert: 29. Okt 2020 19:53
Answers: 2

Re: Licht einschalten dauert ab und zu lange

Beitrag von Quautiputzli »

udo1toni hat geschrieben: 23. Apr 2021 21:11 Dann brauchst Du ja gar nichts weiter!?!
Doch, wie man in meiner Rule sehen kann, möchte ich mit diesem Schalter nicht nur einen Rollo steuern, sondern hauptsächlich eine Farblampe.
ON OFF müsste mit dieser Version auch noch funktionieren, aber wie sende ich dann einen bestimmer Farbwert, wie z.B. "30,10,100"?

udo1toni hat geschrieben: 23. Apr 2021 21:11 Wenn Du Deinen Screenshot aufmerksam anschaust (insbesondere den Hilfstext, der bei Incoming Value Transformations dabei steht), findest Du die Antwort. Tipp: Der Text steht auch da, damit man das zu verwendende Zeichen einfach aus dem Text kopieren kann...

Aber die Transformation brauchst Du in diesem Fall ja nicht, oder?
Ah, okay, hab das mal eingefügt, hat ein paar Versuche gebraucht, bis ich bemerkt habe, dass da noch MAP: vorne dran muss. Also, mit dem Rollo geht das so schon mal auch:

Code: Alles auswählen

UID: mqtt:topic:broker:gf_office_switch
label: Lichtschalter Büro
thingTypeUID: mqtt:topic
configuration: {}
bridgeUID: mqtt:broker:broker
location: Büro
channels:
  - id: office_switch_trigger
    channelTypeUID: mqtt:trigger
    label: Büro Schalter Trigger
    description: ""
    configuration:
      stateTopic: zigbee2mqtt/GF_Office_Switch
      transformationPattern: JSONPATH:$.action
  - id: office_switch_batt
    channelTypeUID: mqtt:number
    label: Schalter Büro Batterie
    description: ""
    configuration:
      stateTopic: zigbee2mqtt/GF_Office_Switch
      transformationPattern: JSONPATH:$.battery
  - id: office_switch_shutter
    channelTypeUID: mqtt:rollershutter
    label: Büro Schalter Rollo
    description: ""
    configuration:
      stateTopic: zigbee2mqtt/GF_Office_Switch
      transformationPattern: JSONPATH:$.action∩MAP:office_switch.map
MAP:

Code: Alles auswählen

button_5_single=UP
button_6_single=DOWN
button_5_double=STOP
button_6_double=STOP
Nun hätte ich versucht das so auch mit der Lampe zu machen. Also noch einen Channel vom Typ Color am Schalter angelegt, aber da geht das Thing dann auf offline. Im log gibt es folgende Fehler:

Code: Alles auswählen

2021-04-23 22:30:09.207 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'mqtt:topic:broker:gf_office_switch' changed from ONLINE to OFFLINE (CONFIGURATION_ERROR): Remove and recreate: mqtt:topic:broker:gf_office_switch:office_switch_color

==> /var/log/openhab/openhab.log <==

2021-04-23 22:30:14.130 [WARN ] [rnal.handler.GenericMQTTThingHandler] - Channel configuration error

java.lang.IllegalArgumentException: No enum constant org.openhab.binding.mqtt.generic.mapping.ColorMode.

	at java.lang.Enum.valueOf(Enum.java:240) ~[?:?]

	at org.openhab.binding.mqtt.generic.mapping.ColorMode.valueOf(ColorMode.java:1) ~[bundleFile:?]

	at org.openhab.binding.mqtt.generic.values.ValueFactory.createValueState(ValueFactory.java:63) ~[bundleFile:?]

	at org.openhab.binding.mqtt.generic.internal.handler.GenericMQTTThingHandler.initialize(GenericMQTTThingHandler.java:164) [bundleFile:?]

	at org.openhab.core.thing.binding.BaseThingHandler.thingUpdated(BaseThingHandler.java:152) [bundleFile:?]

	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]

	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]

	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]

	at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]

	at org.openhab.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:154) [bundleFile:?]

	at org.openhab.core.internal.common.Invocation.call(Invocation.java:52) [bundleFile:?]

	at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]

	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]

	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]

	at java.lang.Thread.run(Thread.java:834) [?:?]
Seltsam
Servus

Benutzeravatar
udo1toni
Beiträge: 13858
Registriert: 11. Apr 2018 18:05
Answers: 222
Wohnort: Darmstadt

Re: Licht einschalten dauert ab und zu lange

Beitrag von udo1toni »

Wegen der Farbsteuerung kann ich Dir nicht wirklich helfen, da ich bei mir keine RGB Lampen verbaut habe (naja, irgendwie doch, aber die steuere ich halt nur aus openHAB heraus, nicht über irgendwelche Taster...)
openHAB4.1.2 stable in einem Debian-Container (bookworm) (Proxmox 8.1.5, LXC), mit openHABian eingerichtet

Quautiputzli
Beiträge: 317
Registriert: 29. Okt 2020 19:53
Answers: 2

Re: Licht einschalten dauert ab und zu lange

Beitrag von Quautiputzli »

Also,
ich hab nun don Rollershutter Channel nochmal gelöscht, dann einen Color Channel angelegt, verlinkt, wieder Rollershutter Channel angelegt, auch verlinkt, und es funktioniert nun mit beiden. Ich habe nun folgende MAP geschrieben:

Code: Alles auswählen

button_1_single=30,10,100
button_2_single=300,10,100
button_5_single=UP
button_6_single=DOWN
button_1_double=0,15,100
button_2_double=70,20,100
button_5_double=STOP
button_6_double=STOP
button_1_triple=130,100,100
button_2_triple=0,100,100
button_3_triple=200,100,100
button_4_triple=25,100,100
button_5_triple=300,100,100
button_6_triple=60,100,100
Diese benutze ich für den Shutter als auch den Color Channel.

Sollte ich hier lieber extra MAPs erstellen für Shutter und Channel. Jetzt macht das wohl noch kein Problem, aber wenn noch ein Dimmer Channel hinzukommt wird dieser Dimmerwert ja auch an den Shutter geschickt, und könnte dort interpretiert werden oder?

Und ein Toggle Modus ist so auch nicht möglich oder. Naja, das bleibt eben dann in der Rule, oder ich stelle noch um, dass jeweils ein Button zum ein- und ein anderer zum ausschalten ist.
In der Rule hab ich auch noch das dimmen, farbwechseln usw. gelassen:

Code: Alles auswählen

var Timer tbuero = null

rule "Buero Schalter"
when
    Channel "mqtt:topic:broker:gf_office_switch:office_switch_trigger" triggered 
then
    if (tbuero !== null) tbuero.cancel() 
    switch(receivedEvent)  {
//        case "button_1_single" : GF_Office_Light.sendCommand("30,10,100")
//        case "button_2_single" : GF_Office_Light.sendCommand("300,10,100")
        case "button_3_single" : {
            if (GF_Office_Light.getStateAs(OnOffType) != ON)
                GF_Office_Light.sendCommand(ON)
            else
                GF_Office_Light.sendCommand(OFF)
        }
        case "button_4_single" : {
            if (GF_Office_Light.getStateAs(OnOffType) != ON)
                GF_Office_Light.sendCommand("0,0,100")
            else
                GF_Office_Light.sendCommand(OFF)
        }
//        case "button_5_single" : GF_Office_Shutter.sendCommand(UP)
//        case "button_6_single" : GF_Office_Shutter.sendCommand(DOWN)
//        case "button_1_double" : GF_Office_Light.sendCommand("0,15,100")
//        case "button_2_double" : GF_Office_Light.sendCommand("70,20,100")
        case "button_3_double" : {
            Office_Light_temp.sendCommand((Office_Light_temp.state as Number) + 20)
        }
        case "button_4_double" : {
            Office_Light_temp.sendCommand((Office_Light_temp.state as Number) - 20)
        }
//        case "button_5_double" : GF_Office_Shutter.sendCommand(STOP)
//        case "button_6_double" : GF_Office_Shutter.sendCommand(STOP)
//        case "button_1_triple" : GF_Office_Light.sendCommand("130,100,100")
//        case "button_2_triple" : GF_Office_Light.sendCommand("0,100,100")
//        case "button_3_triple" : GF_Office_Light.sendCommand("200,100,100")
//        case "button_4_triple" : GF_Office_Light.sendCommand("25,100,100")
//        case "button_5_triple" : GF_Office_Light.sendCommand("300,100,100")
//        case "button_6_triple" : GF_Office_Light.sendCommand("60,100,100")
        case "button_1_hold" : {
            tbuero = createTimer(now, [ |
                var HSBType currentState
                currentState = GF_Office_Light.state as HSBType
                var DecimalType new_H = currentState.hue
                var PercentType new_S = currentState.saturation
                var PercentType new_B = new PercentType(currentState.brightness + 5)
                if( new_B > 98)
                    new_B = new PercentType(100)
                var HSBType newState = new HSBType(new_H,new_S,new_B)
                sendCommand(GF_Office_Light,newState.toString)
                if(new_B < 100)
                    tbuero.reschedule(now.plusNanos(200000000))
            ])
        }
        case "button_1_release" : {
            if(tbuero !== null) tbuero.cancel
        }
        case "button_2_hold" : {
            tbuero = createTimer(now, [ |
                var HSBType currentState
                currentState = GF_Office_Light.state as HSBType
                var DecimalType new_H = currentState.hue
                var PercentType new_S = currentState.saturation
                var PercentType new_B = new PercentType(currentState.brightness - 5)
                if( new_B < 20)
                    new_B = new PercentType(0)
                var HSBType newState = new HSBType(new_H,new_S,new_B)
                sendCommand(GF_Office_Light,newState.toString)
                if(new_B > 0)
                    tbuero.reschedule(now.plusNanos(200000000))
            ])
        }
        case "button_2_release" : {
            if(tbuero !== null) tbuero.cancel
        }
        case "button_5_hold" : {
            tbuero = createTimer(now, [ |
                var HSBType currentState
                currentState = GF_Office_Light.state as HSBType
                var DecimalType new_H = new DecimalType(currentState.hue + 10)
                var PercentType new_S = currentState.saturation
                var PercentType new_B = currentState.brightness
                if( new_H > 359)
                    new_H = new DecimalType(0)
                var HSBType newState = new HSBType(new_H,new_S,new_B)
                sendCommand(GF_Office_Light,newState.toString)
//                if(new_H < 360)
                    tbuero.reschedule(now.plusNanos(200000000))
            ])
        }
        case "button_5_release" : {
            if(tbuero !== null) tbuero.cancel
        }
        case "button_6_hold" : {
            tbuero = createTimer(now, [ |
                var HSBType currentState
                currentState = GF_Office_Light.state as HSBType
                var DecimalType new_H = new DecimalType(currentState.hue - 10)
                var PercentType new_S = currentState.saturation
                var PercentType new_B = currentState.brightness
                if( new_H < 10)
                    new_H = new DecimalType(359)
                var HSBType newState = new HSBType(new_H,new_S,new_B)
                sendCommand(GF_Office_Light,newState.toString)
//                if(new_H > 0)
                    tbuero.reschedule(now.plusNanos(200000000))
            ])
        }
        case "button_6_release" : {
            if(tbuero !== null) tbuero.cancel
        }
        case "button_3_hold" : {
            tbuero = createTimer(now, [ |
                var HSBType currentState
                currentState = GF_Office_Light.state as HSBType
                var DecimalType new_H = currentState.hue
                var PercentType new_S = new PercentType(currentState.saturation + 5)
                var PercentType new_B = currentState.brightness
                if( new_S > 95)
                    new_S = new PercentType(100)
                var HSBType newState = new HSBType(new_H,new_S,new_B)
                sendCommand(GF_Office_Light,newState.toString)
                if(new_S < 100)
                    tbuero.reschedule(now.plusNanos(200000000))
            ])
        }
        case "button_3_release" : {
            if(tbuero !== null) tbuero.cancel
        }
        case "button_4_hold" : {
            tbuero = createTimer(now, [ |
                var HSBType currentState
                currentState = GF_Office_Light.state as HSBType
                var DecimalType new_H = currentState.hue
                var PercentType new_S = new PercentType(currentState.saturation - 5)
                var PercentType new_B = currentState.brightness
                if( new_S < 5)
                    new_S = new PercentType(0)
                var HSBType newState = new HSBType(new_H,new_S,new_B)
                sendCommand(GF_Office_Light,newState.toString)
                if(new_S > 0)
                    tbuero.reschedule(now.plusNanos(200000000))
            ])
        }
        case "button_4_release" : {
            if(tbuero !== null) tbuero.cancel
        }
    }
end
Servus

Antworten