ConBee ZigBee Stick and HA, will this work together?

Set deconz to debug please

I had node red open watching the websocket from deconz, I think it is this triggering it:

{
	"config": {
		"alert": "none",
		"battery": 60,
		"group": "25693",
		"on": true,
		"reachable": true
	},
	"e": "changed",
	"id": "1",
	"r": "sensors",
	"t": "event"
}

This arrived in nodered just before the logging in deconz component which adjusted the light on/off:

Nov 20 15:15:01 siengine hass[14670]: #033[32m2017-11-20 15:15:01 INFO (MainThread) [homeassistant.core] Bus:Handling <Event deconz_event[R]: event=1002, id=remote_control_1>#033[0m
Nov 20 15:15:01 siengine hass[14670]: #033[32m2017-11-20 15:15:01 INFO (MainThread) [homeassistant.components.automation] Executing Toggle lamp from dimmer#033[0m
Nov 20 15:15:01 siengine hass[14670]: #033[32m2017-11-20 15:15:01 INFO (MainThread) [homeassistant.core] Bus:Handling <Event logbook_entry[L]: message=has been triggered, entity_id=automation.toggle_lamp_from_dimmer, domain=automation, name=Toggle lamp from dimmer>#033[0m
Nov 20 15:15:01 siengine hass[14670]: #033[32m2017-11-20 15:15:01 INFO (MainThread) [homeassistant.helpers.script] Script Toggle lamp from dimmer: Running script#033[0m
Nov 20 15:15:01 siengine hass[14670]: #033[32m2017-11-20 15:15:01 INFO (MainThread) [homeassistant.helpers.script] Script Toggle lamp from dimmer: Executing step call service#033[0m
Nov 20 15:15:01 siengine hass[14670]: #033[32m2017-11-20 15:15:01 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: service=toggle, service_call_id=140181526114824-22, domain=light, service_data=entity_id=['light.lamp_2']>#033[0m
Nov 20 15:15:01 siengine hass[14670]: #033[32m2017-11-20 15:15:01 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_executed[L]: service_call_id=140181526114824-22>#033[0m

As I suspected. The it is just to decide whether config should trigger on updated values. For switches it is a no Brainerd but for sensors… Needs some thought

Got a new fix out, please verify that it works and that nothing is broken (probably not)

Nothing broken and no more ghost events, well… no more lights going on and off :slight_smile: looks great, thanks. Mannup on git said the new beta release with wall switch should be available in the next few days, will report back on that as soon as i get hold of it.

1 Like

I’m planning on removing WIP tag tonight then. Got one small extra install path to take…

Just wanted to advise that I will be contributing to testing as soon as I get my Conbee hardware in the mail. This looks great. I’ve already been doing some work on developing a Docker image for the deconz rest API to make it easy for people to get up and running with your component. In my ideal world I will develop a HASS.io add on for deconz to make it even easier, but I think there are going to be some challenges with that given the way HASS.io addons are currently developed. Nevertheless I want to see if I can work with manup to get the issues sorted out.

1 Like

Would be nice if it was possible to manage OTA updates through it as well (Y)

Managed to sort out the hold down dimmer buttons but on rare occasions it looks like deconz doesn’t get the event for release, so it keeps looping even though the button has been released physically. I think this may be deconz/rest api though, not necessarily an issue with the component. I leave this horrible extract here for anyone else, just in case.

automations.yaml:

- alias: 'Constantly increase brightness of lamp from dimmer until released'
  initial_state: 'on'
  trigger:
    platform: event
    event_type: deconz_event
    event_data:
      id: remote_control_1
      event: 2001
  action:
    service: script.turn_on
    entity_id: script.increase_lamp

- alias: 'Stop increasing brightness of lamp when dimmer is released'
  initial_state: 'on'
  trigger:
    platform: event
    event_type: deconz_event
    event_data:
      id: remote_control_1
      event: 2003
  action:
    - service: script.turn_off
      entity_id: script.increase_lamp
    - service: script.turn_off
      entity_id: script.increase_lamp_loop
- alias: 'Constantly increase brightness of lamp from dimmer until released'
  initial_state: 'on'
  trigger:
    platform: event
    event_type: deconz_event
    event_data:
      id: remote_control_1
      event: 2001
  action:
    service: script.turn_on
    entity_id: script.increase_lamp

- alias: 'Stop increasing brightness of lamp when dimmer is released'
  initial_state: 'on'
  trigger:
    platform: event
    event_type: deconz_event
    event_data:
      id: remote_control_1
      event: 2003
  action:
    - service: script.turn_off
      entity_id: script.increase_lamp
    - service: script.turn_off
      entity_id: script.increase_lamp_loop

scripts.yaml:

increase_lamp_loop:
  alias: Start looping brightness increase
  sequence:
    - delay:
        milliseconds: 650
    - alias: Call increase brightness script
      service: script.turn_on
      data:
        entity_id: script.increase_lamp

decrease_lamp_loop:
  alias: Start looping brightness increase
  sequence:
    - delay:
        milliseconds: 650
    - alias: Call decrease brightness script
      service: script.turn_on
      data:
        entity_id: script.decrease_lamp

increase_lamp:
  alias: Increase Lamp
  sequence:
    - alias: Increase Lamp Brightness
      service: light.turn_on
      data_template:
        entity_id: light.lamp_2
        brightness: >
          {% set bri = states.light.lamp_2.attributes.brightness | int %}
          {{ [bri+30, 249] | min }}
    - alias: Call loop script
      service: script.turn_on
      data:
        entity_id: script.increase_lamp_loop
decrease_lamp:
  alias: Decrease Lamp
  sequence:
    - alias: Decrease Lamp Brightness
      service: light.turn_on
      data_template:
        entity_id: light.lamp_2
        brightness: >
          {% set bri = states.light.lamp_2.attributes.brightness | int %}
          {{ [bri-30, 0] | max }}
    - alias: Call loop script
      service: script.turn_on
      data:
        entity_id: script.decrease_lamp_loop

Probably not the nicest way of doing it and i’m sure you can make it cleaner with templating, i’m just not too hot on that :slight_smile:

Yeah, it shouldn’t be the component. In this case at least :slight_smile:

You can look at doing automations in the python support in HASS or by using Appdaemon if you want to. Way better than yaml automations if you want to do anything more than turning on or off a light

I’ve just removed the WIP status from the PR for both documentation and component. Let’s hope there aren’t too many additional comments. Thanks for the support so far! :tada:

@donnib

Based on a comment in the PR about certain motion detectors only sending an event when detecting movement. This will not work well with the current implementation.

Im considering managing that manually for the ZHAPresence class by keeping a timer of 5 or 10 seconds from presence=True and when timer has ended automatically set presence=false unless timer is restarted due to additional movement. What do you think about this?

Never mind… Manup solved it upstream in deCONZ instead :+1:

Hi,
too bad that the PR was not merged in time. I had an improvised solution running based on a different component (that could not handle temperature sensors though) and hoped to be able to play with the new shiny component over the holidays.

So, I looked into somehow merging the component myself. Since I’m running HA in a docker container I could not replace the files manually. So I came up with a custom Dockerfile that is based on the official one and just adds files and prerequisites to it. Works fine so far. In case anyone is interested, the dockerfile looks like this:

FROM homeassistant/raspberrypi2-homeassistant:latest
RUN pip3 install pydeconz==21
COPY ./components /usr/lib/python3.6/site-packages/homeassistant/components

All source files related to the component (taken from PR) need to be in a subdirectory “components” of the directory where the Dockerfile is. The complete file list is:

./Dockerfile
./components/scene/deconz.py
./components/sensor/deconz.py
./components/deconz/services.yaml
./components/deconz/__init__.py
./components/light/deconz.py
./components/light/hue.py
./components/binary_sensor/deconz.py
./components/discovery.py

Now events, temperatures, motion is detected perfectly and available in HA.
Thanks for your work!

Happy holidays
Jochen

1 Like

One more thing: I noticed a typo in the documentation PR:

In one section it says:

 +- **host** (*Optional*): The IP address to your deCONZ server.
 +- **api-key** (*Optional*): The API key to your deCONZ server.
 +- **port** (*Optional*): Configure port deCONZ web server is accessible from. Default is 80.

But in the example, the api-key becomes api_key. Only the latter one works though.

 +# Example configuration.yaml entry
 +deconz:
 +  host: 127.0.0.1
 +  api_key: 0123456789
 +  port: 80
1 Like

Thanks! Good catch! Will fix that

Nice! I might do a docker image like that myself so I can start migrating my lights from hue to deconz.

BTW do abybody have docker for Deconz Server?

We’re working on it, but there isn’t an image that works correctly yet. If you google there are a few options that “work” but at the expense of being able to do firmware updates etc.

Hey,

I think I found another bug (or at least inconsistency) related to entity names.

I have several Aqara temperature sensors resulting in 3 entities in HA:
image

Today, I added a Xioami Mi Smart Temperature sensor that delivers temperature and humidity.

However, the entities are not named like above but merely numbered:

image

Jochen

This is a pure deCONZ behaviour. Best solution would be if deCONZ could solve this when

There have been some discussion about me adding type of sensor to the end of the name.

If you would, could you please see if you can rename your sensors to add the suffix.

Modify this to match your device and device type.
{ “field”: “/lights/1”, “data”: {“name”: “light2”} }

For more details check the documentation here: https://raw.githubusercontent.com/Kane610/home-assistant.github.io/a49c08adb98d5333c09b84d95312116b9dab3f22/source/_components/deconz.markdown