Profile for an item which is not linked to a channel

I am wondering the same things

@vzorglub

Me, too.

I tried out a profile with “Amazon Dash Button”. But the trigger only triggers, but without any state e.g. PRESSED. How to achive this? Here is my rule a want to replace:

rule "Dash button Sagrotan pressed"
when
    Channel 'amazondashbutton:dashbutton:50-f5-da-XX-XX-XX:press' triggered
then
    if(Hue_Light3_Toggle.state==OFF) {
		sendCommand(Hue_Light3_Toggle, ON)
	} else {
		sendCommand(Hue_Light3_Toggle, OFF)
	} 
end

.
.
But to use profile [profile=“rawbutton-toggle-switch”] I need a trigger = PRESSED !!

How can I transform “triggered” = empty to = PRESSED ? (see above rule)

see also example from documentation:

when
    Channel "serialbutton:button:mybutton:button" triggered PRESSED
then
    if (Light_Bedroom.getStateAs(OnOffType) != ON)
        Light_Bedroom.sendCommand(ON)
    else
        Light_Bedroom.sendCommand(OFF)
end

here the event in logfile:

12:24:04.912 [INFO ] [smarthome.event.ChannelTriggeredEvent] - amazondashbutton:dashbutton:50-f5-da-xx-xx-xx:press triggered

.
the event triggered an “empty” event.

I tried transformation map, but this is not running. I could not transform “empty” to PRESSED

Currently it is not possible to define a profile for an item without being linked to a channel. By their nature, profiles are correlated to links between items and channels.

That it not possible. We have to change the channel type of the press channel in the code and adopt the implementation accordingly. I will put it onto my TO-DO list.

2 Likes

@cweitkamp

Any plan to have it? In my case, the majority of the profiles I need are setting items from devices (as I am using a lot of “proxy” items).

@cweitkamp

Then for me profile is useless at the moment. Neither dashbutton nor hue dimmer switch support the event “PRESSED”.

Better you can attach events as parameter to a profile?

e.g [profile=“rawbutton-toggle-switch”, trigger=“abcd”]

No, I am not aware of such plans. Please open a feature request in https://github.com/eclipse/smarthome/issues or - even better - work on it on your own :wink:.

I second that. I figured several use-cases in my own environment for such a feature too.

Absolutely. Especially for the Hue Switches (see Hue Binding - Dimmer Switch).

2 Likes

Ahh, OK, now I understand what you mentioned in the other topic. :+1:

1 Like

I changed it for the Amazon Dash Button.

1 Like

Thanks a lot.

In case of non useing the profile (e.g. some of my rules are too complex!) , do I have to change such complex rules from:

Channel "amazondashbutton:dashbutton:fc-a6-67-0c-aa-c7:press" triggered

to

Channel "amazondashbutton:dashbutton:fc-a6-67-0c-aa-c7:press" triggered PRESSED

??

No, a rule like in your example - without “PRESSED” - will work in the same way.

1 Like

OK, thanks! :slight_smile:

@cweitkamp

I’ve installed 2.5.0.201901020757 AmazonDashButton Binding.

Nothing happens when I press a Dash Button.

here is my .item

Switch Hue_Light3_Toggle		"Licht Bibliothek An/Aus"	<light>	(GF_Biblio, Lights)	[ "Lighting" ]	{channel="hue:0100:0017xxxxxxxxxx:8:brightness", channel="amazondashbutton:dashbutton:50-f5-da-xx-xx-xx:press" [profile="rawbutton-toggle-switch"] }

.
.

In PaperUI there is also no profile to select in pull-down-menu:

image

Could be that it was merged after 7:57 h on 02. January 2019?

Yes, I am pretty sure it was later. After lunch.

Ok. Thanks. I’ll wait for next build. #1487

Build is running at the moment


https://ci.openhab.org/job/PR-openHAB2-Addons/11843/

It is change No. 41

Haha, :smiley: 
 then you will have the chance to test it again tonight 


1 Like

@cweitkamp

Ok, I’m on #1487 :slight_smile: (=2.5.0.201901040921 │ AmazonDashButton Binding)

I could test the profile now: (item see here)

19:10:26.405 [INFO ] [smarthome.event.ChannelTriggeredEvent] - amazondashbutton: dashbutton:50-f5-da-xx-xx-xx:press triggered PRESSED
19:10:26.409 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'Hue_Light3_ Toggle' received command ON

.
.

First impression: it is running well. :+1:

@cweitkamp

Btw, all my Dashbuttons now trigger the following event:
.

19:10:26.405 [INFO ] [smarthome.event.ChannelTriggeredEvent] - amazondashbutton: dashbutton:xx-xx-xx-xx-xx-xx:press triggered PRESSED

.

Both rules are running (new and old):

rule "My Dash Button pressed"
when
Channel "amazondashbutton:dashbutton:fc-a6-67-0c-aa-c7:press" triggered PRESSED


rule "My Dash Button pressed"
when
Channel "amazondashbutton:dashbutton:fc-a6-67-0c-aa-c7:press" triggered

.
.
OK. This will reduce my lines in the .rules file! Thanks a lot! :slight_smile:

1 Like

Great. Nice to hear :+1:. To reduce code and effort for the user is the idea behind profiles.

@cweitkamp

.
.

Btw, since I use profile I always get a WARNING at OH startup:
.

2019-01-20 17:17:56.167 [WARN ] [ore.common.registry.AbstractRegistry] - Cannot add "Metadata" with key "channel:Hue_Light2_Toggle". It exists already from provider "GenericMetadataProvider"! Failed to add a second with the same UID from provider "GenericMetadataProvider"!
2019-01-20 17:17:56.167 [WARN ] [ore.common.registry.AbstractRegistry] - Cannot add "Metadata" with key "channel:Hue_Light3_Toggle". It exists already from provider "GenericMetadataProvider"! Failed to add a second with the same UID from provider "GenericMetadataProvider"!

.
.
here are my .items:

Switch Hue_Light2_Toggle		"Licht Windfang An/Aus"	    <light>	(GF_Corridor, Lights)	[ "Lighting" ]	{channel="hue:0100:0017xxxxxxxxx:2:brightness", channel="amazondashbutton:dashbutton:18-74-2e-xx-xx-xx:press" [profile="rawbutton-toggle-switch"] }	
Switch Hue_Light3_Toggle		"Licht Bibliothek An/Aus"	<light>	(GF_Biblio, Lights)	    [ "Lighting" ]	{channel="hue:0100:0017xxxxxxxxx:8:brightness", channel="amazondashbutton:dashbutton:50-f5-da-xx-xx-xx:press" [profile="rawbutton-toggle-switch"] }	

.
.
It seems to appear ONLY with Hue items:

See also here:

Hi Alex,

It is already known and definitely not related to the Hue binding. I seeing it in my environment for any item using a profile and others too.