Globlal cache help

hey guys
ive been stuck on this for a few days now.

trying to use globlal cache ip2ir with globlalcache binding.

i have added the binding.
made sure ip is correct and map file is ip2ir.maps in the
transform folder.
in the binding page it has items file and sitemap file so i added them as well.

2 lines from maps file (all lines are similar)

SONYL_POWER_OFF - 40000,1,1,96,24,48,24,48,24,48,24,48,24,24,24,48,24,24,24,48,24,24,24,24,24,24,24,24,990
SONYL_POWER_ON - 40000,1,1,96,24,24,24,48,24,48,24,48,24,24,24,48,24,24,24,48,24,24,24,24,24,24,24,24,1013

items file

String SONYL “Sony tv in living room” { channel=“globalcache:itachIR:ec1232ce:ir-m1#c1” }

the ec1232ce part is from paperui. but all the docs that i have found have what looks like the mac address “000C1EE0FE90”.

sitemap file

Frame label=“Sony tv Living” {
Switch item=SONYL label=“Power” mappings=[SONYL_POWER_ON=“On”,SONYL_POWER_OFF"Off"]
}

i dont get a switch or a drop down to chose option to send. i have to type in the command to send.
when i send On i get this error in the log

2017-12-29 10:21:15.275 [ome.event.ItemCommandEvent] - Item ‘SONYL’ received command On
2017-12-29 10:21:15.357 [vent.ItemStateChangedEvent] - SONYL changed from NULL to On
==> /var/log/openhab2/openhab.log <==
2017-12-29 10:21:15.396 [WARN ] [rm.AbstractFileTransformationService] - Could not transform ‘On’ with the file ‘ip2ir.map’ : Target value not found in map for 'On’
2017-12-29 10:21:15.402 [WARN ] [obalcache.handler.GlobalCacheHandler] - No entry for On in map file ‘ip2ir.map’ for thing itachIR:ec1232ce

when i type in the maps commend
"SONYL_POWER_ON"
i get this error

2017-12-29 10:22:03.812 [ome.event.ItemCommandEvent] - Item ‘SONYL’ received command SONYL_POWER_ON
==> /var/log/openhab2/openhab.log <==
2017-12-29 10:22:03.831 [ERROR] [cache.internal.command.CommandSendir] - Execute ‘sendir’ failed on thing ec1232ce at 192.168.0.16: errorCode=005, errorMessage=Invalid frequency value
==> /var/log/openhab2/events.log <==
2017-12-29 10:22:03.834 [vent.ItemStateChangedEvent] - SONYL changed from On to SONYL_POWER_ON

any idea where i am going wrong and what i can do to fix?

I don’t know your Rules and Things-configuration.
So first stepp is to replace hyphens in map-file with equal signs.

This is the globalcache device complaining about the frequency value in the IR string, most likely a result of the missing equals signs in the map file.

hey @hr3 @mhilbush,
thanks for the quick reply!! cant believe i over looked - as =
i have fixed it in the maps file and sent the SONYL_POWER_ON and no errors! yay. and better yet its turning the tv on and off!!
now how to make it a switch like it says it should be in the sitemap

so im stuck on getting this to be a switch. i have tried changing in the items file string to switch. it works showing a switch in the ui but i get errors when switching

2018-01-02 22:37:59.609 [ome.event.ItemCommandEvent] - Item ‘SONYL’ received command OFF

==> /var/log/openhab2/openhab.log <==

2018-01-02 22:37:59.631 [WARN ] [rm.AbstractFileTransformationService] - Could not transform ‘OFF’ with the file ‘ip2ir.map’ : Target value not found in map for ‘OFF’

2018-01-02 22:37:59.636 [WARN ] [obalcache.handler.GlobalCacheHandler] - No entry for OFF in map file ‘ip2ir.map’ for thing itachIR:977054d7

==> /var/log/openhab2/events.log <==

2018-01-02 22:37:59.633 [vent.ItemStateChangedEvent] - SONYL changed from NULL to OFF

i know its looking for OFF in the map file. how can i change it to look for SONYL_POWER_OFF instead?
i tried adding a rule but it keeps looking for OFF in the maps file

Can you post what you have in your items and sitemap files? This error looks like you might be missing the mappings directive in the sitemap, but I can’t be sure unless I see what you have.

Edit: Sitemap entry should look something like this.

    Switch item=SAMSUNGHLS label="Power" mappings=[SAMSUNGHLS_POWER_ON="On",SAMSUNGHLS_POWER_OFF="Off"]

thanks for the quick reply!!
i have this for the rule

rule "Sony TV Living room"
when
Item Power received command
then
if(receivedCommand == ON) {
sendCommand(SONYL, “SONYL_POWER_ON”)
}
else {
sendCommand(SONYL, “SONYL_POWER_OFF”)
}
end

and had for sitemaps

Frame label=“Sony tv Living” {
Switch item=SONYL label=“Power” mappings=[SONYL_POWER_ON=“On”,SONYL_POWER_OFF"Off"]
}

changed it to

Switch item=SONYL label=“Power” mappings=[SONYL_POWER_ON=“On”,SONYL_POWER_OFF"Off"]

but still getting the same problem

I see you’re missing an equals sign.

Switch item=SONYL label=“Power” mappings=[SONYL_POWER_ON=“On”,SONYL_POWER_OFF="Off"]

sorry its there. missed it when i copyed it to here
but it was missing from my old sitemaps

Ok, then that all looks right. Is the item defined as a Switch or a String? It should be a String.

Edit: Just to be clear, it should be declared as a String in the items file, and as a Switch (with mappings) in the sitemap.

item. i had changed to Switch when playing around. it was the only way i got a switch in the ui.
have changed it back to String and now the switch is gone from the ui
item file

String SONYL “Sony tv in living room” { channel=“globalcache:itachIR:977054d7:ir-m1#c1”}

sitemap file

Switch item=SONYL label=“Power” mappings=[SONYL_POWER_ON=“On”,SONYL_POWER_OFF=“Off”]

rule file

rule “Sony TV Living room”
when
Item Power received command
then
if(receivedCommand == ON) {
sendCommand(SONYL, “SONYL_POWER_ON”)
}
else {
sendCommand(SONYL, “SONYL_POWER_OFF”)
}
end

map file

SONYL_POWER_OFF = 40000,1,1,96,24,48,24,48,24,48,24,48,24,24,24,48,24,24,24,48,24,24,24,24,24,24,24,24,990
SONYL_POWER_ON = 40000,2,1,96,24,24,24,48,24,48,24,48,24,24,24,48,24,24,24,48,24,24,24,24,24,24,24,24,1013

Untitled

So, if you have this, I don’t see any reason why it doesn’t work. Did you try restarting OH?

Item

String SONYL “Sony tv in living room” { channel=“globalcache:itachIR:977054d7:ir-m1#c1”}

Sitemap

Switch item=SONYL label=“Power” mappings=[SONYL_POWER_ON=“On”,SONYL_POWER_OFF="Off"]

Map file

SONYL_POWER_OFF = 40000,1,1,96,24,48,24,48,24,48,24,48,24,24,24,48,24,24,24,48,24,24,24,24,24,24,24,24,990
SONYL_POWER_ON = 40000,1,1,96,24,24,24,48,24,48,24,48,24,24,24,48,24,24,24,48,24,24,24,24,24,24,24,24,1013

have tried rebooting the raspberry pi with no luck with the switch.

The image you posted above looks like Paper UI. What do you see in the Basic UI? It should look something like this.
Capture

thanks Mark,
i am new to openhab so i hadn’t used the basic ui before. took me a bit to work it out but its working now :slight_smile: was only using paper ui.

1 Like