Turn off Hue Bulbs by Amazon Dash Button

Hi,
i’ve created a similar Topic a few month ago which led to no satisfying end. So i’ve build up my openhab environment new from scratch unter Openhab 2.2- so i hope it is allowed to start this new topic.

First of all: the Philip Hue Bulbs (multi-color, controlled by a 1. Generation Hue Bridge) can turned on by my Dash Button via openhab - the problem ist to turn them off by a second “press”.

Here is my (not working) rule and the protocoll:

rule "Dash button pressed"
when
    Channel "amazondashbutton:dashbutton:fc-xx-xx-xx-xx-xx:press" triggered
then
    if (hue_0210_xxxxxxxxxxxx_4_color.getStateAs(OnOffType) == "ON") {
        hue_0210_xxxxxxxxxxxx_4_color.sendCommand(OFF)
        } else {
        hue_xxxxxxxxxxxx_4_color.sendCommand(ON)
        } end

what happens so far:

A. if Hue Bulb is OFF and the Dash Button is pressed:
–> Light turn on
–> Protocol:

2017-12-22 00:43:23.131 [vent.ChannelTriggeredEvent] - amazondashbutton:dashbuttonfc-xx-xx-xx-xx-xx:press triggered
2017-12-22 00:43:25.211 [ome.event.ItemCommandEvent] - Item 'hue_0210_xxxxxxxxxxxx_4_color' received command ON
2017-12-22 00:43:25.347 [vent.ItemStateChangedEvent] - hue_0210_xxxxxxxxxxxx_4_color changed from 46,55,0 to 46,55,100
2017-12-22 00:43:32.595 [vent.ItemStateChangedEvent] - hue_0210_xxxxxxxxxxxx_4_color changed from 46,55,100 to 46,55,18

B. if Hue Bulb is ON and the Dash Button is pressed:
–> Light unfortunately still is “ON”
–> Protocoll

2017-12-22 00:45:10.780 [vent.ChannelTriggeredEvent] - amazondashbutton:dashbutton:fc-xx-xx-xx-xx-xx:press triggered 
2017-12-22 00:45:10.894 [ome.event.ItemCommandEvent] - Item 'hue_0210_xxxxxxxxxxxx_4_color' received command ON
2017-12-22 00:45:11.020 [vent.ItemStateChangedEvent] - hue_0210_xxxxxxxxxxxx_4_color changed from 46,55,18 to 46,55,100

Where ist the bug in my code?

thanks in advance
Tom

  • Platform information:
    • Hardware: Raspberry1_
    • OS: Openhabian 1.4
    • openHAB version: 2.2

I would try:

rule "Dash button pressed"
when
    Channel "amazondashbutton:dashbutton:fc-xx-xx-xx-xx-xx:press" triggered
then
    if (hue_0210_xxxxxxxxxxxx_4_color.state==ON) {
        hue_0210_xxxxxxxxxxxx_4_color.sendCommand(OFF)
        } else {
        hue_0210_xxxxxxxxxxxx_4_color.sendCommand(ON)
        }
end

Hi,
Thanks for the Code. It still won’t work but i’ve noticed something strange:

If I press the Dash-Button, i can see in the controll Area of the Paper - UI that the brightness jumped to “zero”…but the bulb is still “on” …?

… and in the log Viewer this Situation is not even noticed…strange…

Here the log:

2017-12-25 12:35:12.662 [vent.ChannelTriggeredEvent] -amazondashbutton:dashbutton:fc-a6-67-16-ed-1c:press triggered 
2017-12-25 12:35:12.817 [ome.event.ItemCommandEvent] - Item 'hue_0210_001788195c39_4_color' received command ON

Any suggestion to get more info from the log or to complain the “control”-Situtation?

Thanks in advantage.

Tom

@vooodooo1974

Could you please post your .items here?

Be sure your item is type: Switch

But you also can change to DEBUG level first:

log:set DEBUG org.eclipse.smarthome.binding.hue

To switch back to DEFAULT (=unset) log-level:

log:set DEFAULT org.eclipse.smarthome.binding.hue

Hi,
thanks for your effort. I’m afraid that there ist no .ITEMS, because i’ve the ITEM LINKING on “simple mode” (in PaperUI --> Configuaration --> System.

My current thought is, that the problem ist within the “OFF”-Command on the coloured hue-Bulbs. Maybe it is possible to set only the brightness on “zero”?

a query about to change the DEBUG level - where do i have to make this change? “log” ist sure no command; and i don’t think i can put in in the rule …?

thanks in advantage
Tom

@vooodooo1974

Ok. No items file.

Then please goto PaperUI --> Configuration --> Things --> Your Hue Color Bulb –> Configure --> goto the color channel --> then click on the link button (on the right side) Then you should see at least your linked items.

You need min. 3 linked items (Switch/Toggle, Dimmer, Color) !! (In my example above “Licht Esszimmer1 An/Aus (Innr_Light1_Toggle)” is configured as type: Switch

Pease identify your item which is configured as switch! If you do not have anyone, please ADD it there. Then you have to use this item in your rule.

For above shown example it looks like:

rule "Dash button pressed"
when
    Channel "amazondashbutton:dashbutton:fc-xx-xx-xx-xx-xx:press" triggered
then
    if (Innr_Light1_Toggle.state==ON) {
        Innr_Light1_Toggle.sendCommand(OFF)
        } else {
        Innr_Light1_Toggle.sendCommand(ON)
        }
end
1 Like

Yeeeaaaahh yipie yeah … IT WORKED!

Thanks alot!

There were two problems:

  • there was no ITEM “SWITCH” - I applied it now manually (after turning off the “simple mode” in the ITEM LINKING)
  • there was a bug in mein rule:
    => wrong: Innr_Light1_Toggle.state== “ON”
    => right: Innr_Light1_Toggle.state==ON

@Celaeno1 - Vielen Dank aus Stuttgart für die Hilfe und Mühe

Tom

1 Like

@vooodooo1974

You are welcome! (Schöne Grüße aus Franken!)

Alex

P.S: It’s also allowed to give a like image :wink: