klutchell / hue-bridge-backup

Backup and restore Philips Hue bridge configuration in raw JSON
MIT License
11 stars 4 forks source link

"method, PUT, not available for resource ..." #2

Open JJJ opened 5 years ago

JJJ commented 5 years ago

Hey there, I know this repo is no longer maintained, but figured I'd create this issue for anyone brave (or silly) enough (like me) to give it a try anyways.

This repo does a great job at backing everything up. See:

Screen Shot 2019-08-19 at 6 30 55 PM

Unfortunately, the Hue Bridge API does not appear to offer an endpoint for POSTing (creating) new lights, which is the very first step to restoring a Hue Bridge to later create groups, scenes, etc....

Speculating, but it seems that the only way to do a restore, is to:

I think this is because the Hue Bridge API works the way it does, and because the code in this repository expects to use the PUT action, which only works on existing resources (the POST action is used for creating new ones.)

I have a v2 Bridge that is failing intermittently, and have a new v2 switch. I was hoping this would be simpler, but the Hue Bridge API does not appear to make it so. The code in this repo goes a long way towards automating things, but I find myself stuck at step 0 for now. If I find any success later, I'll update this issue.

Thanks @klutchell for your efforts here 👍

klutchell commented 5 years ago

Nice investigation. I had a quick look at the code and the API to confirm your findings and you are correct. In fact, I must have already known this since I have test cases in test.js to confirm that PUT would fail for lights and groups.

   restore lights
myApp putting 1/2 lights to http://0.0.0.0:9000/api/newdeveloper/lights
sim 127.0.0.1 - - [21/Aug/2019:11:51:29 +0000] "PUT /api/newdeveloper/lights HTTP/1.1" 404 36 "-" "-"
myApp Cannot PUT /api/newdeveloper/lights
    ✓ simulator will reject PUT (393ms)
myApp 

  restore groups
myApp putting 1/1 groups to http://0.0.0.0:9000/api/newdeveloper/groups
sim 127.0.0.1 - - [21/Aug/2019:11:51:29 +0000] "PUT /api/newdeveloper/groups HTTP/1.1" 404 36 "-" "-"
myApp Cannot PUT /api/newdeveloper/groups
    ✓ simulator will reject PUT (392ms)
myApp 

If you come up with a workaround let me know. For now I'll append your restore steps to the readme in case anyone else is still trying to use this project.