New Service: lights/flash. For easier visual notifications

Hi guys,

Currently there is no simple way to flash lights in their current state without having to write a script in order for the flash to behave as desired.

The Philips Hue API allows you flash lights with the alert:select and alert:lselect API call but the only way to make that API call currently with HA is by turning a light on. After its finished flashing it stays on. There is no way to flash a light that is off and have it return to the off state without another API call.

I propose a new light/flash service that simply makes use of the alert:select Hue API calls to complement the existing light/on, light/off and light/toggle service.

I realise there ways to control this behaviour by writing a script, but I’m all about keeping it simple. =)

If I knew how to write Python code I’d do it myself and send a pull request but I don’t (yet). :slight_smile:


Definitely a good idea!

This would be so much easier when using lights for notifications and alarms. Also would help make HA a little more ADA friendly!

my intentions exactly @rpitera! :slight_smile:

1 Like

You need to change your focus not only to one device. HA lookup on all device class and make a standard call for all class. You can send turn_on with effect option. HA handle all in a same way and support a lot of components. I don’t think he make a bad api change for only one device class for one component…

@pvizeli fair enough.

Would it be possible then to have different components handle the same call in a way that works best for them?

e.g. the lights/flash service on the Hue component simply calls the native “alert”:“select” function but for a different light component, it checks state, stores it and toggles light a few times and restores previous state?

I disagree with @pvizeli and think that your point is valid. And I think your approach in the last post is certainly reasonable. And I don’t think requesting support for a native function on a platform is a bad API change either.

I found that if enough people ask for something, somebody here figures out a way to accomplish it. Whether that code makes it into HA’s codebase is entirely up to the development team.

Thats true, you can call a device spezific function with a own service like sonos. Its not very dificult to create a service like light.hue_alert. only pyhue need suport that native function befor you can use it on HA for split device, vendor logik from core.

Or make a service like light.hue_effect they want support more things than only flash

So there is a pyhue module that HA uses to control Hue lights, which presumably doesn’t already contain the required code?

I think HASS uses this

from looking at the code I think it does support ‘alert’

def alert(self):
    '''Get or set the alert state of the light [select|lselect|none]'''
    self._alert = self._get('alert')
    return self._alert

def alert(self, value):
    if value is None:
        value = 'none'
    self._alert = value
    self._set('alert', self._alert)

yeah I’ve had a poke around the code too and what’s missing is a specific service in HASS that properly utilises this function. I’m still not at the stage where I can write the service myself and submit a PR. But I’m working on it. (Just don’t hold your breath!)

1 Like

I fixed this. It will be out in 0.28. PR.


Awesome news! :smile:

I just noticed this thread. I am running 28.2. I am new to creating automation. Could you give me a example of how to make the lights flash?

It’s a service data attribute and is explained in the lower half of this page:

Thanks for the help. I can get the lights to flash now. I need to test more but the lights do not seem to flash if they are already on.