[Solved] [Loxone] LightControllerV2: Can't switch off with rule / Alexa

Hi,

My goal is to be able to select individual lighting moods of a Loxone LightControllerV2 through Alexa, without mixing them in. The channels created for the individual moods always mix them, thus when switching to moods with fewer outputs on, I always have to say: “Alexa, Mood A off. Alexa Mood B on”. This is not convenient at all. I only want to say “Alexa, Mood B on” and it should switch the A-only-outputs off.

To work around this I tried creating virtual switches for the individual moods and setting the appropriate ID in the light controller Number item through rules, when the switch is toggled. This works fine (no mixing), except I’m not able to switch off all outputs in a rule. It seems like, there’s no ID assigned to the “Off” mood, or at least I couldn’t figure out which.

This is my LightController item:
Number Lichtsteuerung_Wohnzimmer "Lichtsteuerung Wohnzimmer" <light> ["Lighting"] {channel="loxone:miniserver:ac681435:126F495A-0184-E9BE-FFFFB6D057327F6C"}

It shows up in Paper UI as a dropdown with the available moods, even including the “Off” mood. Through Paper UI everything is fine, also switching off all lights by selecting the “Off” mood.

However, in the following rule, I didn’t find the appropriate value for the “Off” mood, yet (marked with ??? ). Licht_Wohnzimmer_Standard is the virtual switch.

rule "Licht Wohnzimmer Standard"
when
    Item Licht_Wohnzimmer_Standard received update
then
    if (Licht_Wohnzimmer_Standard.state == ON) {
        sendCommand(Lichtsteuerung_Wohnzimmer, 2)
    }
    if (Licht_Wohnzimmer_Standard.state == OFF) {
        sendCommand(Lichtsteuerung_Wohnzimmer, ???)
    }
end

Is there a better approach for selecting individual moods without mixing them? And if not, how to switch the LightControllerV2 off through a rule?

Thanks!

Have you tried watching the logs while, turning the light off, to see if the value is shown?

Sorry, I’m quite new to OpenHab. Where can I find the logs? The documentation says they are in /var/log/openhab2 but I don’t have this directory. Running OpenHab on Raspbian, installed via apt.

From the browser http://yourOHserverIP:8080/start/index where you normally select PaperUI select Openhab Log Viewer, just open this in another tab so you have both.

OK, got logging working now. openhab user couldn’t write to /var/log. Just created the /var/log/openhab2 dir with appropriate permissions and now I have logs.

To the interesting part. When I switch to “Off” in Paper UI, the log says:

2018-12-08 15:52:49.744 [ome.event.ItemCommandEvent] - Item 'Lichtsteuerung_Wohnzimmer' received command 778
2018-12-08 15:52:49.756 [vent.ItemStateChangedEvent] - Lichtsteuerung_Wohnzimmer changed from 2 to 778

Now set the value in my rule to 778 and it WORKS!

However, this is not very intuitive, right? Why 778? Isn’t there a better way?

Good deal, remember the logs are your friend.:wink:

Not really, but you will only see this in the rule and you can use // to comment like below.

ule "Licht Wohnzimmer Standard"
when
    Item Licht_Wohnzimmer_Standard received update
then
    if (Licht_Wohnzimmer_Standard.state == ON) {
        sendCommand(Lichtsteuerung_Wohnzimmer, 2)
    }
    if (Licht_Wohnzimmer_Standard.state == OFF) {
        sendCommand(Lichtsteuerung_Wohnzimmer, 778)  // command for OFF
    }
end

Scanning the doc’s it mentions that V2 can use a switch item. What happens when you change the item from a Number to a Switch?

Switch is only supported for the “mood” channels, which are created for every mood configured in the light controller. It would be perfect, if I could use these directly, but they mix with each other when more than one are enabled for a light controller. I need an “exclusive” behaviour, i.e. switch all other moods off, if one is selected. This is what the “light controller” channel does, when setting the ID of a mood. And this is also what the Loxone App does, when selecting a specific mood. Mixing should not be the default behaviour IMHO, but only something optional.

Thanks for your help, @H102, btw :smiley:

@danielm0hr Glad you got it working.:+1:

Your welcome, and you can always use the heart icon to say thanks as well.:wink:

Please mark the post solved by clicking the square box (lower right corner) on the post that provided the solution. Also edit the title to start with [Solved] so others with a similar issue can find a quick solution.

Thanks