App and driver porting to Hubitat

I am by definition a consumer..

I find HE perfectly designed for me.

5 Likes

Any suggestions for the issues I am seeing trying to get my Andersen Verliock translator and sensors moved over from Wink using a driver for it from ST? See discussion here - links to ST drivers are a few posts up (I'm definitely in over my head in doing a more complicated port from ST code :upside_down_face:)

We changed that awhile ago, sorry that post did not get updated. All you have to do is sign up for an account on docs.hubitat.com and start editing. There is still an approval process so your edits do not show up publicly immediately

2 Likes

What should I do with these commands from a SmartThings SmartApp? Not sure how to port it.

app?.deleteSetting("$name")

Giving this error in the logs:
groovy.lang.MissingMethodException: No signature of method: **************deleteSetting() is applicable for argument types: (org.codehaus.groovy.runtime.GStringImpl) values: [8a0fd8ce-6c50-4572-8da5-68d2204b7e2b_zones] on line 184 (deleteSetting)

And
revokeAccessToken()
gives a similar error - no signature of method

And
addRemoveDevices Exception: groovy.lang.MissingPropertyException: No such property: completedSetup for class: com.hubitat.app.ChildDeviceWrapper

I don't see anything in the hubitat developer documentation...

deleteSetting should be removeSetting

To revoke an OAuth token just do:

state.accessToken = null

And the last one you didn't provide the code in question so it's not really something I can answer, though I suspect you need to look at the first post in this thread which has the syntax for addChildDevice which is not the same as SmartThings. I suspect that's the issue,

Thanks. The code is:
d = addChildDevice("lnjustin", getChildContName(), contDev?.key, null, [label: getDeviceLabelStr(contDev?.value?.name)])
d.completedSetup = true // this line is causing the error

I don't see anything in the addChildDevice syntax to indicate completedSetup?

completedSetup doesn't exist in HE as far as I'm aware. Just remove that line, you won't need it. Mind if I ask what you're porting? It's possible someone already did the heavy lifting for you!

Please folks i would like to ask that if someone could help me transfer this driver from smartthings to hubitat. This will help me a lot

https://raw.githubusercontent.com/hongtat/tasmota-connect/master/devicetypes/hongtat/tasmota-virtual-air-conditioner.src/tasmota-virtual-air-conditioner.groovy

@jorgespneto what errors are you getting? What’s not working?


This one

Try removing lines 28-33

1 Like

Worked
and this ?

dev:2692020-10-10 10:07:26.718 pm errorgroovy.lang.MissingMethodException: No signature of method: java.util.LinkedHashMap.encodeAsJson() is applicable for argument types: () values: [] Possible solutions: encodeAsBase64() on line 168 (calledBackHandler)

dev:2692020-10-10 10:07:16.480 pm errorgroovy.lang.MissingMethodException: No signature of method: java.util.LinkedHashMap.encodeAsJson() is applicable for argument types: () values: [] Possible solutions: encodeAsBase64() on line 168 (calledBackHandler)

I am trying to make a virtual air conditioning control work but I am having difficulties

Isn't there already a port for Tasmota?

Hi,
I'm trying to port some code from ST to Hubitat here Sinope TH1120RF-3000 Drivers From Smartthings. I'm having difficulties here:

data.location_list = resp.data

It says java.lang.NullPointerException: Cannot set property 'location_list' on null object (StartCommunicationWithServer)

Another question what's the difference between:
data.deviceId = null
and
data?.deviceId = null

Thanks!

Guessing here a bit

where is data in your first example defined? There should be a

Map data

or

def data

somewhere. Ideally setting it to [:]

There is no difference on the left side of the = for

Normall it is used to avoid null reference errors on the right

ie

def a = data?.deviceId

if data was null, the ? would avoid the null reference exception and a would become null.

It does not have meaning on the left side, it is usually caused by the author doing global search and replace trying to big hammer null reference exceptions.

1 Like

Thanks for you info! Good to know about the '?'.

About the data, the first occurrence of location_list was here:

		data?.deviceId = null
		data.devices_list.each{var ->
			try{
				def name_device=var.name
				name_device=name_device.toLowerCase().replaceAll("\\s", "")
				if(name_device==deviceName){
					data.deviceId=var.id
						data.error=false
						state.deviceName = deviceName;
						state.deviceLocation = settings?.locationname.toLowerCase().replaceAll("\\s", "");
						return data.deviceId;
				}else{
					data.code=4001
				}
			}catch(e){
				data.code=4003
			}
		}

And the second occurrence is here:

		case "deviceList":
			httpGet(params) {resp ->
				isExpiredSessionEvent(resp)
				data.devices_list = resp.data
				if(resp?.data?.error?.code == "USRSESSEXP"){
					askForSessionReset();
				}
				
			}

I don't know if it answers your question. Thanks for you help!

I would like to thank you for your help and ask for more help with a driver that I am modifying.
The intention of this driver is to function entirely as a virtual air conditioner, only as a command to trigger events in the webCoRE.
Everything that I need is already appearing on it, however, I am not having the status of the device. For example, when I set the device to on, it does not appear on it, this is happening in all functions. Could you please take a look at the code? Thank you very much in advance.

What do you mean by “doesn’t appear on it”?