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

Alert Functionality #32

Closed
fk0ff92 opened this issue Jan 27, 2021 · 10 comments
Closed

Alert Functionality #32

fk0ff92 opened this issue Jan 27, 2021 · 10 comments
Assignees

Comments

@fk0ff92
Copy link

fk0ff92 commented Jan 27, 2021

Hey, first of all, thanks for this good work, I love your API. Hope I have not overlooked anything and do not annoy. I really need the alert functionality and don't want to emulate it. The original Hue app would have to understand alerts.

@ZeroOne3010
Copy link
Owner

Cool, thanks for your message! The library has been developed based on my own needs, and until now I have not needed alerts, so it's not there yet. It's a good idea, though! I'll have to see how it would work out. 🤔 Would you happen to have any ideas or suggestions on how the alert system should work in this library?

@fk0ff92
Copy link
Author

fk0ff92 commented Jan 28, 2021

Cool, I'm really glad you're interested and open to new features. In various implementations and also in the original API I have found hints that there must also be an "alert" in the state. The options for this are select (blink once) and lselect(blink ten times). The most sensible way would be to include it either via the state builder. Or you can wrap it and apply it to lights and rooms (groups). I also noticed that you work a lot with rooms, but a light group is hard to access. If you are interested to talk about more ideas let me know.

@fk0ff92
Copy link
Author

fk0ff92 commented Jan 28, 2021

By the way, I use your implementation to implement a kind of Hue Disco. It is not necessary to implement it myself, because there are already many apps but I wanted to do it with a real beat detector and in real time on a raspberry pi. For me it's actually a bit cumbersome to use your builder, even if it's really super easy to use.I had to wrap your lights and your rooms unfortunately, because they are final and you don't allow any further implementations or inheritances. In my wrapper I built many methods that make the lights blink or flash. I was thinking about just developing your code further, but then I'm afraid that I can migrate updates from you only with difficulty.

@ZeroOne3010
Copy link
Owner

Cumbersome, huh? Well, that's obviously not too good... I'd love to take a look at your code, if you wouldn't mind uploading it to GitHub? 😃

Also, having now taken a look at the official docs, I would tend to agree that the state builder would be the best place to put the alert functionality into. 👍

I'm not sure what you mean by saying that a light group is hard to access. What kind of a light group are we talking about? The library does support zones with the getZones() and getZoneByName(String) methods. They are completely analogous to the getRooms() and getRoomByName(String) methods.

@ZeroOne3010 ZeroOne3010 self-assigned this Jan 29, 2021
@fk0ff92
Copy link
Author

fk0ff92 commented Jan 29, 2021

I lack a bit of confidence to share my code with you without comment, because I'm still a student and just started actively programming java a few weeks ago. I had some help from my colleague who gave me code reviews. My code at the moment consists mainly of adding the general beat detector (https://github.com/generic-beat-detector/GBD). It was a lot of work to configure a raspberry pi with a microphone connected so that the general beat detector has something to analyze. I'm proud of the progress though, because now i get the "kick events" in real time, so i can react to every bass kick with a lamp reaction. Your used work can be found under functionalLight. This part of the implementation is as I said not very advanced yet, because I'm always thinking about how to access the lights and if and how to wrap them. I would like to have the functional light also as a functinal room, because some commands would be good if they would be executed synchronously by the whole room. I have shared the repository privately with you. Thanks for you input.

@fk0ff92
Copy link
Author

fk0ff92 commented Jan 29, 2021

Probably I have then selected exactly the group type, which is not so implemented. I have a group in Hue called Alarm, which is neither a Zone nor a Room, but a Light group. The only way to get to it is this way.

hue.getGroupsOfType(GroupType.LIGHT_GROUP).stream().map(x-> x.getName() == "Alarm").findFirst()

@ZeroOne3010
Copy link
Owner

Hey, thanks for sharing! The code looks very nice, nothing to be ashamed of there! ☺️

FunctionalLight looks like a sensible class. It follows the composition over inheritance principle. I can see your frustration with the transition time, your idea of .on(int) and .off(int) could be worth including with the library itself.

I certainly welcome new ideas, so keep them coming!

ZeroOne3010 added a commit that referenced this issue Feb 5, 2021
@ZeroOne3010
Copy link
Owner

@fk0ff92 Hey, I just finished the alerting feature. I wonder if you might want to take a look at it before I merge it to master..? It's in pull request #33.

@ZeroOne3010
Copy link
Owner

Alerts have been merged to master.

@ZeroOne3010
Copy link
Owner

Alert functionality has been releases in version 2.1.0. Enjoy!

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