Philips Hue, IFTTT, and getting the temperature status of motion sensors

First, is it me or can you no longer create new applets to control your Philips Hue system on IFTTT? I see my old applets all working fine, but I don’t see Philips as a service for new applets.

Second, I’d like to find a way to display the temperature status of the various Philips Hue motion sensors in my house on my Mac’s desktop using Geektool. I imagine I would use some kind of shell script or Applescript. Has anyone automated this yet? I don’t necessarily want to reinvent the wheel. Based on this post at openhab.org, it looks like the data can be had through Javascript. Any thoughts?

Shows okay for me.

Oh I feel dumb. I was looking for it under triggers, probably because I’m looking for the temperature status as a trigger for other things, which tells me something right there.

I wonder if there’s another way to skin this cat though.

I don’t have any sensors, but I do run scripts from my Mac to directly access my Hue hub and control my lightbulbs.

Here’s a little example of a base ‘set bulb’ script.

My settings script file referenced at the start contains things like my API access token and bulb ID/name pairs.

A simple curl based interaction from a shell script does what I need. You can find details of how to do this and what is going on above by referencing the Hue API documentation. You can get started here.

https://developers.meethue.com/develop/get-started-2/

As for temperature, there’s some useful details about the temperature readings here.

Hope that helps.

Thank you. That gives me a good starting point.

Can I bug you for some newbie help? I’ve figured out how to get the temperature sensor data using:
curl http://192.168.4.32/api/[API_KEY]/sensors/18/
which returns:
{
“state”: {
“temperature”: 2027,
“lastupdated”: “2019-11-16T22:16:46”
},
“swupdate”: {
“state”: “noupdates”,
“lastinstall”: “2019-03-14T23:08:48”
},
Plus a whole lot more. Excuse the basic question, but what’s the best way to parse that in either a shell (that I can use in Keyboard Maestro) or Applescript so I can just get that “temperature” result in a variable?

I would greatly appreciate any help you can give me there. I’m a rank amateur who blunders about in code trying to wrestle the tech into something that works for me.

Okay, I have figured out how to do this with AppleScript. I also format it by converting to Fahrenheit and round down to two decimal places:

tell application "JSON Helper"
	set result to (fetch JSON from "http://192.168.4.32/api/[API_KEY_HERE]/sensors/18/")
	tell state of result
		set officeTemp to its temperature
		set officeTempF to (officeTemp / 100 * 9 / 5 + 32)
	end tell
end tell
round_truncate(officeTempF, 2)

A Google, or preferred alternate search engine, search about your preferred tool, skill set and ‘JSON parsing’ should invariably yield various options for you to consider.

Given CURL is a command line utility, this sort of discussion would probably be a good starting point for shell scripting it.

Personally I wouldn’t choose AppleScript for text manipulation and parsing, but if it is what you are most familiar with, then maybe it is the path of least resistance for you to take :slightly_smiling_face:

Also note that you have mis-formatted your script posting above. try putting everything in triple back ticks to resolve.

Thank you, that was my first attempt, spending about a half-hour googling variations on theme, but not finding anything that worked for me, including the link you provided. But while Applescript may not be ideal, as you say, it’s what I’m more familiar with and it works for my purposes.