[SOLVED] Creating state icons

I recently create a couple of @rip off@ plugins based on the VSwitch plugin. Phone Locator and Some x10 Stuff. The functionality is the same as the VSwitch but the visuals are macthing their actual devices.

Anyway… I tried to use the JSON files to create my own state icons but it never switches icon… I can’t understand the docs on this one and hoped someone could help.

As such:

I’m interested in this too. It just bugs me seeing a CFL on my pool pump device, for example.

Once I get this figured out I will release the reset of these plugins…

Assuming your service ID and variable name are correct, the only differences between your json and some of mine that do work are in the first few lines. The flashicon item should be the root of the state_icon files. Try:

{ "flashicon": "icons\/phone.png", "halloIconsDir": "pics\/hallo", "state_icons": [ "phone_0.png", "phone_100.png" ], "x":"2", "y":"4", "inScene":"1", "DisplayStatus": { "Service": "urn:upnp-org:serviceId:VPhone1", "Variable": "Status", "MinValue": "0", "MaxValue": "1" }, etc.

You should have three icon files: phone.png (used only while loading), phone_0.png (used when Status is “0” and phone_100.png (used when Status is “1”).

LOL… I have no idea… as I say I only ripped off the VSwitch one and edited what I could see that made sense to me… The other thing I did was add a UUID to mine… to make sure they were different…

LOL… I have no idea… as I say I only ripped off the VSwitch one and edited what I could see that made sense to me… The other thing I did was add a UUID to mine… to make sure they were different…[/quote]
OK…

I cannot follow quite what you have and haven’t changed from VSwitch. You are using your own file names but most of the service IDs and variable names appear to be the same - except the one you refer to in the json which doesn’t appear to be defined anywhere in your code.

If you want to make this a special-purpose plugin, you should change the service IDs as well as the device type. If it is only the icon you wanted to change, just change the file names in the json but put the service ID back to VSwitch.

Thanks
When I did that… It changed the icons on all VSwitches so I went this route… I will try to take it further as you suggested to make it more unique

You should be able to define a custom device type with it’s own json file but still use the VSwitch service and implementation files. So your changes are confined to D_PhoneLoc.xml and D_PhoneLoc.json.

In D_PhoneLoc.xml, define your own deviceType - you shouldn’t really use upnp-org for this - and specify your staticJson file. Leave all the service stuff and implementationFile as for VSwitch.

In D_PhoneLoc.json, change the three icon file names but leave everything else as it was for VSwitch. You also need to change the DeviceType and device_type tags at the end of the json to your new one.

Thanks…
Hmm… no this didn’t work out…
I took a fresh set of files and only modified as per you direction but it didn’t make a difference.
I’ll keep plugging away at it

[quote=“konradwalsh, post:10, topic:179297”]Thanks…
Hmm… no this didn’t work out…
I took a fresh set of files and only modified as per you direction but it didn’t make a difference.
I’ll keep plugging away at it[/quote]
When you say it didn’t make a difference, what happened? Did you change an existing VSwitch to use your new device file (D_PhoneLoc.xml)? After a Vera reload and browser refresh you should have got new icons. If not, post your new files.

Your questions make me realise I may not have understood your driections.
Here are the two files I modified

I made a slight change to your json file.

Thanks

I was so sure I tried with and without that line:

"halloIconsDir": "pics\/hallo",

Yet it works… thanks…

What exactly does that line do?

What exactly does that line do?
I don't know. I haven't seen it in any documentation. I think it may be a hangover from a previous release.
Yet it works.. thanks..
I also modified [b]"flashicon": "icons\/phone.png"[/b] which was definitely wrong.

Here is the wiki reference:
http://wiki.micasaverde.com/index.php/Luup_plugin_icons

And when uploading to the App Store, you need to consider this:
http://wiki.micasaverde.com/index.php/Apps.mios_Developer’s_Guide

thanks for your help guys… I will update a new post with the details so others can do the same