[OBSOLETE] RainMachine

Ok, I finally got mine working again. Turned out to be something I broke on my end quite awhile back while I was experimenting with converting this app to be LAN-connected instead of having to communicate from the cloud.

@hondohudson - I think your problem is different than mine. Based on the line # in your error, I think yours is still the authentication access token issue. Do you have the latest code from my edits from this link?

The code around line 203 should look like this:

private doLogin() { 
	// TODO: make call through hub later... 
	apiPost("/api/4/auth/login",[pwd: settings.password, remember: 1]) { response ->
		if (response.status == 200) {
			//state.auth.expires_in = now() + response.data.expires_in		
			//state.auth.access_token = response.data.access_token

            //Only refresh the token if it has expired
            if (response.data.access_token != null){
            	state.auth.access_token = response.data.access_token
                state.auth.expires_in = now() + response.data.expires_in		
            }
			return true
		} else {
			return false
		}
	} 
}

Yes - thatā€™s the exact code.

Itā€™s now throwing an error at line 347. Server failed to respond

Sounds like maybe SmartThings is having trouble connecting to your Rainmachine box. I sent you a direct message.

Does this replace the code from the OP first post? It is hard to tell which is more accurate. TIA

Yes, my link replaces the original code with a fix.

1 Like

I only ask because when I go to activate the smart app and the device in the ST app I get an error message after I put in the credentials for RM

Will this device type also work with the Rainmachine Mini-8?

Well that looks fun. See if you can log into the graph.api page and view logging while that happens to get a more detailed error message.

I would think so assuming they donā€™t break the API. Hard to say for sure as I donā€™t have one.

I removed some credentials.
47daf356-8e30-49e2-b1b4-d30eccf326b9
8:47:43 PM MST: debug off()
47daf356-8e30-49e2-b1b4-d30eccf326b9

8:47:43 PM MST: trace stopAction()
f1c92456-c4db-4498-a985-62a5d0b48c19

8:47:42 PM MST: debug Notify - BinaryState = inactive
f1c92456-c4db-4498-a985-62a5d0b48c19

8:47:42 PM MST: debug Parsing 'index:03, mac:08863BC85FE1, headers:Tk9USUZZIC8gSFRUUC8xLjENCkhPU1Q6IDE5Mi4xNjguMS45OjM5NTAwDQpDT05URU5ULVRZUEU6IHRleHQveG1sOyBjaGFyc2V0PSJ1dGYtOCINCkNPTlRFTlQtTEVOR1RIOiAxMzINCk5UOiB1cG5wOmV2ZW50DQpOVFM6IHVwbnA6cHJvcGNoYW5nZQ0KU0lEOiB1dWlkOmQ5NTkxYmM0LTFkZDEtMTFiMi1iODk4LWZlNTk5MGNlOGFlMA0KU0VROiAzMQ==, body:PGU6cHJvcGVydHlzZXQgeG1sbnM6ZT0idXJuOnNjaGVtYXMtdXBucC1vcmc6ZXZlbnQtMS0wIj4KPGU6cHJvcGVydHk+CjxCaW5hcnlTdGF0ZT4wPC9CaW5hcnlTdGF0ZT4KPC9lOnByb3BlcnR5Pgo8L2U6cHJvcGVydHlzZXQ+CgoNā€™
f11f0550-03c5-4330-852e-5897b9484077

8:47:25 PM MST: error org.apache.http.conn.ConnectTimeoutException: Connect to 192.168.1.xx:xx [/192.168.1.xx] failed: connect timed out @ line 347
f11f0550-03c5-4330-852e-5897b9484077

8:47:15 PM MST: debug HTTP POST : [uri:http://192.168.1.xx:xx, path:/api/4/auth/login, contentType:application/json, query:[access_token:], body:[pwd:xxxxxx, remember:1]]
f1c92456-c4db-4498-a985-62a5d0b48c19

8:47:22 PM MST: debug Notify - BinaryState = inactive
f1c92456-c4db-4498-a985-62a5d0b48c19

8:47:22 PM MST: debug Parsing 'index:04, mac:08863BC85FE1, headers:Tk9USUZZIC8gSFRUUC8xLjENCkhPU1Q6IDE5Mi4xNjguMS45OjM5NTAwDQpDT05URU5ULVRZUEU6IHRleHQveG1sOyBjaGFyc2V0PSJ1dGYtOCINCkNPTlRFTlQtTEVOR1RIOiAxMzINCk5UOiB1cG5wOmV2ZW50DQpOVFM6IHVwbnA6cHJvcGNoYW5nZQ0KU0lEOiB1dWlkOmQ5NTkxYmM0LTFkZDEtMTFiMi1iODk4LWZlNTk5MGNlOGFlMA0KU0VROiAzMA==, body:PGU6cHJvcGVydHlzZXQgeG1sbnM6ZT0idXJuOnNjaGVtYXMtdXBucC1vcmc6ZXZlbnQtMS0wIj4KPGU6cHJvcGVydHk+CjxCaW5hcnlTdGF0ZT4wPC9CaW5hcnlTdGF0ZT4KPC9lOnByb3BlcnR5Pgo8L2U6cHJvcGVydHlzZXQ+CgoNā€™
5ea3e0ff-2880-4aee-b3d8-32ebacd876f4 8:47:20 PM

Ok so it looks like you put in a local IP address. That wonā€™t work. This is because SmartThings is going to be hitting your RainMachine from the cloud, which means you need to put in your public IP. That also means you need to make sure port 80 is forwarded from your router to the RM IP.

On a related note, I do still want to rewrite this app at some point to be able to connect from the hub over LAN. It will just take a few days of work, and I havenā€™t had any free time to mess around with it.

Iā€™m getting the same error message as above: ā€œError saving unnamed page. Please contact SmartApp developerā€, although I definitely use external IP address and port forwarding. I verified that I can access RainMachine externally from the browser.

The log contains MissingPropertyException on line 348

Thanks in advance!

5:53:30 PM: error groovy.lang.MissingPropertyException: No such property: ErrorMessage for class: java.io.ByteArrayInputStream @ line 348
ec10834d-8df9-4ea5-ad82-17ef291bb0b7 5:53:30 PM: debug HTTP POST : [uri:http://67.86.xxx.xxx:18080, path:/api/4/auth/login, contentType:application/json, query:[access_token:], body:[pwd:xxxxxxxxx, remember:1]]
f75ec2b1-2e00-4a20-a510-421ac246c7ff 5:53:26 PM: debug summaryData: [[icon:indicator-dot-gray, iconColor:#878787, value:Unconfigured]] - [[icon:indicator-dot-gray, value:Unconfigured, iconColor:#878787]]

Your error message is slightly different, actually. Iā€™ve not seen that one before. For what itā€™s worth, I was never able to get SmartThings to connect unless I opened up port 80. Mine is actually not working right now because I switched to AT&T, and their dumb router apparently doesnā€™t let you forward port 80 because the native interface is stuck on it and canā€™t be reconfigured. My plan is to rewrite this app to use local LAN access before watering season starts.

1 Like

That is fine but I would update the app to say external or dns ip to be more clear. Thanks for the reply.

I tried my dns ip as well as my external and I got the same error message.

Thank you for your hard work Copyninja I used your MyQ stuff for my Chamberlain garage door and it worked perfect. I sent you a donation for that one and as soon as I get my Rainmachine I am going to send you another donation. Thank You so much.

slightly off topic but i just found ifttt support for the rainmachine. YEAH! but still watchinh for smartapp with lan integration

I havenā€™t forgotten about this. Still planning on writing the LAN update. Hopefully will get to it before spring rolls around again!

Finally started writing code to do this integration via LAN. It will take me awhile because it SUCKS, big time. SmartThings does not make this easy, and the documentation is not helpful. Good news is Iā€™m able to get a response back from my Rainmachine via LAN, so now the biggest hurdle is parsing everything, which is a good deal more complicated this way for various reasons.

2 Likes

Thank you for your effort !!! Looking forward to this !

Any progress in getting this working ?

Yes! Itā€™s definitely going to work. Last week I finished rewriting the install process to be able to set up everything using the local IP, and it works beautifully. I still need to rewrite the refresh process - might take another week or two, though before I get the time to finish it.

Iā€™ll also need to rewrite the ā€œstopā€ and ā€œstop allā€ commands, but I canā€™t really test those out until I have the system up and running, which I donā€™t normally do until late April or May, so that may have to wait a bit. Iā€™ll try and post a version that has the basic install/refresh capability first just so people can test it out and make sure it works.

2 Likes