Hue Lights Workflow

Hue Lights Workflow

I’ve enjoyed using the Workflow app (acquired by Apple) to create little workflows to help my dad complete tasks. Remind him at work, remember supermarket coupons, show interesting stuff, like indicate the number of people in space right now etc.

Recently he got Phillips Hue lights. I decided this was a perfect opportunity to cross Workflow with the Hue API. Yes I know, the Hue app, but where is the fun in that?

Hue API Workflow

First step was building a workflow to hook up with the Hue Bridge and pass the API commands. I followed the steps on the ‘getting started’ guide on the Phillips developer site.

For easy future editing, I broke out the ‘Bridge IP address’ and the ‘User ID’ as variables.

After a little test, I had a workflow that sent a colour value to a Hue light.

API Workflow Reuse

To avoid long complex workflows I decided to keep the Hue API workflow very simple. It just passes the colour hue value to the lights. Thats it.

Any future flows I make, their last step will be RunWorkflow Hue API, to run that flow and pass it a colour input.

This avoids duplication. Any future change to the Hue API, will only have to be made in one place.

Carbon Intensity Workflow

The Carbon Intensity Forecast (carbonintensity.org.uk) is an API provided by the National Grid.  It returns the amount of CO2 used by the UK power grid.

I already had a flow that returned the current Carbon Intensity from their API. I modified this to extract the returned value – low, moderate or high.

Three variables with green, amber and red colour hue values were created. An odd colour hue format is the format Hue requires, unsurprisingly.

Selecting one of three values wasn’t straightforward, as Workflow only has if/else statements, not if/if else/else. I had to get a little creative and nest statements:

  • If does not contain ‘moderate’?
    • If contains ‘low’?
      • Get low variable colour value (green)
    • Else ‘high’
      • Get high colour value (red)
  • Else moderate
    • Get moderate value (amber)

The corresponding variable fetched, gets passed when I run the Hue API workflow and the LED strip displays the Carbon Intensity level as green, amber or red. Success.

Workflow

Its a simple use case and may seem a simple project but it still threw up some interesting little problems to solve etc. I enjoy using and looking for excuses to use Workflow app.

I am interested in the ability of iOS 12 to use Siri Automation with custom phrases to accomplish the same functionality.

I am also hoping for the day when the Carbon Intensity is low by default.

Advertisements

How your home could generate, store and sell energy – BBC News

More energy storage providers – such as Ovo Energy, Powervault and Moixa are entering the market – particularly as electric vehicles (EVs) promise to become a useful addition to the domestic energy mix. BMW i3 batteries are already being used to store windfarm energy in Wales, so it makes sense to integrate such car battery tech into homes.

via How your home could generate, store and sell energy – BBC News

Where have all our insects gone? | Environment | The Guardian

Where have all our insects gone? | Environment | The Guardian

The start of summer is the time of year when the nation’s insects should make their presence known by coating countryside windows with their fluttering presence, and splattering themselves on car windscreens. But they are spectacularly failing to do so. Instead they are making themselves newsworthy through their absence. Britain’s insects, it seems, are disappearing.

via Where have all our insects gone? | Environment | The Guardian

Fernando Alonso wins Le Mans 24 with Toyota – BBC Sport

Fernando Alonso won Le Mans 24 Hours at the first attempt as he and team-mates Sebastien Buemi and Kazuki Nakajima finally ended Toyota’s long drought.

Toyota had never won the sportscar race despite years of trying but finally delivered in an event in which they were effectively without opposition.

via Fernando Alonso wins Le Mans 24 with Toyota – BBC Sport

Even though Toyota were effectively unopposed, I was still nervous for them. It’s still not an easy thing to make a car take that punishment.

I am pleased for the Toyota team and that Alonso can try for the ‘Tripple Crown’ with a win in Indy 500.

A New Era of Frankensoftware Is Upon Us | WIRED

… Big-name device makers are looking closely at the technologies running on their most successful hardware offerings and finding ways to incorporate that magic into the rest of their products. The shift is driven partly by the popularity of mobile apps and touchscreens, industry insiders say, but also by emerging technologies like voice assistants.

via A New Era of Frankensoftware Is Upon Us | WIRED

The Wired article covers more of a voice assistant, multi-platform, multi-experience slant.

Desktop OS Reshuffle

Personally, I find it interesting that this platform shuffle is going on in desktop OS right now:

  • Windows 10 adding PWAs – Windows already bridged desktop and mobile. The web is joining in.
  • Mac OS bringing iOS app and PWA support – web and mobile joining a desktop environment.
  • Chrome OS adding Android apps  – Web based OS getting mobile native apps, with linux desktop support incoming also.

Whats pleasing to me is the web is taking a more seamless role to all the desktop OSes. Web and native apps are merging and co-mingling.

I’m sure there will be some missteps in how this multiplatform existence merges under a desktop OS.

But from now on, most every connected thing you buy is going to have a little bit of something else in it. And once the companies making those things figure out a way to make these interactions effortless, it won’t seem like such a bad thing.

Instilling the notion in users, of tasks = apps, means that apps can be recombined under any platform and experience you like. Apps will remain constant no matter what the OS, how they interact will be crucial.