Dashboard button template sending null to push method

Having trouble with the button template. To test this is what I did.

Crafted a virtual button device.
Setup a tile on the dashboard using the button template and set the button value to 1.

When I press the button I get the following error.
java.lang.NumberFormatException: For input string: "null" (push)

This is on an iPhone running iOS 11.1.4

What driver?

The built in virtual button driver.

I was able to recreate the issue. If you go into the device and do a push with a number of 1 in the device itself it will create the "push" state.

This will then allow the dashboard to work.

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.

That was it. Got it working now. Thanks for the help.

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.

Thanks,
Richard

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.

Ok thanks. It just seems so unnecessarily complicated that buttons on the dashboard don't allow direct input. I must be missing some logic here...

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.

Hopefully this helps to explain it...:thinking:

1 Like

I see. Thank you for the explanation and your patience!

1 Like

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".

1 Like

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.

1 Like

Most welcome. And welcome to Hubitat!!!

I'm starting to really like this thing. It's a learning curve, for sure. But it is powerful and fun!

2 Likes