8000 Hue crate changes needed for implementing wake-up automation by duvholt · Pull Request #133 · chrivers/bifrost · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Hue crate changes needed for implementing wake-up automation #133

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

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

duvholt
Copy link
Contributor
@duvholt duvholt commented May 8, 2025

This is a rebased version of #113 with only the hue crate changes. Hopefully this makes it easier to merge 😄

self.configuration = value;
}
Err(err) => {
// todo: what do we do here?
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know how to handle this error properly. I don't think it's possible to return errors from AddAssign and the log crate is not available (which makes sense since this is just a library).

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, yes, good point.

I think the answer is to make BehaviorInstanceUpdate.configuration an Option<Value>, so the assignment becomes trivial.

So instead of decoding when we receive the update, we decode when we want to look at the data.

If we need to attempt a decode, we can easily do this in the route handler, without preventing the AddAssign from working 👍

Makes sense, or did I misunderstand?

const RESOLUTION_05S: u32 = 5; // 05s.
const RESOLUTION_15S: u32 = 15; // 15s.
const RESOLUTION_01M: u32 = 60; // 01min.
const RESOLUTION_05M: u32 = 5 * 600; // 05min.
Copy link
Owner
@chrivers chrivers May 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It says 05min, but looks more like 50 minutes - typo or edge case?

@@ -0,0 +1,78 @@
use crate::{error::HueResult};

#[derive(PartialEq, Eq, Debug)]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please derive Clone and Copy

(Clone for all hue api structs, and Copy for the ones that are "free")

@chrivers
Copy link
Owner
chrivers commented May 9, 2025

Thanks for coming back for round 3! :)

This is looking great! Absolutely minor stuff, easily fixed.

Then we can get this half merged, and that will make everything easier 👍

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

Successfully merging this pull request may close these issues.

2 participants
0