Script White Light Temperature for an Osram SMART+ with DeCONZ and Home Assistant
2 min read

Script White Light Temperature for an Osram SMART+ with DeCONZ and Home Assistant

Script White Light Temperature for an Osram SMART+ with DeCONZ and Home Assistant

Today I got finally the DeConz stick to control my first smart bulb, am OSRAM SMART+ RGB one. I've set up a number of simple tasks to do via the Home Assistant:

  1. Toggle the light on and off
  2. Set the light with a colour
  3. Set a different white temperature for the light

My first attempt was to set up the white like a programmer, i.e. using the RGB values. Setting up the brightness to 255 and the RGB values to 255 too, got me a very pale cold light. It makes sense because this is what you normally get if you're turning on all components on a RGB led.

This is not right, because my bulb was nice an bright when I first turned it on. Moreover, when I moved the 'Colour temperature' bar, The bulb became bright again.

HomeAssistantThe colour popup

I've tried to send the hue as per the DeConz REST specs, to be met with unsupported tag errors. The last resort was to dig through the source, with the following results:

  • DeConz uses attributes defined in 'components/light' module
  • You can use colour temperature or its kelvin value.

My script looks like this:

  • Action type: Call Service

  • Service: light.turn_on

  • Service data: JSON below

    {
      "brightness": 255,
      "entity_id": "light.living_room",
      "kelvin": 3000
    }
    

The values are:

  1. brightness - a value between 0 and 255. 0 turns the bulb off. Between 1 and 10 I get the same perceptible value. 255 is 100%.
  2. entity_id - is the entity identifier. If you have a room set up (like me), it'll propagate the same values to all bulbs in the room (that support them)
  3. kelvin - the temperature in Kelvin. 3000 gives a nice yellow-ish temperature. 5000 is quite cold for my taste.

Now you have all components to write your own script for Home Assistant.

HTH,