Section with text throws error

Coded on a dynamic page. Why is this an error?
Also puts hubitat into a loop that can only be broken by pulling power from hub, forcing a reboot

	section("ID is generated when this profile is saved.") 

groovy.lang.MissingMethodException: No signature of method: app1543241222184578685064.section() is applicable for argument types: (java.lang.String) values: [ID is generated when this profile is saved.]
Possible solutions: version(), getAt(java.lang.String) on line 157 (pageZeroVerify)

Nothing looks wrong with the line as posted but, as is usually the case, you are probably going to have to share the surrounding code.

	if(atomicState.accessToken)
		{
		section("ID is\n${atomicState.accessToken.substring(0,8)}") 
		section()
			{
			href ("removePage", description: "Tap to revoke ID", title: "Revoke ID")
			}
		}
	else	
		section("ID is generated when this profile is saved.") 

	section
		{
		input "simkeypad", "device.InternetKeypad", multiple: false, required:true, submitOnChange: true, 
			title: "Simulated Keypad Device"
		}

I'm not sure why you are building empty sections the way you are but I always add the curly brackets even if the section is empty. Also, and probably most important, is that your last section is missing "()". Try something like this

if(atomicState.accessToken)
		{
		section("ID is\n${atomicState.accessToken.substring(0,8)}") {}
		section()
			{
			href ("removePage", description: "Tap to revoke ID", title: "Revoke ID")
			}
		}
	else	
		section("ID is generated when this profile is saved.") {}

	section()
		{
		input "simkeypad", "device.InternetKeypad", multiple: false, required:true, submitOnChange: true, 
			title: "Simulated Keypad Device"
		}
1 Like

Thanks that seems to have fixed the issue. In ST the section generated bold text, paragraph was light text.

I expected issues with moving my ST code over to HE, but this type of stuff should be caught during save and not cause the hub to loop.

1 Like

Agreed. Tagging @chuck.schwer.

1 Like

The missing method issue is not possible (or I suppose practical) to catch on save, however the loop issue is known and will be fixed in the next release.

2 Likes

Also getting caught in multiple places in my code with remove statements with text

remove("Go back to page One to Remove")

groovy.lang.MissingMethodException: No signature of method: app1543247847303588515241.remove() is applicable for argument types: (java.lang.String) values: [Go back to page One to Remove]
Possible solutions: removePage(), getAt(java.lang.String) on line 238 (pageOneVerify

I've never heard of the remove() method.. what does it do on Smartthings?

I used it to create custom Remove buttons. It allowed me to add precaution text so user would know exactly what the were doing.

https://docs.smartthings.com/en/latest/smartapp-developers-guide/preferences-and-settings.html#custom-remove-button

1 Like

creates a remove button with custom text

Easy enough to workaround. Changed to a paragraph and a plain Remove button.

And another issue.

def b64= redirectUrl.encodeAsBase64()

groovy.lang.MissingMethodException: No signature of method: java.lang.String.encodeAsBase64() is applicable for argument types: () values: []
Possible solutions: decodeBase64() on line 290 (installed

The full coding
if (atomicState.accessToken)
{
def redirectUrl = buildRedirectUrl //"${serverUrl}/oauth/initialize?appId=${app.id}&access_token=${atomicState.accessToken}"
def b64= redirectUrl.encodeAsBase64()
try {
def url='https://www.arnb.org/shmdelay/oauthinit_st.php'
url+='?i='+b64 //stop this data from interacting
include 'asynchttp_v1'
asynchttp_v1.get('getResponseHandler', [uri: url])
}
catch (e)
{
revokeAccessToken()
atomicState.accessToken=null

@arnb Take a look at this thread for the work around: Help with encoding password

There are a number of methods that we don't support and probably never will support,, encodeAsBase64 is a grails extension and we have no plans to add grails.

Also take a look at this post.. it's a wiki so you can update it if it is missing any information about migrating code (ie the remove() method)

1 Like

Thank you I will give it a try. I'm a PHP programmer that fights with Groovy/Java to get things done.

Finally got encodeBase64 to work by following info at this link

This works
def encoded = "Hello World".bytes.encodeBase64().toString()

Read the varous threads on getting end points, but feel like I've been navigating in the middle of a murky swamp, and could use a lifeline.

Attempting to get my app's endpoint(s) using Url with keypad as the path
https://cloud.hubitat.com/api/<api>/apps/<appid>/keypad?access_token=<access-token>

The path statement
mappings
{
path("/keypost/:command") {action: [GET: "api_pinpost", POST: "api_pinpost"]}
}

Response from server: (tried curl post=true and false same result, in ST I used GET)
error: 502, Internal server error

My curl stuff Bearer token set to access token
$options = array(
CURLOPT_RETURNTRANSFER => true, // return web page
CURLINFO_HEADER_OUT => true, // send headers
CURLOPT_POST =>true,
CURLOPT_HTTPHEADER => array( 'Authorization: Bearer ' . $token),
CURLOPT_FOLLOWLOCATION => true, // follow redirects
CURLOPT_ENCODING => "", // handle all encodings
CURLOPT_AUTOREFERER => true, // set referer on redirect
CURLOPT_CONNECTTIMEOUT => 15, // timeout on connect
CURLOPT_TIMEOUT => 20, // timeout on response
CURLOPT_MAXREDIRS => 10, // stop after 10 redirects
CURLOPT_SSL_VERIFYPEER => false, // ignore certificate (down and dirty)
);

$ch      = curl_init($url);
curl_setopt_array( $ch, $options );
$content = curl_exec($ch);

tag @chuck.schwer If it helps the last attempt was 20181127 around 14:55

When I attempt this locally I get Error 404 by changing https://cloud.hubitat.com to 192.168.0.nnn I get error 404 not found

You can PM me the url if you want so your information is not out in public. But looking at the mapping you reference, it appears that your url is not right. at the end you have /keypad?... but your mapping says you should have /keypost/<some command>?... I'm not sure what the possible values are for some command, you would have to look into the method that the mapping calls (api_pinpost)