deconz icon indicating copy to clipboard operation
deconz copied to clipboard

Feature Request: Expose CLIPGenericFlag sensors/switches to Home Assistant

Open snozzlebert opened this issue 7 years ago • 21 comments

Possible implementations:

  • Expose the flag as a binary_sensor or
  • Expose them as a switch: Map flag true to state 'on' and flag false to state 'off' turn_on service to PUT /sensors/#/state {"flag": true} turn_off service to PUT /sensors/#/state {"flag": false}

I would prefer the second one.

snozzlebert avatar Jun 28 '18 18:06 snozzlebert

What is the use case for this? From the look of it this will be a binary sensor. Could you post the json data for a generic flag?

Kane610 avatar Jun 30 '18 07:06 Kane610

My use case is similar the the one described in this comment: https://github.com/dresden-elektronik/deconz-rest-plugin/issues/98#issuecomment-326562879 I'm using the rule engine of deCONZ and the CLIPGenericFlag is acting as a room's master switch. I would like to see the state of this "master switch" (the flag) in Home Assistant.

Binary sensor would be ok for me. What kind of JSON data do you need? My flag sensor:

{
        "config": {
            "on": true,
            "reachable": true
        },
        "modelid": "Switch",
        "name": "Kitchen Switch",
        "state": {
            "flag": true,
            "lastupdated": "2018-07-01T10:40:35"
        },
        "swversion": "1.0.0",
        "type": "CLIPGenericFlag",
        "uniqueid": "kitchen-switch"
    }

snozzlebert avatar Jul 01 '18 10:07 snozzlebert

Seems about right for the flag to be the main state. The Json data you gave me is good enough 👍

Kane610 avatar Jul 01 '18 10:07 Kane610

Solved in v40.

PR is submitted to HASS, you can expect it to show up with release 0.74

Kane610 avatar Jul 01 '18 12:07 Kane610

Thanks! One remark: In the code is see:

GENERICFLAG = ['CLIPGenericFLAG']

shouldn't that be:

GENERICFLAG = ['CLIPGenericFlag']

if matching is case sensitive? My JSON shows "type": "CLIPGenericFlag",

snozzlebert avatar Jul 02 '18 09:07 snozzlebert

You're right. Good catch!

Kane610 avatar Jul 02 '18 09:07 Kane610

Updated PR

Kane610 avatar Jul 02 '18 09:07 Kane610

I'm sorry to bother you again. I think I've found an issue in the GenericFlag class. The is_tripped function is missing. When I use the new code in Home Assistant I get:

  File "homeassistant\components\binary_sensor\deconz.py", line 71, in is_on
    return self._sensor.is_tripped
AttributeError: 'GenericFlag' object has no attribute 'is_tripped'

snozzlebert avatar Jul 02 '18 17:07 snozzlebert

Thanks for verifying, will fix immediately

Kane610 avatar Jul 02 '18 17:07 Kane610

PR is updated

Kane610 avatar Jul 02 '18 17:07 Kane610

Would it be possible to expose the CLIPGenericFlag as a switch to home assistant so we can toggle the flag easily in Home Assistant on and off?

Krocko avatar Dec 21 '19 18:12 Krocko

@Krocko can you create a new issue with examples on how it is set, and why it is useful

Kane610 avatar Dec 21 '19 18:12 Kane610

https://github.com/ebaauw/homebridge-hue/wiki/Getting-Started#24-clip-sensors

Kane610 avatar Apr 15 '20 18:04 Kane610

Hi @Kane610. Any news?

Krocko avatar May 11 '20 19:05 Krocko

I'm nearly done working on the UniFi integration, but I will put my time on the Axis integration prior to revisiting deconz

Kane610 avatar May 12 '20 05:05 Kane610

Ok. Thank you for the info.

Krocko avatar May 12 '20 07:05 Krocko

Hello @Kane610 any update on this?

Krocko avatar Jan 28 '21 14:01 Krocko

No news, haven't investigated this at all

Kane610 avatar Jan 28 '21 16:01 Kane610

Hi @Kane610. Do you have any news?

Krocko avatar Mar 06 '22 13:03 Krocko

Still waiting on examples

[Kane610](https://github.com/Kane610) commented [on 21 Dec 2019](https://github.com/Kane610/deconz/issues/14#issuecomment-568201742)
@Krocko can you create a new issue with examples on how it is set, and why it is useful

Kane610 avatar Mar 07 '22 15:03 Kane610

Hello @Kane610 Do you need more info?

Krocko avatar Aug 03 '22 18:08 Krocko