Will file an issue internally to update the built in virtual button driver to initialize the state on load to not require this. Should only be needed to do once, then any button number in dashboard should work up to the max number of buttons.
Bumping this old thread. I can confirm this still is an issue in v2.0.0.104.
It may be a small issue, but when adding virtual buttons to dashboards that already have deep use within rules or other parts of an installation, it makes it very difficult to issue a "push" without triggering many unwanted behaviors. This has to be fixed such that any virtual buttons are "working" at all times once added. Buttons should not require "priming."
While on the topic of virtual buttons, I also could see a use case for an enable/disable preference (or another better method) built into the device. So while editing rules or adding functionality to a virtual button, it can be taken offline so as not to accidentally trigger some long chain of delayed actions.
Was also surprised to not be able to use a dashboard button tile to press, double press, and hold a SmartThings button. It seems to do nothing when clicking on the tile.
A SmartThings Button is an output only device, right? So you canβt control a Button device, as they typically do not accept any inputs.
Virtual Button devices, on the other hand, are designed to expose commands to simulate a button press.
On the Dashboard, just control the device directly that the SmartThings button is configured to control. Or, add a Virtual Button Device if need be, and activate it from the Dashboard.
Create a virtual button (button X). Then in the rule with the ST button, add a second trigger - Button X. Now, whenever you press the Button X on the dashboard, the rule will run.
OK will try that. But I don't understand why a button is considered an output device with no inputs. The SmartThings button allows 3 inputs; press, double click, and hold. I don't understand why the tile on the dashboard for this device wouldn't show its last state and allow these 3 types of input directly from the dashboard.
The SmartThings button can only OUTPUT data to your hub. It is a Button Controller, not a switch device. Thus you cannot send it any commands. It is analogous to your keyboard on your computer. It only sends data, it cannot receive data.
I agree that it has physical input button(s)/gestures, but those always result in Button Events being generated in the Hubitat system. The Hub cannot send commands to the SmartThings Button Device.
This is different than a Switch device, which can be physically operated (independent of the hub), or commanded by the hub.
So, the button controllers are more like a motion sensor or contact sensor. On the Dashboard, you cannot change the motion active/inactive status of a physical motion sensor device. However, virtual devices have to be able to be manipulated somehow, so they expose commands to allow exactly that.
While setting my Hubitat up today I'm running into this issue.
I created a virtual button with the standard template, added it to the Dashboard, when I push it the Log shows "java.lang.NumberFormatException: For input string: "null" (push)".
So I deleted the button from the dashboard and deleted the virtual button in the devices. I created a new virtual button, went into the button settings and put "1" into the number field, pushed the button. The log shows "Button 2 button 1 was pushed". I went into the Dashboard, added the new button, pushed it and got the same "null" (push) error message.
Any advise how to get around this so that I can make a virtual button work?
What do you mean "new button"? You have one button device. You have to define for each dashboard tile, which button on the device you want to push. So, if your virtual device has 3 buttons, you could create 3 times, one for each button. But you have to specific the button number when you define the tile.
I think you're not understanding how virtual buttons work. Name the virtual device something other than "button 1" or "button 2". Think of it as a real button device on the wall with multiple buttons. You wouldn't call that "Button 1". You'd call it "living room buttons" or something similar. Then within living room buttons, you have button 1 button 2, etc. You can define in the virtual button driver the number of buttons your virtual button device will have. Then, when you push the button in the dashbord, you'll see an event "Living Room Buttons - Button 1 Pushed".
I think this is it. In the tile descriptions there is a field for Button Number which I missed to specify. Therefore my tile was not connected to any of the 5 buttons on my virtual device. Awesome! Thank you.