How to invert values for Chromecast binding idle state

Tags: #<Tag:0x00007f5c98caccf8> #<Tag:0x00007f5c98cacc08> #<Tag:0x00007f5c98cacaf0>

I need to invert the value of my Chromecast idle state, so that I can add it to a group together with my PCs state from the network binding and they behave in the same way:
ON - when the device is active
OFF - when the device is in active

I know could use the proxy switch, but I thought I would try the mapping service, which unfortunately I cannot get to work. This is what I have:

I installed the mapping service in addons.cfg and saw in the logs, that it was installed:

transformation = map

In chromecast.items:

Switch Chromecast_Livingroom_Idle        "Chromecast Livingroom Idle"                     <network> (gAssistent) { channel="chromecast:chromecast:livingroom:idling" }
Switch Chromecast_Livingroom_Active        "Chromecast Livingroom Active"                     <network> (gAssistent) { channel="chromecast:chromecast:livingroom:idling", profile="transform:MAP", function="on_off_invert.map" }

In on_off_invert.map:

OFF=ON
ON=OFF

Any help would be much appreciated.

Transform profiles only work with String type Items

There’s little cost in creating a proxy Item and an update-invert rule