I have been trying to get this to work also. It is more complex than it seems.
This is what I have found. @mohsh86 is correct. The icons map to the transformed value, not the underlying state of the item. I am transforming the label of my item, so that OPEN/CLOSED becomes OnLine/OfflLine. I have to create a network icon called network-online.png and one called network-offline.png. Using the iOS app, I have found that this only uses png icons, not svg icons. These icons go in /conf/icons/classic.
However, I have found that you also need to create an icon called network.png (a copy of the one built in to the OH2 icon set) or this still will not work. I did not find that case was an issue (other than the icon names all need to be lower case) - the transform can be upper case and it works.
In addition, I found that group icons use the underlying state of the icons in the group (not the transformed values), so the group icon is using OPEN/CLOSED, so for the group icon to change state I also need to create icons network-open.png and network-closed.png.
Also, I expect that the iOS interface will switch to svg icons at some point, so I also have to create the same icons in svg format.
So, for my network state icons to change state, using Contacts, not Switches, I have to create (in conf/icons/classic):
network.png
network.svg
network-online.png
network-online.svg
network-offline.png
network-offline.svg
network-open.png
network-open.svg
network-closed.png
network-closed.svg
This still gives inconsistent results between the different UI’s - basic, classic and iOS all display something slightly different. I believe that this is because you have to restart the runtime to clear out cached icons (which is why this is so hard to troubleshoot). I also have some network icons which are ON/OFF icons. These worked, but the group icons did not! I finally had to copy the network-on.png and network-off.png (and svg) icons to conf/icons/classic to get the whole thing to work.
So add to the above list:
network-on.png
network-off.svg
network-off.png
network-off.svg
restart the runtime, clear the cache on the ios app, and finally my network icons reflect the state correctly in basic and iOS UI’s the group icons still do not work in classic UI - but that I can live with.
It would seem that the only way to get this working is to copy the entire icon set to conf/icons/classic, then add icons to reflect both the underlying and transformed state for icons that do not have a state that you want (both png and svg versions).
I’m not sure that this is what was intended though.
For completeness, here are my items, transforms etc:
/* Lighting Controllers */
Switch back_garden_network "LED wifi [MAP(network.map):%s]" <network> (gLightControllers) { nh="192.168.100.158" }
Switch back_garden_network_master "LED Master wifi [MAP(network.map):%s]" <network> (gLightControllers) { nh="192.168.100.159" }
Switch back_garden_network_slave "LED Slave wifi [MAP(network.map):%s]" <network> (gLightControllers) { nh="192.168.100.164" }
/* Cameras */
Switch back_garden_camera "Back Garden Camera [MAP(network.map):%s]" <network> (gCameras) { nh="192.168.100.140" }
Switch side_garden_camera "Side Garden Camera [MAP(network.map):%s]" <network> (gCameras) { nh="192.168.100.130" }
Switch porch_camera "Porch Camera [MAP(network.map):%s]" <network> (gCameras) { nh="192.168.100.120" }
Switch hallway_camera "Hallway Camera [MAP(network.map):%s]" <network> (gCameras) { nh="192.168.100.110" }
/* fake Bluetooth switch */
Contact Nick_Bluetooth_Test "Nicks Bluetooth [%s]" <network> (gPeople) {mqtt="<[proliant:bluetooth/Nick_Bluetooth:state:default"]}
Contact Nick_Bluetooth "Nicks Bluetooth [MAP(contact_network.map):%s]" <network> (gPeople) {mqtt="<[proliant:bluetooth/Nick_Bluetooth:state:default"]}
Contact Jill_Bluetooth "Jills Bluetooth [MAP(contact_network.map):%s]" <network> (gPeople) {mqtt="<[proliant:bluetooth/Jill_Bluetooth:state:default"]}
Contact Francesca_Bluetooth "Francesca Bluetooth [MAP(contact_network.map):%s]" <network> (gPeople) {mqtt="<[proliant:bluetooth/Francesca_Bluetooth:state:default"]}
Contact Chris_Bluetooth "Chris Bluetooth [MAP(contact_network.map):%s]" <network> (gPeople) {mqtt="<[proliant:bluetooth/Chris_Bluetooth:state:default"]}
/* TVs */
Switch TVON "Family Room TV [MAP(network.map):%s]" <network> (GF_Family) { nh="192.168.100.116"}
Switch GC100Network "GC100 IR Interface [MAP(network.map):%s]" <network> (GF_Family) { nh="192.168.100.124"}
/* WD My Cloud */
Switch WD_My_Cloud_reboot "WD My Cloud Reboot" <reboot> (gB) //fake switch to reset WD My cloud server
Switch WD_My_Cloud "WD My Cloud Power [%s]" <shutdown> (gB) { wol="192.168.100.255#00-90-A9-F2-ED-27", exec=">[OFF:sudo sshpass -p waterrat ssh sshd@192.168.100.137 /usr/sbin/shutdown.sh]"}
Switch WD_My_Cloud_Status "WD My Cloud [MAP(network.map):%s]" <network> (gB) { nh="192.168.100.137" }
network.map:
OFF=OffLine
ON=OnLine
-=Unknown
NULL=Unknown
contact_network.map:
CLOSED=OnLine
OPEN=OffLine
-=Unknown
NULL=Unknown
There may still be more to this, as my group icons still behave oddly sometimes, but this is some progress.
Also, just FYI, Sitemap mappings work the same way, ie on the transformed value, not the underlying value. this is also different from OH1.