[SOLVED] State with Transform map and String items

Hi

I have a defined item which is a String. To this string I send commands to switch on/off the aircon and these are Infrared codes with an RM Broadlink device.

My question is within the transform map with these codes, is each line unique? The reason I ask is many codes are defined to turn devices on and off, but Ive prefixed the code with the device name/function assuming I cant just use ON=RAW CODE

I would have many ON codes for various devices. What this means is that the item state shows AirconOn instead of ON

My intention is to actually use the state of the item in a check, whilst I know state cant be checked like a light its enough for me to tell me if the device is on or off or at least if the last command was ON/OFF

Here is what I see for my item :slight_smile:

item:

String Aircon "Aircon" { channel="broadlink:rm3:78-0f-77-5a-cb-fa:command" }


smarthome:status Aircon
AirconOn
openhab>

Transform:


/* LG Aircon Controls*/
AirconOn=260040000001178b133513111311131113351311131113111311131113111311131113111311131113111311133513351311131113351311131113351311133414000d050000000000000000
AirconOff=260040000001178b133513111311131113331511131113111335133513111311131113111311131113111311131113111311133513111335131113111311133513000d050000000000000000

Would this be valid?

/* LG Aircon Controls*/
AirconOn=ON
AirconOff=OFF
AirconOn=260040000001178b133513111311131113351311131113111311131113111311131113111311131113111311133513351311131113351311131113351311133414000d050000000000000000
AirconOff=260040000001178b133513111311131113331511131113111335133513111311131113111311131113111311131113111311133513111335131113111311133513000d050000000000000000

How can I display this as just ON or OFF, without the AirconOn/AirconOff knowing I have many devices that use ON/OFF

Thanks!

I think I’ve worked it out… Is this correct?

I define the item with another Transform map (en.map) for human readable names. Despite the item using the broadlink.map file for the actual raw commands? This would change the state from AirconOn to ON in the Console

No

The key word here is display

You need another transformation file with only:
aircononoff.map

AirconOn=ON
AirconOff=OFF

And your item:

String Aircon "Aircon [MAP(aircononoff.map):%s]" { channel="broadlink:rm3:78-0f-77-5a-cb-fa:command" }

1 Like

Thanks Vincent, that is exactly what i did. Define en.map in the string item, problem solved :slight_smile:

Coolio, tick the solution, thanks