michielpost / Q42.HueApi

C# helper library to talk to the Philips Hue bridge
MIT License
411 stars 114 forks source link

URI fix for ModifySceneAsync #142

Closed Sleezly closed 6 years ago

Sleezly commented 6 years ago

Fixing the URI used by ModifySceneAsync to match documented API usage per section 4.3 here: https://developers.meethue.com/documentation/scenes-api#43_modify_scene

How Verified:

michielpost commented 6 years ago

What bridge version are you on? From the documentation: For modifying lightstates on 1.11 or higher use: /api/<username>/scenes/<id>/lightstates/<id>
For modifying lightstates on bridge versions lower than 1.11 use: /api/<username>/scenes/<id>/lights/<id>/state

This library targets the latest bridge firmware. So lightstates should be used.

But it does look like there is a bug in my original code: new Uri(String.Format("{0}scenes/{1}/lights/{1}/lightstate", ApiBase, sceneId, lightId) I think that should be: new Uri(String.Format("{0}scenes/{1}/lights/{2}/lightstate", ApiBase, sceneId, lightId)

Maybe that also fixes your issue?

michielpost commented 6 years ago

Ah I see you also found that and made issue https://github.com/Q42/Q42.HueApi/issues/141

I'll do some testing to see if it works on my bridge.

michielpost commented 6 years ago

The new url from this PR does work, it does not return an error. So it looks like the Hue documentation is out of date.

Thanks for the PR!

Sleezly commented 6 years ago

Thanks for taking the PR! I've updated the nuget package and confirmed the fix is good.