APIs for common household smart things (Nest/Google Home, Ring, etc)

I’m interested in using this to see some info from things like Nest, Google Home, Ring, Hue, etc. Unfortunately, it seems like some of them are locked down/unavailable (I’m looking at you, Nest). I was hoping we could share here ways to at least read if not write some of these devices via HTTP or something.

I’ll start: Hue has a decent API that I believe is still working. Haven’t actually tested it yet but it looks good, and I can confirm the debug endpoint works on my own Hue bridge.

3 Likes

I was running into similar issues when I started to dig into things last night for connecting to my devices as well. I did find this for nest, though sounds like it will be a little bit(late 2020) before any approval or access will be granted.

1 Like

Hue should be pretty solid; it seems pretty well supported across home automation solutions.
The Home Assistant project has a pretty good list of (OSS) integrations - they’re all written in Python, but some of the code may be transferable to Ignition, or form a starting point for Ignition modules:

Personally, I don’t have any smart devices or I probably would have already written drivers…although if anyone wants to rectify the first problem, I could probably find some time :wink:

3 Likes

Nice, I’ll take a look at that tonight! Also it seems like MyQ garage door openers should be simplish to access from what I saw last night, as well as the Tesla API.

Samsung SmartThings or Wink or any of the Zwave controllers would be a great integration.

2 Likes

VeSync and Sonoff have easy APIs

Add Hubitat to that list. It would be great to be able to monitor and control the connected devices of these platforms. I know Ignition Maker Edition was just release, but I am gitty with the possibilities. Ignition IS the best!

Update: Already figured it out, may not be the best way, but it works. On Hubitat, install the Maker API that is included, select which devices you want exposed, and use httpGet commands to monitor and control devices connected to the hub. Z-Wave, Zigbee, WiFi, anything connected to the Hubitat hub. I can’t wait for what the smart people figure out on connecting home components.

1 Like

So i have some Hue bulbs and the API debug tool works but when I run a script in Ignition i get some errors. I am using this on the perspective button. Action performed event. Any help is much appreciated lol.

com.inductiveautomation.ignition.common.script.JythonExecException
Traceback (most recent call last):
  File "<function:runAction>", line 15, in runAction
java.io.IOException: java.io.IOException: Unable to GET https://myhue/api/username/lights

	caused by org.python.core.PyException
Traceback (most recent call last):
  File "<function:runAction>", line 15, in runAction
java.io.IOException: java.io.IOException: Unable to GET https://myhue/api/username/lights

	caused by IOException: Unable to GET https://myhue/api/username/lights
	caused by IOException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
	caused by SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
	caused by ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
	caused by SunCertPathBuilderException: unable to find valid certification path to requested target

Ignition v8.1.2 (b2021020311)
Java: Azul Systems, Inc. 11.0.9

#####################################################################################################	
	# Get username and password
	path = [
				"[default]Phillips Hue/Credentials/Username"
			  ]
	credentials = system.tag.readBlocking(path)
	# Get Username 
	userName = credentials[0].value
	#####################################################################################################
	#Set the Connection/Data for the patch requests
	client = system.net.httpClient()
		
	requests = client.get(url="https://(my_hue_ip)/api/{}/lights".format(userName))
	
	reading_ok = requests.isGood()
	
	if reading_ok:
		path = [
				"[default]Phillips Hue/API Status/Get Lights Status",
				"[default]Phillips Hue/Light Data/All Light Data"
				  ]
	 
		value = [
					 1,
					 requests.text,
				 ]
		system.tag.writeBlocking(path, value)
	
	else:
		path = [
				"[default]Phillips Hue/API Status/Get Lights Status",
				  ]
		 
		value = [
					 0,
				 ]
		# Send the write off
		system.tag.writeBlocking(path, value)

Did you configure it to use HTTPS or did it come that way? It must be a self-signed certificate; you'll need to get a copy of that and add it to Ignition's trusted CA cert list.

edit: or use bypass_cert_validation=1 parameter when creating the client.

2 Likes

I just took the s off and it worked. Should i go through the trouble of adding the certificate?

Meh, for your home network if you can just use HTTP I wouldn’t bother…

Awesome, now i just have to figure out what to do with this JSON string haha

Now I kind of want to build an OPC UA server that talks to the Philips Hue bridge/lights… and I actually have some of these.

that would be awesome because i am having trouble using this api in ignition again. I can’t get this group of lights to turn off/on.

requests = client.put(url="http://myHueIp/api/{}/groups/1/action".format(userName),data={"on":false})

the data is in the the same format in the API debug tool message body.

This is the error i get, i have tried putting false in quotes so its a string , using a 0 instead of false etc. Nothing else works. the api debug tool only accepts the word false with no quotes. there has to be something simple i am missing here haha

I even tried defining false as a variable before as 0 and “false” both did nothing

com.inductiveautomation.ignition.common.script.JythonExecException
Traceback (most recent call last):
  File "<function:runAction>", line 15, in runAction
NameError: global name 'false' is not defined

	caused by org.python.core.PyException
Traceback (most recent call last):
  File "<function:runAction>", line 15, in runAction
NameError: global name 'false' is not defined

tried False instead of false?

2 Likes

Yup that was it. haha. Thanks

Hi Cegge - I am working on a home automation project for a workshop for some of the local colleges/universities.

If there is any additional code/information about the Phillips Hue lights that is not documented in this forum post, would you mind sharing it with me? I am going to start working on it this week.

Thanks

Cdavis -
That’s as far as I got on it. I haven’t done anything outside of turning the light on and off.