Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simulator #1

Open
gedw99 opened this issue Nov 24, 2022 · 4 comments
Open

simulator #1

gedw99 opened this issue Nov 24, 2022 · 4 comments

Comments

@gedw99
Copy link

gedw99 commented Nov 24, 2022

nice system.

Would be good if there is a way down in the https://github.com/hkontrol/hkontroller to create fake Apple Home devices.
would make testing easier.

https://github.com/hkontrol/hkontroller/blob/main/controller.go#L175 could have a SetDevices and use the memory store.

Even better would be to just allow a mocking of the StartDiscovering() func at https://github.com/hkontrol/hkontroller/blob/main/controller.go#L70.

Another way would be to have a config file that could then be used for running different testing scenarios. The controller.go could then ask for this config, wire up the fake Devices with a fake DNS, and the StartDiscovering() would see them. With this approach its possible to inject fake devices from the bottom of the system.

https://github.com/brutella/dnssd#create-a-mdns-responder looks like it already has this feature too. We just have to use it.

@shabunin
Copy link
Member

hello,

currently I use homebridge-dummy and homebridge-dummy-thermostat packages to emulate accessories.
https://github.com/brutella/hap allows to create fake accessories as well.

I doubt that faking mdnssd is worth it.
https://github.com/brutella/dnssd#create-a-mdns-responder is not mocking, it's a responder on a real network interface.

So I would emulate accessories with brutella/hap.

@gedw99
Copy link
Author

gedw99 commented Nov 24, 2022

Ah dummy looks perfect . Did not know that already existed .

Could you possible add a basic example in readme or whatever makes sense . To show how to inject dummy hardware

@shabunin
Copy link
Member

@gedw99
Copy link
Author

gedw99 commented Nov 24, 2022

Thanks . Will pick it up tomorrow. Thanks for helping me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants