Convert globalcache manually from OH2 to OH3 using ui only

I have a working OH2 with a globalcache IR module to turn a TV on/off. In my site config I have a switch item

Switch item=BAUHNTV label=“Power” mappings=[BAUHNTV_POWER_TOGGLE=“Power”]
and in the transform folder i have a file globalcache.map with the map.

BAUHNTV_POWER_TOGGLE = 37993,1,1,343,171,22,64,22,21,22,21,22,21,22,21,22,21,22,21,22,21,22,21,22,64,22,21,22,21,22,64,22,64,22,64,22,21,22,21,22,64,22,64,22,64,22,64,22,21,22,21,22,21,22,64,22,21,22,21,22,21,22,21,22,64,22,64,22,64,22,1621,343,85,22,3635,343,85,22,3634,343,85,22,3634,343,85,22,3634,343,85,22,3700

I have a similar setup now in OH3 with the map file specified but am lost as to how/where to setup the switch to use the map.

I’m not certain this works the way you think it works. Or perhaps I’m not understanding your question.

Your "Switch: line is a line out of a sitemap definition. When the “Power” button is pressed “BAUHNTV_POWER_TOGGLE” gets sent to BAUHNTV. So what do you have in OH 2 that transforms that “BAUHNTV_POWER_TOGGLE” to that string of codes? A rule? Does the Thing have a transform?

Applying a transform profile I think only works one direction, from the Channel to the Item. You need to transform it from the Item to the Channel.

It should work the same as you are doing it in OH 2. The only difference is if you are not using sitemaps, the configuration of the widget would be different.

Yes I am confused as to how/where to have the equivalent of the Switch item=BAUHNTV label=“Power” mappings=[BAUHNTV_POWER_TOGGLE=“Power”] in the UI for OH3. That is the only thing required in OH2, I have no rules and the switch just works.

There really is no direct equivalent.

But to get a button that sends a static command when clicked create a Label Card and configure the Item, set the Action to “send a command” and the Action Command to “BAUHNTV_POWER_TOGGLE”.

Thanks will try that when I get home tonight.

Just to clarify, the globalcache binding does the transform internally to the binding. The map file is specified in the globalcache thing configuration. So when you send the command to the item, the binding does the transformation to the string of codes to be sent to the globalcache device.

So, @rlkoshak, what you suggested should do the trick.

Have tried to create a model card but cannot find anywhere so far that has an action item to set which is just me not getting the new UI/ model concept of OH3.

Do i create it in settings under the model

or is it from the home page?

Go to settings -> Pages. Edit the Overview Page and add the card.

As this was my first item there was one more step which was to add mortar and then it all made sense.

Having said that I have now added the label card but when I click on it (not in design mode) I get no events in the logs at all.

These are the globalcache and label card details.


You don’t need a GlobalCache card. You just need a card to send the command to the item.

Here’s how I defined one to toggle the power on my TV.

component: oh-label-cell
config:
  title: Kitchen TV Power
  icon: oh:screen
  label: Toggle Power
  action: command
  actionItem: Kitchen_TV
  actionCommand: SONYTV_POWER_TOGGLE

Are you sure everything is working independent of the UI?

What happens if you run the following from the console (replacing my item name and command with yours)? Does it toggle the power on the TV? If that’s not working, then you need to solve that first.

openhab:send Kitchen_TV SONYTV_POWER_TOGGLE

this is the message from the console.

openhab> openhab:send BauhnTV BAUHNTV_POWER_TOGGLE
Error: Command ‘BAUHNTV_POWER_TOGGLE’ is not valid for item ‘BauhnTV’
Valid command types are:
OnOffType: ON OFF
RefreshType: REFRESH

What’s the type of your item? It needs to be a String.

Thank you very very much. Changed from a switch to string and all working now from console.

1 Like

Here’s how my item is defined.

String                      Kitchen_TV
                            "Kitchen TV []"
                            { channel="globalcache:itachIR:kitchen:ir-m1#c1" }

You can disregard this since you got the item definition sorted.

Hello,
I have nearly the same problem, but I have to use a switch item which I use to control a room temperature. It is a knx device and the OFF command changes the temperature by -0.5° and the ON command by +0.5° in the heating actor.

My item on the Sitemap in oh2:

Switch item=Heizung_KanalD_SolltempSteuerung mappings=[OFF="Ab",ON="Auf"]

How can I adapt the default widget for this item? Actually I use a list item which shows my a selection menu:

value: oh-list-item
config:
icon: oh:heating
action: options
title: Steuerung Solltemperatur
actionOptions: ON=“+”,OFF=“-“
actionItem: Heizung_Speicher_KanalGSolltempSteuerung

I have no idea how I can generate two buttons, one for +(ON) and the other for -(OFF).

Thank you for your help!

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