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

Change maximum/minimum/step values of a numeric characteristic? #123

Open
vickash opened this issue Jun 17, 2023 · 2 comments
Open

Change maximum/minimum/step values of a numeric characteristic? #123

vickash opened this issue Jun 17, 2023 · 2 comments

Comments

@vickash
Copy link

vickash commented Jun 17, 2023

I'm implementing a split AC unit with no heater, starting from the included heater/cooler example. Removing the unneeded characteristics from the ServiceFactory call works fine, and I can prevent the "Heat" option from showing up with the following code, inserted just after it:

heater_cooler.characteristics.each do |c|
  if c.name == :target_heater_cooler_state
    c.constraints["ValidValues"].delete("1")
  end
end

I also want to limit the temperature between 17 and 31C in 1C steps, but the same strategy doesn't work there:

heater_cooler.characteristics.each do |c|
  if c.name == :cooling_threshold_temperature
    c.constraints["MaximumValue"] = 31
    c.constraints["MinimumValue"] = 17
    c.constraints["StepValue"] = 1
  end
end

The slider on my phone still shows 10 to 35C in 0.5C steps. Any ideas? Thanks.

@karlentwistle
Copy link
Owner

karlentwistle commented Jul 17, 2023

Thanks for writing this issue @vickash. I'm so sorry for my late response. I realised RubyHome needs to include part of the HomeKit Accessory Protocol to expose this behaviour. I have a WIP PR #126, but I want to add some automated tests before merging it.

Hopefully, this will resolve your issue.

@vickash
Copy link
Author

vickash commented Jul 17, 2023

Excellent. Thanks. I'll give it a try once you're done.

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