Need help creating a specific Button press item

I am trying to write a specific item for a Button press device
(The item will be used as a switch for habpanel)
I tried it and it does not work:

String harmonyhub_device_HarmonyHub_57951327_buttonPress “Button press” mappings = [“SW1Levelup”] {channel = “harmonyhub: device: HarmonyHub: 57951327: buttonPress”}

It seems that there are probably a few different problems here. First, it looks like you’re conflating sitemap elements and item definitions. The “mappings” parameter is not used in item definitions; it is only used when adding a control "element’ to a sitemap in a sitemap file.

However, since you say you want this item to be used in habpanel, you do not need the map anyway as you will configure those options in habPanel if I recall (it’s been a while since I’ve used habPanel).

Second, your channel string is incorrect as it shouldn’t have any spaces between the colons and the following pieces. The channel string must match UID of the thing plus the channel of interest and in this case that should probably be:

harmonyhub:device:HarmonyHub:57951327:buttonPress

But make sure you’ve identified the proper UID in PaperUI or your other method of choice.

Lastly, your string item is not an ideal choice for a simple one function button. I’m guessing from what you have given that you’d like a button that sends the string “SW1Levelup” to the harmony hub. A much simpler approach here will be to set up a dummy item (a switch type item that is not attached to a channel). This will then be easy to add to habPanel as a button. You will then need a simple rule to send a command to your string item with the value that you want to send to the harmony hub whenever the switch item is changed.

First of all thank you,
How do i configure in habPanel to buttonPress

If you follow my last suggestion to create a switch item, then you can add a switch widget to habPanel and select your new switch item to link it to. Then whenever you press that widget in habPanel it will trigger the item changed event for that item. Then, all you need is to write a rule that triggers on that item changed event:

if you want to stay with the string item then you would add a button widget to habPanel and use the configuration option of (I don’t remember exactly what it’s called)…static command or fixed command to send the string value to the item.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.