Using OSRAM Lightify Motion Sensor with HA - Triggered by change in RGB

Apologies if I’ve posted this in the wrong category. I’m new to HA but very quickly loving what it can do. I started with the basic scheduling of lights and switches, and as I already had a Lightify gateway for the bulbs, I decided to get the Osram Motion Sensor too to trigger the porch light when movement is detected after sunset. However, I found it wasn’t just a case of plug and play. What I did find on my voyage of discovering is that the attributes of this sensor (recognised as a light in HA) changed when movement was detected, specifically the RGB_COLOR value. After much fighting I finally created a sensor which switches on and off when movement is detected and thought I’d share as it has taken me days to get this far so it may help someone else.

  - platform: template
    sensors:
      porch_movements:
        value_template: "{% if '255, 255, 0' in states.light.porch_motion.attributes.rgb_color | string %}On{% else %}Off{% endif %}"

light.porch_motion is the name of the Osram Device
rgb_color: 255, 0, 0 is set when there is no movement
rgb_color: 255, 255, 0 means that movement has been detected

It’s so simple but took me days of trying to extract or test against this rgb value! I can now automate this, keeping on the outside porch light for a defined amount of time and restoring it back to its previous setting (based on a contribution I’ve found elsewhere on this forum) when it’s triggered.

works like a charm !

Thank you very much.

Worked for me to, although the RGB values were 1,1,0 instead. Thanks = )

Edit: After upgrading HA to 0.82.1 I had to change RGB values to 255 also ; )

Hi!, thank you for your hard work!!!. How we do the automation?, I’ve made several attempts with different parameters but I don’t g et it.

Thanks in advance!

Hi kalety,

do you have make a template.sensor like this:

- platform: template
  sensors:
    ar_motion:
      value_template: "{% if '255, 255, 0' in states.light.motionsensor.attributes.rgb_color | string %}Bewegung erkannt{% else %}Ruhig{% endif %}"

than you can make a automation.

Hi! I’m afraid I have slightly broken your workaround :slight_smile: See https://github.com/home-assistant/home-assistant/pull/22184 and https://github.com/home-assistant/home-assistant/pull/22597. The sensors won’t expose RGB and other irrelevant properties anymore. The good news is that you can find all your values in the new sensor_values attribute (it contains a list of all raw values returned by the gateway). Let me know should you need more details.

See also https://github.com/tfriedel/python-lightify/issues/9. Unfortunately I don’t own any of the sensors and can’t accurately implement their support, so I just did my best by exposing all the raw values “as is”.

Thanks!

Bought the Lightify starter kit because it was Zigbee and I already have XBee running in the house. It came with their gateway which requires you to show activate it. The Germans in charge of this never did send me back the email to activate the gateway. Tried several times but no success. Called Sylvania tech support and they said it was all up to the Germans.
It’s a shame as I really wanted to get these pot lights working with my Zigbee (Xbee) stuff.
Any ideas?

Hi!
I am also trying to get the motion sensor to work. At the moment I see the „new“ raw sensor values. But they do not seem to change. How can I figure out if they really do change if motion is detected?
@ar.ukraine Is there something I am missing?
Thanks!

Unfortunately, I don’t have any motion sensor and can’t test that. But according to existing information in Internet, it should work this way (but I can’t guarantee that):

{'battery_level': sensor_values[1],
 'enabled': bool(sensor_values[3]),
 'motion_detected': bool(sensor_values[4])}

Try to set both interval_lightify_status and scan_interval to 1, to make sure you refresh the values frequently enough. I have no idea for how long motion_detected value may be set, if it’s something like 30 seconds (and you use default scan_interval value that’s also 30 seconds), then you might miss the changes.

Also I’m not sure what enabled value actually means - you can also double check that it’s being set to True.

Thanks!

I did set both intervals to 1 but I am still not recieving any change of the sensor values in HA, even though the sensor is detecting the motion(sensor led is blinking).

This is what I see in HA:
grafik
Any other ideas?

Thanks!

The only idea that I have is to temporarily install Home Assistant 0.91 (the last release before my changes) and to try Using OSRAM Lightify Motion Sensor with HA - Triggered by change in RGB . If it works, then probably I broke something :slight_smile: If it doesn’t, then probably it’s not really feasible at the moment: those values are all that the Lightify gateway returns via its API.

Thanks!

Ok, just to double check the current code, could you please create the following sensor and confirm that it doesn’t change as well?

- platform: template
  sensors:
    my_motion:
      value_template: "{{ states.light.<your id>.attributes.sensor_values[4] }}"

Thanks!

Does it work correctly in the official Lightify app? Are you able to create an automation based on its value or something like that?

Thanks!

Yes, the sensor ist working in the Lightify app and I am able to create an automation within the app.
I will later try to create a new sensor as you suggested. But shouldn’t I see a change of the raw sensor values anyway?

Yes, you should. But HA UI doesn’t display history for the attributes, only for the “main” sensor value. If a value “blinks” only for a few seconds, the history will make sure you don’t miss it.

Thanks!

I did create the sensor as suggested, but still no change is visible.
I also tried to create a second image based on 0.91 but the downgrade is failing. Seems like there are some dependency issues. So I could not test it until now.
@stevec is your sensor still working?

I don’t use the Osram anymore as it was too power hungry for my liking with the number of batteries I went through so can’t comment I’m afraid.

Sorry for an off-topic: Has anybody updated the Lightify application with a mandatory Gateway firmware upgrade to version 1.5.1.0? If yes, does HA integration still work as expected? Especially when working with scenes? Lightify firmware changelog says: “increased maximum number of 32 scenes”. To do that they would probably need to change binary offsets in API response.

Thanks!