Skip to content
This repository has been archived by the owner on May 12, 2022. It is now read-only.

Releases: lwsrbrts/PoSHue

PoSHue 2.2.0

20 Mar 11:03
Compare
Choose a tag to compare

Bringing in initial support for the Scenes API.

Please obtain the release from the PowerShell Gallery.

https://www.powershellgallery.com/packages/PoSHue/2.2.0

PoSHue 2.1.1 - Control Philips Hue with PowerShell

05 Apr 15:49
Compare
Choose a tag to compare

What's New

  • New methods for refreshing Remote API access tokens from within the module.
    • RefreshAccessToken([string] $ExistingExpiredAccessToken, [string] $ExistingValidRefreshToken, [int] $ExpiryUnixTimeStamp) - takes an existing (expired) access token, a valid refresh token and expiration date (as a unix timestamp) and, assuming the tokens are valid, obtains a new set of access and refresh tokens. Assigns them in the instantiated object and outputs JSON, which can be used to record the token data elsewhere (file, DB, NoSQL, Azure Automation Variable etc.)
    • [HueFactory]::RefreshAccessToken([string] $ExistingExpiredAccessToken, [string] $ExistingValidRefreshToken, [int] $ExpiryUnixTimeStamp, [bool] $Static) - this is a static method on the [HueFactory] class which allows you to refresh a token without instantiating an object first. It returns ONLY a JSON object, which you should store as you require. This would be used in instances where you cannot instantiate an object because the token has expired.
    • ExportAccessTokenToJson() - exports access, refresh and expiration timestamp from an instantiated object. If the properties are not set, the JSON object will be incomplete - obviously - so this should really only be needed after a successful token refresh and if required as there are other methods of extracting the information from the properties of course.
  • New properties (to support the above) have been defined on the [HueFactory] class. These properties are thus inherited by all other classes which extend the [HueFactory] class. The properties are:
    • [string] $RemoteApiAccessToken
    • [string] $RemoteApiRefreshToken
    • [int] $RemoteApiAccessTokenExpiryDate

Please note that monitoring for expired tokens and auto-refreshing them is not implemented in any of the classes. You should use try catch blocks to monitor for expired tokens and act on them accordingly.

PoSHue 2.0.5 - Control Philips Hue with PowerShell

03 Apr 12:31
Compare
Choose a tag to compare

What's new

  • Compatibility fixes with deconz (Thanks @tbyehl)
  • New GetAllLightsObject($Object) method which returns a psobject with all HueLight objects within (Thanks @tbyehl)
  • Minor code changes such as casing, spaces etc.

Remote API token lifetime

The remote API functionality is severely hobbled by the very short access token lifetime of 7 days provided by Philips. Unfortunately the refresh token feature of the open source toolset I'm using to generate tokens doesn't seem to work so getting new access tokens by using a refresh token is currently impossible. I am working on this but if anyone knows anything about The PHP League's Oauth Client and how to customise it to provide new access tokens, I'm all ears.

PoSHue 2.0.4 - Control Philips Hue with PowerShell

19 Mar 23:42
Compare
Choose a tag to compare
  • Allow instantiation of a Group object without a group name (so one can be created) via the Remote API.
  • New method (GetRemoteApiUsage()) to get Remote API usage in HueFactory (making it inherited by all sub-classes).
  • Code improvements to reduce repetition.

PoSHue 2.0.3 - Control Philips Hue with PowerShell

16 Mar 16:00
Compare
Choose a tag to compare
  • Bugfix: Wrong method used on SwitchHueSensorState method (used Get instead of Put) - causing an error response when attempting to change the state of a sensor.

PoSHue 2.0.2 - Control Philips Hue with PowerShell

16 Mar 10:22
Compare
Choose a tag to compare

PoSHue 2.0.2 - Control Philips Hue with PowerShell

Remote API Support

A lot of work has gone in to the process of being able to use the Remote API with PoSHue and includes some code improvements.

Unfortunately Philips' Remote API is designed to use Oauth authentication with a web application. The limitations of the implementation mean that it's necessary to register an application with Philips, it be approved and then I am assigned an application ID and a secret. It's this secret that causes a problem since it's not secret if it's sitting in plain text in a PowerShell module's resources and used to produce access tokens.

As a result I've had to extend on to the web as minimally as was possible and created a web application that allows me to request authorisation from users to generate an access token that can be used by owners of Hue bridges with the Philips Hue Remote API. The web application is merely a method of me keeping my application's secret a secret but still allowing users to generate their own access token.

Once users have gone through the process, they can use the access token to control their lights, groups and sensors with the module. Use of the access token is counted as a request by the PoSHue module and there's an API limit of 5000 hits per day - it's not clear if this is per access token (probably not) or for the entire application.

I didn't want to create a web application for the token generation but the use of the secret which is required to generate an access token has forced my hand.

PoSHue 1.2.5 - Control Philips Hue with PowerShell

05 Feb 19:34
Compare
Choose a tag to compare

Please download from the PowerShell Gallery to ensure you're getting the latest version. Included here so you know which is the latest version.

Update on PowerShell Core 6.0 Support

It's officially official that PowerShell Core 6.0 has been released. Having checked over the main functions with the classes, everything looks to be working well with PowerShell Core 6.0 and is still compatible with Windows PowerShell 5.1.

Raspberry Pi

I've also used the module on a Raspberry Pi 2 with PSCore 6.0 and I'm happy to report it's working well. This opens up a lot of options for me - not that they couldn't have been done using Python but having PowerShell capability on a Raspberry Pi is pretty great and I look forward to seeing GPIO support.

Changes

Nothing dramatic in this version, just a new method to turn a sensor on or off.

SwitchHueSensorState([bool] $State)

PoSHue 1.2.3 - PowerShell Hue Control

10 Oct 13:19
Compare
Choose a tag to compare

Please download from the PowerShell Gallery to ensure you're getting the latest version. Included here so you know which is the latest version.

PowerShell Core 6.0.0 Support

I've added a small change to the way the module loads an assembly it needs for use with the RGBtoXYZ functionality to improve compatibility with PowerShell Core 6.0. With PowerShell Core 6.0.0-beta8, .NET Core 2.0 is included and so is System.Drawing.dll so the module should now work on any platform that PowerShell Core 6.0 supports. I've tried it on Windows 10 and Ubuntu 14.04.5 LTS with success. Personally I'm waiting for full Raspberry Pi support - although PSCore 6 runs, some simple commands and Package Management doesn't work as expected. I'll keep trying though.

Bugfix

This version includes a pull request from @andreaswditze to resolve some small issues affecting lights I don't have and added a new property to work out if a light is reachable.

PoSHue 1.1.2 - PowerShell Hue Control

21 Jan 20:30
Compare
Choose a tag to compare
  • Updated to include Group and Room support with a new class called [HueGroup]
    • Create, edit and delete groups and rooms.
    • Set the state of a room or group on or off.
    • Set an entire room or group's brightness.
    • Set an entire room or group's hue, saturation and brightness.
    • Set an entire room or group's colour temperature and brightness.
    • Set an entire room or group's XY values and brightness.
  • Added a new overload for SetHueLight() that allows setting of just the brightness value.

PoSHue - PowerShell Hue Control

27 Apr 15:01
Compare
Choose a tag to compare
Module definition

Added the class to the PowerShell gallery and created a module manifest
for it. Finally got over the requirement to use Add-Type -AssemblyName
System.Drawing in every script by declaring a required assembly in the
definition.