[SOLVED] Issues with lights that have color temp and brightness, and group switch issue

  • Platform information:
    • Hardware: Zotac ZBOX ID-80
    • OS: Ubuntu Server 18.04.03 LTS
    • Java Runtime Environment:
      openjdk version “1.8.0_242”
      OpenJDK Runtime Environment (Zulu 8.44.0.11-CA-linux64) (build 1.8.0_242-b20)
      OpenJDK 64-Bit Server VM (Zulu 8.44.0.11-CA-linux64) (build 25.242-b20, mixed mode)
    • openHAB version: 2.5.0 Release Build

A bit of an introduction, if you’re lazy to read you may want to skip to the actual issue.

I recently bought some smart switches and lights and flashed tasmota on them. I wanted a way to control them all in one place and decided to go with openHAB installed on a Zotac Mini PC that I still had lying around gathering dust (my Raspberry Pi 2 is already used for Pi-hole and would rather keep it free from other projects, and my Pi Zero W that I used for flashing the devices would seem a bit under powered for the job). So I went ahead and put a fresh install of Ubuntu Server on the Zotac, installed openHAB, prepared it all and after reading many tutorials and lots of trial and error I managed to set most of it up by controlling them through MQTT.
First I only used Paper UI, but shortly after moved to just using configuration files that I edit in Visual Studio Code on my Windows 10 computer. I’m using MQTT.fx to monitor MQTT traffic, and controlling my devices through my iPhone with the openHAB app or using the BasicUI panel on my pc.

I already feel quite accomplished seeing how these lights turn on and off at the press of a button on my phone, however there are still some issues I’m facing.

Actual issues

Issue 1
I have two LED Filaments bulbs set up that also have a color temperature and brightness that you can control. I have a switch for each group, to turn on and off all devices in that group. When I turn off the group that has the filament bulb in it, the light will turn off, very shortly turn on and flash bright white and then turn off again. I made a slow motion gif of it for clarification: https://imgur.com/a/bXJ2SbU
When I turn it back on, it will turn on to maximum brightness and color temperature.

Of course this is not the behaviour I want. I want the light to just turn off normally, and when I turn it back on it should go back to the last used brightness and color temperature. Now when looking at my items configuration, I can sort of understand why it does this. Items LED_Groot_1 for the power, LED_Groot_1_CT for the color temperature and LED_Groot_1_Brightness for the brightness all belong to the group gKeuken. So when I switch off everything in that group, it also switches off the brightness and color temperature. A quick fix would be to remove the color temperature and brightness from the gKeuken group, but that would prevent the sliders from showing up under my gKeuken group tab in the BasicUI. I should note that in the things configuration, I used to have retained set to true on the channels but read that that could cause issues so I set it to false.

This is what MQTT.fx shows that is happening when I turn off the group switch (currently the group only has that one light):

  • OFF is sent to cmnd/tasmota-LED-Groot/POWER.
  • 153 is sent to cmnd/tasmota-LED-Groot/CT (153 being the minimum value for the color temperature).
  • 0 is sent to cmnd/tasmota-LED-Groot/dimmer
  • stat/tasmota-LED-Groot/RESULT shows {“POWER”:“OFF”}
  • stat/tasmota-LED-Groot/POWER shows OFF
  • stat/tasmota-LED-Groot/RESULT shows {“POWER”:“ON”,“Dimmer”:100,“Color”:“FF00”,“White”:100,“CT”:153,“Channel”:[100,0]}
  • stat/tasmota-LED-Groot/RESULT shows {“POWER”:“OFF”,“Dimmer”:0,“Color”:“0000”,“White”:0,“CT”:153,“Channel”:[0,0]}

I believe something goes wrong too when turning on the lamp, but because it’s “ON” with 0 brightness before turning to full brightness and color temp it doesn’t show when you look at the lamp.

Below are my config files.

Issue 2
The filament lightbulbs have three channels. power, color temperature and brightness all belonging to the group where the light is located. The light LED_Groot_1 is currently the only on in its group, as is LED_Klein_1. When I switch off the group, the switch on my BasicUI flips to red indicating that the group is off. So far so good. BUT, when I go to the group page and turn off the switch only (thus leaving the color temperature and brightness “on”) the light will turn off but on the BasicUI homepage it will show that the group is on. It relates to issue one, but not sure how to fix this properly.

Unrelated issue 3
The bedroom icon for the group gSlaapkamer shows on BasicUI on my pc, but in the iOS app it doesn’t have an icon. My gWoonkamer group which has a custom .svg icon does show on both.

Picture of BasicUI

Config files

  • Items configuration:

    //Group Switches
Group:Switch:AND(ON,OFF)    gVerlichting    "Alle verlichting"
Group:Switch:OR(ON,OFF)     gWoonkamer      "Woonkamer"
Group:Switch:OR(ON,OFF)     gKeuken         "Keuken"
Group:Switch:OR(ON,OFF)     gSlaapkamer     "Slaapkamer"

    //Woonkamer
Switch      Stekker_1               "Stekker 1"                 <poweroutlet>   (gWoonkamer, gVerlichting)      {channel="mqtt:topic:e07934a6:Stekker_1:PowerSwitch"}
Switch      Stekker_2               "Stekker 2"                 <poweroutlet>   (gWoonkamer, gVerlichting)      {channel="mqtt:topic:e07934a6:Stekker_2:PowerSwitch"}

    //Keuken
Switch      LED_Groot_1             "LED Groot 1"               <lightbulb>     (gKeuken, gVerlichting)         {channel="mqtt:topic:e07934a6:LED_Groot_1:PowerSwitch"}
Dimmer      LED_Groot_1_CT          "Kleurtemperatuur [%d %%]"  <ColorLight>    (gKeuken, gVerlichting)         {channel="mqtt:topic:e07934a6:LED_Groot_1:ColorTemp"}
Dimmer      LED_Groot_1_Brightness  "Brightness [%d %%]"        <Slider>        (gKeuken, gVerlichting)         {channel="mqtt:topic:e07934a6:LED_Groot_1:Brightness"}

    //Slaapkamer
Switch      LED_Klein_1             "LED Klein 1"               <lightbulb>     (gSlaapkamer, gVerlichting)     {channel="mqtt:topic:e07934a6:LED_Klein_1:PowerSwitch"}
Dimmer      LED_Klein_1_CT          "Kleurtemperatuur [%d %%]"  <ColorLight>    (gSlaapkamer, gVerlichting)     {channel="mqtt:topic:e07934a6:LED_Klein_1:ColorTemp"}
Dimmer      LED_Klein_1_Brightness  "Brightness [%d %%]"        <Slider>        (gSlaapkamer, gVerlichting)     {channel="mqtt:topic:e07934a6:LED_Klein_1:Brightness"}

    //Misc
DateTime    Date                    "[%1$tA, %1$te %1$tB %1$tY]"                                                { channel="ntp:ntp:demo:dateTime" }
DateTime    TimeLocal               "[%1$tk:%1$tM]"                                                             { channel="ntp:ntp:demo:dateTime" }

  • Sitemap configuration:
sitemap default label="Thuis"
{
	Frame	label="Algemeen"
	{
		Text	item=Date			label="Datum"			icon=calendar
		Text	item=TimeLocal		label="Tijd"			icon=time
	}
	Frame	label="Kamers"
	{
		Group	item=gWoonkamer		label="Woonkamer"		icon="woonkamer"
		Group	item=gKeuken		label="Keuken"			icon="kitchen"
		Group	item=gSlaapkamer	label="Slaapkamer"		icon="bedroom"
	}
    Frame	label="Verlichting"
	{
		Switch	item=gVerlichting	mappings=[OFF="All Off", ON="All On"]
		Switch	item=gWoonkamer		mappings=[OFF="All Off", ON="All On"]
        Switch	item=gKeuken		mappings=[OFF="All Off", ON="All On"]
		Switch	item=gSlaapkamer	mappings=[OFF="All Off", ON="All On"]
	}

	Frame	label="Misc"
	{
		Text	label="Losse onderdelen"	icon=settings {
			Frame {
        		Switch	item=Stekker_1
        		Switch	item=Stekker_2
					Text label= "LED Groot 1"	icon=lightbulb
					{
       					Switch	item=LED_Groot_1
						Slider	item=LED_Groot_1_CT
						Slider	item=LED_Groot_1_Brightness
					}
					Text label= "LED Klein 1"	icon=lightbulb
					{
       					Switch	item=LED_Klein_1
						Slider	item=LED_Klein_1_CT
						Slider	item=LED_Klein_1_Brightness
					}
			}
		}
	}
}
  • Things configuration:
Bridge mqtt:broker:e07934a6 [ host="192.168.2.200", secure=false, username="MyUsername", password="MyPassword"] {
  Thing topic Stekker_1 "Stekker 1" {
    Channels:
            Type switch : PowerSwitch [ 
              stateTopic="stat/tasmota-stekker1/POWER",
              commandTopic="cmnd/tasmota-stekker1/POWER",
              on="ON",
              off="OFF",
              retained=false 
              ]
      }
  Thing topic Stekker_2 "Stekker 2"{
    Channels:
            Type switch : PowerSwitch [ 
              stateTopic="stat/tasmota-stekker2/POWER",
              commandTopic="cmnd/tasmota-stekker2/POWER",
              on="ON",
              off="OFF",
              retained=false 
              ]
   }
  Thing topic LED_Groot_1 "LED Groot 1" {
    Channels:
            Type switch : PowerSwitch [
              stateTopic="stat/tasmota-LED-Groot/POWER",
              commandTopic="cmnd/tasmota-LED-Groot/POWER",
              on="ON",
              off="OFF",
              retained=false 
              ]
            Type dimmer : ColorTemp [
              stateTopic="stat/tasmota-LED-Groot/CT",
              commandTopic="cmnd/tasmota-LED-Groot/CT",
              on="ON",
              off="OFF",
              min=153,
              max=500,
              retained=false 
              ] 
            Type dimmer : Brightness [
              stateTopic="stat/tasmota-LED-Groot/dimmer",
              commandTopic="cmnd/tasmota-LED-Groot/dimmer",
              on="ON",
              off="OFF",
              min=0,
              max=100,
              retained=false
            ]
  }
  Thing topic LED_Klein_1 "LED Klein 1" {
        Channels:
            Type switch : PowerSwitch [
              stateTopic="stat/LED-klein-1/POWER",
              commandTopic="cmnd/LED-klein-1/POWER",
              on="ON",
              off="OFF",
              retained=false 
              ]
            Type dimmer : ColorTemp [
              stateTopic="stat/LED-klein-1/CT",
              commandTopic="cmnd/LED-klein-1/CT",
              on="ON",
              off="OFF",
              min=153,
              max=500,
              retained=false 
              ] 
            Type dimmer : Brightness [
              stateTopic="stat/LED-klein-1/dimmer",
              commandTopic="cmnd/LED-klein-1/dimmer",
              on="ON",
              off="OFF",
              min=0,
              max=100,
              retained=false
            ]
  }
}

ntp:ntp:demo [ hostname="nl.pool.ntp.org", refreshInterval=60, refreshNtp=30 ]

Oops. I wasn’t done editing yet but accidentally posted it already. Give me a while to edit my post.

Edit: alright all done now. Sorry for the lengthy post, but I thought the more info I give the easier it for someone to help me (hopefully). Any help is much appreciated.

Items can belong to more than one group.
So, you can put just the Switch Items into some new Group for switch control only. gKeuken_master or something. Put that on your sitemap with a Switch widget.
Sending commands to that Group will then not propagate to the dimmer/color channels.

1 Like

Awesome! That did the trick, thank you very much. The lights work as expected now.

Issue 1 and 2 fixed (but order changed)
First I noticed the individual items didn’t show up anymore in my BasicUI under the group tabs but I realized I forgot to define the groups gSlaapkamer and gKeuken in my items file after making the change to the old group switch items. After adding those group items back, the items showed up again in the group tabs.
However, I noticed the order of the items changed for the group gKeuken, while they stayed the same for gSlaapkamer. Any idea why this happened? On my phone it also changed the order. See screenshots and config files below.


Issue 3 - bedroom icon not showing up on iOS app
Anyone has this same issue and any possible fix? I tried all “Places” icons from the official iconset and the only one that doesn’t work on my phone is bedroom.

The relevant parts of the sitemap now look like this:

	Frame	label="Kamers"
	{
		Group	item=gWoonkamer				label="Woonkamer"		icon="woonkamer"
		Group	item=gKeuken				label="Keuken"			icon="kitchen"
		Group	item=gSlaapkamer			label="Slaapkamer"		icon="bedroom"
	}
    Frame	label="Verlichting"
	{
		Switch	item=gVerlichting			mappings=[OFF="All Off", ON="All On"]
		Switch	item=gWoonkamer				mappings=[OFF="All Off", ON="All On"]
        Switch	item=gKeuken_master			mappings=[OFF="All Off", ON="All On"]
		Switch	item=gSlaapkamer_master		mappings=[OFF="All Off", ON="All On"]

The relevant parts of the items file:

    //Group Switches
Group:Switch:AND(ON,OFF)    gVerlichting            "Alle verlichting"
Group:Switch:OR(ON,OFF)     gWoonkamer              "Woonkamer"
Group:Switch:OR(ON,OFF)     gKeuken_master          "Keuken"
Group:Switch:OR(ON,OFF)     gSlaapkamer_master      "Slaapkamer"
Group                       gSlaapkamer             "Slaapkamer"
Group                       gKeuken                 "Keuken"

    //Woonkamer
Switch      Stekker_1               "Stekker 1"                 <poweroutlet>   (gWoonkamer, gVerlichting)                      {channel="mqtt:topic:e07934a6:Stekker_1:PowerSwitch"}
Switch      Stekker_2               "Stekker 2"                 <poweroutlet>   (gWoonkamer, gVerlichting)                      {channel="mqtt:topic:e07934a6:Stekker_2:PowerSwitch"}

    //Keuken
Switch      LED_Groot_1             "LED Groot 1"               <lightbulb>     (gKeuken, gKeuken_master, gVerlichting)         {channel="mqtt:topic:e07934a6:LED_Groot_1:PowerSwitch"}
Dimmer      LED_Groot_1_CT          "Kleurtemperatuur [%d %%]"  <ColorLight>    (gKeuken)                                       {channel="mqtt:topic:e07934a6:LED_Groot_1:ColorTemp"}
Dimmer      LED_Groot_1_Brightness  "Brightness [%d %%]"        <Slider>        (gKeuken)                                       {channel="mqtt:topic:e07934a6:LED_Groot_1:Brightness"}

    //Slaapkamer
Switch      LED_Klein_1             "LED Klein 1"               <lightbulb>     (gSlaapkamer, gSlaapkamer_master, gVerlichting) {channel="mqtt:topic:e07934a6:LED_Klein_1:PowerSwitch"}
Dimmer      LED_Klein_1_CT          "Kleurtemperatuur [%d %%]"  <ColorLight>    (gSlaapkamer)                                   {channel="mqtt:topic:e07934a6:LED_Klein_1:ColorTemp"}
Dimmer      LED_Klein_1_Brightness  "Brightness [%d %%]"        <Slider>        (gSlaapkamer)                                   {channel="mqtt:topic:e07934a6:LED_Klein_1:Brightness"}

Most people tire of using the Group widget in sitemaps. It is very limited - you cannot control the order of displaying stuff, you cannot modify any of the underlying Items by using different widgets or colours or visibility or mapping or …

You can do it the longhand way
Replace

Group	item=gKeuken		label="Keuken"			icon="kitchen"

with

Group item=gKeuken	label="Keuken" icon="kitchen" {
   Switch item=anyItem 
   Text item=mysensor  labelcolor=["blue"]
}

The braces { } change the Group widget from “auto all members in default” to “display only what I specify”.
You don’t have to display all members, you can display things that are not members at all.

It’s more work to be done once only, more precise, more flexible.

The Text { } widget can do the same trick, where there’s no actual group Item.

Thanks! Didn’t know that.

So basically using your code is the same as this? So what is the benefit of using Group item=gKeuken ? Apart from it being a line less of code?

Text	label="Keuken"	icon=kitchen {
	Frame {
		Switch	item=anyItem
		Text item=mysensor  labelcolor=["blue"]
	}
}

It’s quick and dirty.
Note that is just the default Group widget behaviour.
Group { } widget with braces offers the more powerful longhand version, while still allowing display of a Group Item’s features - an average temperature state for example.

Independently of any display issues, Group type Items offer useful tools in rules to handle clusters of associated Items (like all lights in a room) or of similar function (like all sensors that need processing)

Be careful nesting Text/Group widgets and Frames in sitemaps. There are weird rules about that that I cannot remember - watch out for complaints in openhab.log when editing sitemaps.

Ah ok, thank you! My setup is still very basic but I’ll probably expand upon it as time goes by.