colinbendell / homebridge-blink-for-home

Blink For Home Camera Homebridge plugin
MIT License
88 stars 27 forks source link

Blink Mini enabled/disabled fix #68

Closed mccabemj closed 2 years ago

mccabemj commented 3 years ago

Fixes #30

After inspecting the traffic when enabling the Blink mini devices, I noticed it had a completely different API route than the others. Turns out it's the same endpoint as the one used in a function that already exists updateOwlSettings.

Passing in { enabled: true/false } as the body, instead of a different endpoint for each.

I debugged the plugin and all works as expected, but as I haven't spent any time in the codebase, let me know if there is an easier way to get the model in blink-api without having to pass it around.

colinbendell commented 3 years ago

Fantastic! I'm going to do a little refactoring on this - specifically to move the model detection up a level. I try to keep the -api layer agnostic of business logic and force the business layer to make the distinction.

mccabemj commented 3 years ago

@colinbendell fair point. I have removed the logic from the blink-api file and put it in a ternary inside the blink file.

I also created a function to check for blink mini cameras as its around the place as a string check. It also allows for more code names if they come out with further wired cameras to work the same.

mccabemj commented 3 years ago

@colinbendell any chance you could take a look (either test and approve or modify). Would be good to get this live as the plug-in doesn't work for Mini cameras

colinbendell commented 3 years ago

Thanks! I'll push to merge it this week.

mccabemj commented 3 years ago

Any news on whether this is going to be merged this week? Would like this in ASAP really. Happy to help contribute

mccabemj commented 2 years ago

Hi. Been a couple of months now. Any chance this can be merged and a new release?