dahlb / ha_hatch

Home Assistant Integration for Hatch Rest Mini
MIT License
77 stars 16 forks source link

Documentation request: How to call services for the light and media #33

Closed Intecpsp closed 3 months ago

Intecpsp commented 1 year ago

Could you update the documentation with examples of how to control the Hatch from Home Assistant? There are many media services that could be used, and each has its own parameters. Then with the light, I see lots of options as well. What services and values are able to be used?

Intecpsp commented 1 year ago

I had a thought today to pull the different values from the device when it was in different favorite states (Rest+ v1). After looking them over I think I have the correct services and values to manipulate. How does the below look?

Here are the values I've pulled so far for the basic colors (that we use) from the app:

I hope to add these services and possibly even the light values to the README for others to reference if/when they need to.

dvhub commented 3 months ago

I had a thought today to pull the different values from the device when it was in different favorite states (Rest+ v1). After looking them over I think I have the correct services and values to manipulate. How does the below look?

  • Media player: Select sound mode

    • Possible options here are: Stream, PinkNoise, Dryer, Ocean, Wind, Rain, Bird, Crickets, Brahms, Twinkle, RockABye
  • Media player: Set volume
  • Media player: Play
  • Media player: Stop
  • Light: Turn on

    • Possible values to modify:

    • brightness

    • hs_color

    • rgb_color

    • xy_color

  • Light: Turn off

Here are the values I've pulled so far for the basic colors (that we use) from the app:

  • Orange

    • hs_color: 25.767, 69.658
    • rgb_color: 234, 141, 71
    • xy_color: 0.547, 0.379
  • Dark blue

    • hs_color: 212.368, 67.556
    • rgb_color: 73, 143, 225
    • xy_color: 0.173, 0.197
  • Light blue

    • hs_color: 187.586, 80.93
    • rgb_color: 41, 193, 215
    • xy_color: 0.158, 0.301
  • Green

    • hs_color: 153.051, 56.19
    • rgb_color: 92, 210, 157
    • xy_color: 0.208, 0.441
  • Pink

    • hs_color: 330.811, 60.163
    • rgb_color: 246, 98, 170
    • xy_color: 0.476, 0.248

I hope to add these services and possibly even the light values to the README for others to reference if/when they need to.

How do I turn on the 'rainbow' light color that's supported by the Rest+? Do I need to use some sort of animation?

dahlb commented 3 months ago

@dvhub you can use an automation to cycle, the built in random function is currently not supported; though it is already available in the rest+ first gen python api interface so should be a simple enough thing to add, hard part would be finding a reasonable way to expose it through ha

I'm closing this as the Intecpsp answered their own question already

dvhub commented 3 months ago

@dvhub you can use an automation to cycle, the built in random function is currently not supported; though it is already available in the rest+ first gen python api interface so should be a simple enough thing to add, hard part would be finding a reasonable way to expose it through ha

I'm closing this as the Intecpsp answered their own question already

I don't mind hacking my local ha_hatch python code to get it working for me, but I see in the hatch_rest_api that rest_plus.set_color assumes that c.R (random) is False. How do you suggest setting c.R to True?

I did some research and it looks like the 'correct' way to do this is with LightEntity effect_list and effect but I believe this would be a fairly substantial change. Would it be reasonable to expose 'random' light color as a service call as a way to expose it in HA?

dahlb commented 3 months ago

I've exposed things with service calls in past integrations and found most people can't handle them well.

Better to expose a simple SwitchEntity.

I exposed an optional param to set the random effect on set_color in hatch_rest_api 1.22.0

dvhub commented 3 months ago

I've exposed things with service calls in past integrations and found most people can't handle them well.

Better to expose a simple SwitchEntity.

I exposed an optional param to set the random effect on set_color in hatch_rest_api 1.22.0

That's great. Thank you very much!

YayC commented 2 months ago

Mind reopening this issue until usage is documented on the Readme @dahlb? I could create a quick PR based on @Intecpsp's comment if that helps but probably won't have time to independently test