Update deCONZ integration to support `flash` with `color`

Currently, hue bridge users can use light.turn_on with flash:long|short and color while this same service call with deCONZ results in the light flashing white regardless of color specified.

I had initially thought it may be a problem with deCONZ itself, but after raising a github feature request there, I was pointed to the actual deCONZ integration.

Looks like it’s sending an {"alert": "select"} or {"alert": "lselect"} , which the Hue bridge translates to the same Trigger Effect command as deCONZ generates for {"alert": "breathe"} . You would need to update the HA deCONZ integration to use the same logic as Hue (incl. the check for innr lights), except send breathe instead of lselect .

1 Like

If breathe is not supported by all I’m not gonna change to that.

Luckily you can do this without any changes to anything, just use the configure service: https://www.home-assistant.io/integrations/deconz/#service-deconzconfigure

If it works for you I suggest you update documentation with an example of what you accomplish, to help others wanting a similar solution

I’ll have to read up on this. Thanks for the suggestion.

Your welcome. We are discussing the status of the API documentation of deconz and lights is the next to be updated so its interesting there where a few more commands I’ve never seen before :slight_smile:

I was just hoping for a sanity check before running the command. Assuming my hue bulb is named light.hue_lamp I would call the following
{ "entity": "light.hue_lamp", "field: "/state", "data": {"alert": breathe} }

I’m wondering if this will work because breathe isn’t listed as an option for alert in the API
https://dresden-elektronik.github.io/deconz-rest-doc/lights/#setstate

Looks good!

If Ebauuw says that’s how its done you can most often trust him on it.

Nice, didnt know this option. Just fired this with success from the developer tools
(deconz.configure)

entity: light.deconz_stue_circle
field: /state
data: 
  alert: breathe

I issued that command with success from dev tools, but the bulb still flashes white when running

  - service: light.turn_on
    data:
      transition: 0
      brightness: 255
      color_name: orangered
      flash: long
    entity_id: light.hue_lamp

I’m going to have to investigate further. @cklit were you able to get the bulb to flash a specific color?

Yes :slight_smile:

entity: light.deconz_stue_circle
field: /state
data: 
  alert: breathe
  hue: 43680
  sat: 255
1 Like

I’ll give that a shot! Thanks

Are you using the light.turn_on service or something else to call that?

Edit: ok, think I’m finally wrapping my head around this. Use deconz.configure service as the action to make the bulb flash.

Thanks for sharing this solution I have been wanting this for a long time. Works great for a single Hue Bulb but have you had any luck in getting more than a single bulb to flash in one service call. I have tried this with both the entity as a home assistant light group and deconz light group but throws an error.

This is what I am using as the service call
Service: deconz.configure

entity: light.alarm_lights
field: /state
data:
  alert: breathe
  hue: 43680
  sat: 255

light.alarm_lights is a deconz light group
And the error in the logs is:



Logger: homeassistant.components.websocket_api.http.connection.139839948294848
Source: components/deconz/services.py:133
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 19 November 2020, 23:48:18 (3 occurrences)
Last logged: 00:02:00
/groups/8/state method, PUT, not available for resource, /groups/8/state

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 135, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1448, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1483, in _execute_service
    await handler.job.target(service_call)
  File "/usr/src/homeassistant/homeassistant/components/deconz/services.py", line 60, in async_call_deconz_service
    await async_configure_service(hass, service_data)
  File "/usr/src/homeassistant/homeassistant/components/deconz/services.py", line 133, in async_configure_service
    await gateway.api.request("put", field, json=data)
  File "/usr/local/lib/python3.8/site-packages/pydeconz/gateway.py", line 106, in request
    _raise_on_error(response)
  File "/usr/local/lib/python3.8/site-packages/pydeconz/gateway.py", line 220, in _raise_on_error
    raise_error(data["error"])
  File "/usr/local/lib/python3.8/site-packages/pydeconz/errors.py", line 58, in raise_error
    raise cls("{} {}".format(error["address"], error["description"]))
pydeconz.errors.RequestError: /groups/8/state method, PUT, not available for resource, /groups/8/state


A couple of caveats with this method. It doesn’t appear you can set the color unless the bulb is on, or you include on: true in the parameters with alert: breathe. If you do include on: true, the bulb stays on after flashing. You can get around this by following up the breathe action with a 15 second delay, and then an on: false action. Another thing is that it won’t return to the original color after flashing.

Replace entity with your group entity and use /action instead of /state

1 Like

You replace that old data with the new sending breathe

Just searching around a bit. Alternatives to breathe, can also be blink, channelchange and okay :slight_smile:

Thanks that worked a treat :slight_smile:

1 Like

Added new values for state.alert (and action.alert ) to issue the corresponding Trigger Effect command “blink”, “breathe”, “okay”, “channelchange”, “finish”, and “stop”. This is available in 2.04.76.
Github

I wonder what the difference is between blink and breathe

Don’t forget to add a couple of examples to Deconz integration documentation

Should the examples be in yaml or JSON format?