HASwitchPlate / openHASP-custom-component

Home Assistant custom component for openHASP
https://www.openhasp.com
MIT License
49 stars 9 forks source link

Wrapper service for any command #51

Closed nagyrobi closed 3 years ago

nagyrobi commented 3 years ago

Solution for https://github.com/HASwitchPlate/openHASP-custom-component/issues/50.

nagyrobi commented 3 years ago

See in examples Set Long idle time. Any other setting applies like this, like GPIO templates etc (see submodules).

dgomes commented 3 years ago

"Set long idle time" is an example of something prone to create problems... maybe we should revise that command altogether...

Commands should really be a list of keywords not json objects...

nagyrobi commented 3 years ago

What do you mean? Several commands require json formatted lines as parameters. jsonl is the strongest example. "Set long idle time" is just similar to that, but on other (settings) topic.

We need to set idle time 2 times a day, as we don't want the screen to go completely off, just during the night. So during the day the idle2 time is 0, while during the night it's 120. (it's in the example automations, I'd like to make a blueprint instead, to simplify it)

dgomes commented 3 years ago

json objects in parameters is absolutely fine, my issue is with keyword

nagyrobi commented 3 years ago

Let's make the keyword optional? So the user can go with parameters only without keyword, when using settings topic?

dgomes commented 3 years ago

I say, lets remove the keyword and make the topic always */command

nagyrobi commented 3 years ago

But then, how to modify setting? That was the most important point...

dgomes commented 3 years ago

lets have a "config" service, but lets discuss that with @fvanroie

nagyrobi commented 3 years ago

I can submit a PR of course for a separate service.

I thought that you were more concerned about having too many services as HA admins don't like that on long term. My goal was to have an all-in-one service, which was intended for more advanced use...

dgomes commented 3 years ago

If we drop the existing services (change page, etc) in the long run we will not have more then 2 services

It is also important that we create services that can have their parameters sanitised, too much flexibility means we can't check the user input for mistakes...