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

Getting Started? #167

Open
davemen opened this issue Feb 14, 2025 · 3 comments
Open

Getting Started? #167

davemen opened this issue Feb 14, 2025 · 3 comments

Comments

@davemen
Copy link

davemen commented Feb 14, 2025

First, let me say. Wow! This is AWESOME. Exactly what I need.

I'm hoping someone here maybe Bouke Haarsma can provide an example of how to respond to an event when a light gets switched on/off or whatever.

I can't seem to figure out where to put the code for event handling.

help?

@Diggory
Copy link

Diggory commented Feb 14, 2025

There is a Delegate protocol for Accessory.

So, if one of your types conforms to that protocol, you can set it as a delegate of an accessory.

Then implement characteristic(_ characteristic: GenericCharacteristic<T>, ofService: Service, ofAccessory: Accessory, didChangeValue: T?) { }

Which will be called when a characteristic changes on that accessory.

@davemen
Copy link
Author

davemen commented Feb 14, 2025 via email

@davemen
Copy link
Author

davemen commented Feb 15, 2025

This project is helpful to get you going too: https://github.com/Bouke/My-Home/tree/master/Sources

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