homebridge-alexa-smarthome
homebridge-alexa-smarthome copied to clipboard
Filtering of devices based on Skill ID
Description
I have found that users of your plugin and mine ( homebridge-alexa) have gotten themselves into a bit of a device adding loop, where each of plugins discovers the devices from the other plugin and keeps adding them. Eventually triggering a meltdown of homebridge due to too many devices being created.
To resolve this I made the following changes.
1 - Added your plugin name as the manufacturer of the Homebridge Accessory, this is to allow homebridge-alexa to filter out accessories created by homebridge-alexa-smarthome. A corresponding change will be made to homebridge-alexa to filter devices coming from manufacturer homebridge-alexa-smarthome.
2 - Added filtering of devices retrieved from Amazon, based on the skill id. The internal skill identifier is a base 64 encoded value, which contains the amazon internal skill id ie {"skillId":"amzn1.ask.skill.2af008bb-2bb0-4bef-b131-e191f944a87e","stage":"live"}
3 - Added trapping of errors coming from homebridge, when too many devices are created. A single instance of homebridge is limited to 149 devices.
4 - Added a feature to expedite testing, npm run test-watch
. This is similar to npm run watch, except that it reruns jest on a code change.
PS This is a draft, take a look and send some feedback. It is also the first time I have encountered fp-ts
so I likely mangled things around it.
Type of change
- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] This change requires a documentation update
How Has This Been Tested?
Checklist:
- [ ] My code follows the style guidelines of this project
- [x] I have performed a self-review of my own code
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [x] New and existing unit tests pass locally with my changes