itchannel / apex-ha

Local Neptune Apex HA Integration (Aquarium Controller)
GNU General Public License v3.0
19 stars 3 forks source link

Discussion: should Apex switches just be OFF/AUTO? #28

Open brettonw opened 1 year ago

brettonw commented 1 year ago

After working with this integration for a week, I find myself having set up a variety of switches where I used an input_boolean and an input_number in pairing to configure the value of an Apex device and then to implement a switch that toggles the Apex switch between OFF and AUTO (i.e. pretty much never ON), because this feels like the desired behavior.

For example, I added an input_boolean for the heater, which I turn OFF during feeding time (because the heater and the thermometer are in different tank chambers and the heater would just turn on and run during feeding time). When I turn the input_boolean on, it sets the Apex heater switch back to AUTO, which enables the temperature program on that switch.

Maybe each HA switch could be configurable whether it turns the Apex switch on, or to auto? Maybe create two switches in the integration? Maybe it's just not a switch?

FutureGUIs commented 1 year ago

yeah I think a select/dropdown would be more useful

itchannel commented 1 year ago

So I've been looking and going to try using a select entity as you guys mentioned https://developers.home-assistant.io/docs/core/entity/select

I'll try and draft up something this week, just in the Aussie outback at the moment so reception is limited 👍

I'll also leave the switches in place for now.

brettonw commented 1 year ago

yeah I think a select/dropdown would be more useful

I think this is true if you simply want to replace the Apex Fusion dashboard with a HA dashboard that functions exactly the same way, but I disagree in other cases. I want better functionality than Apex provides. My feeling is that the ON aspect of the Apex switches has no semantic usefulness to Home Assistant. Any abstraction other than OFF/AUTO (such as a dropdown/select) will require the user to build input_* helpers to get their intended use case.

In my proposal, if you really want OFF/ON functionality, you could set the Apex switch 'Control Type' to 'Always' and 'State' to 'On' in Apex Fusion, and then it really is just a binary switch (because setting that switch to AUTO on the apex will result in it being on).

On my HA dashboard, I want an OFF/ON switch for most of my devices, but that doesn't mean OFF/ON at the apex:

For these OFF/AUTO toggles, turning off the apex switch allows me to keep HA automations running, but have no affect. For instance, I have an automation that will turn on the return pump if it's been off for 10 minutes (feeding mode). But during a water change I don't want to turn the return pump back on in the middle of it. Since the return pump automation is only manipulating the pump speed variable, the switch between OFF/AUTO is similar to going into HA->settings->automations and turning off/on that HA automation.

brettonw commented 1 year ago

I'll try and draft up something this week, just in the Aussie outback at the moment so reception is limited 👍

No hurry - this is a hobby. Enjoy where you are. Will you be able to visit the Great Barrier Reef?

brettonw commented 1 year ago

FYI, I implemented this in my fork, and I've been very happy with the result.

https://github.com/brettonw/apex-ha

itchannel commented 1 year ago

I'm back so will take a look at all the issues and the suggested changes you've made and look at merging some bits in this week.

FutureGUIs commented 1 year ago

@brettonw Coming back to this, I'm definitely leaning to your view now that the controls should be 'OFF/Auto' because yeah, I want to override things from HA, but generally leave things in Auto mode on the Apex side since that has direct local control and the failsafes in place.

brettonw commented 1 year ago

@FutureGUIs I haven't submitted a pull request to this repos on my changes because I rewrote a lot of it to work the way I wanted and it's not backwards compatible with this integration. If you wanted to try it out, I'd be curious about feedback from my repos (linked above).