Change name of virtual switch button name

I am working on a plugin that is modeled after the virtual switch. I have everything working the way i want but i want to change the name of the on off buttons periodically. As an example the click the On button and the name changes to Waiting since my command i am issuing can take a couple minutes for the network device to reach the on state. When it does i want to change it back the button text to On.

Is there any way to do that in luup. I know you can set the initial Label text in the json config file. But how do u change it down the road.

It is not possible to change the ui buttons on the fly. It will require you to modify the D_xxxx.json file and reload the UI / luup engine.

  • Garrett

Bummer that is what i was afraid of. Anything i can do to show a status message on the device in the UI? Also can you change icons on the fly?

for an example, look at D_MotionSensor1.json on your vera by selecting download. You will see the two icon files that it uses for each state, indicating red running man and green man

{ "flashicon": "icons/Motion_Sensor.png", "imgIconBody": "", "imgIconDimmable": "", "imgIconTurnable": "", "imgIconMin": "", "imgIconMax": "", "halloIconsDir": "pics/hallo", "x": "2", "y": "3", "state_icons": [ "Motion_Sensor_0.png", "Motion_Sensor_100.png" ], "inScene": "1", "DisplayStatus": { "Service": "urn:micasaverde-com:serviceId:SecuritySensor1", "Variable": "Tripped", "MinValue": "0", "MaxValue": "1" },

Ahh that makes sense i will dig into it thanks! Maybe instead of changing the button text i would like to do something like this.
See screenshot.

Would i just do that with adding a label to my plugin? do you know what code and which files i need to put it in and can i change the status text periodically as the plugin runs?

I was looking at the Nest plugin cause their interface has something like what i want to do that updates the text. I found this code and implemented it in my json file but it doesnt show up.

  {
                    "ControlGroup": "3",
                    "ControlType": "variable",
                    "top": "0.2",
                    "left": "0",
                    "Display": {
                        "Top": 120,
                        "Left": 500,
                        "Width": 100,
                        "Height": 25,
                        "Service": "urn:undertoe-us:serviceId:Roomba1",
                        "Variable": "ModeState",
                        "Value": "Cleaning"
                    },
					"ControlCode": "hvac_state"

      }

Here is my project code: [url=https://github.com/undert03/vera-roomba]https://github.com/undert03/vera-roomba[/url]

I got it i had to add a scene group and scene control info for it.
I just went with the control type variable

"Control": [
			{
				"ControlGroup": "3",	
				"ControlType": "variable",
				"Display": {
					"Service": "urn:undertoe-us:serviceId:Roomba1",
					"Variable": "PingStatus",
					"Top": 10,
					"Left": 50,
					"Width": 200,
					"Height": 20
			
				},
				"ControlHeader":"1"
			}

great,

I personally just muddled my war through this so I’m not the right person to ask.

@guessed is (from what I have learned here) one of the masters in plugin development.

Cool plugin, by the way.

Bulldog thanks for the input though, plugin will hopefully be published in the app store soon.