Profile for an item which is not linked to a channel

(Eyal Cohen) #1

Hi,

Can I use profiles to update an item which is not linked to a channel / thing?

The profile documentation shows that it can be used from channel to channel, but my target item is not linked to any channel.

Thx

1 Like

(Vincent Regaud) #2

I am wondering the same things

0 Likes

(Alex) #3

@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

0 Likes

(Christoph Weitkamp) #4

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

(Eyal Cohen) #5

@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).

0 Likes

(Alex) #6

@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”]

0 Likes

(Christoph Weitkamp) #7

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

(Alex) #8

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

1 Like

(Christoph Weitkamp) #9

I changed it for the Amazon Dash Button.

1 Like

(Alex) #10

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

??

0 Likes

(Christoph Weitkamp) #11

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

1 Like

(Alex) #12

OK, thanks! :slight_smile:

0 Likes

(Alex) #13

@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?

0 Likes

(Christoph Weitkamp) #14

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

0 Likes

(Alex) #15

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

0 Likes

(Christoph Weitkamp) #16

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

1 Like

(Alex) #17

@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:

0 Likes

(Alex) #18

@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

(Christoph Weitkamp) #19

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

0 Likes

(Alex) #20

@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:

0 Likes