pantherale0 / ha-nintendoparentalcontrols

Home Assistant integration for Nintendo Switch Parental Controls
MIT License
81 stars 7 forks source link

FR: Use number entities for time limits / bonus entities #84

Closed drobtravels closed 6 months ago

drobtravels commented 7 months ago

Checklist

Is your feature request related to a problem? Please describe.

First of all, thanks so much for making this integration! It's been useful.

I find the time entities clunky to interact with in the UI and confusing to set. For example the UI displays 12:00am for 0, and 2:00am for 2 hours.

It is also difficult to automate changes via the time.set_value service, since I believe this requires requires the HH:MM format.

Describe the solution you'd like

I propose number entities with the duration of time limit in minutes and bonus time.

This would allow sliders in the UI to slide from 0 to 120 minutes, and in my opinion, be more intuitive to interact. It would also simplify automations without complex templating.

I understand this would be a breaking change however.

Describe alternatives you've considered

I have started creating input_number helpers for the UI with automations to call time.set_value when changed, and update input_number when time changes.

I'm struggling to convert minutes to the correct format in a template, however. For example 120 minutes would require a time value of 2:00 or 02:00.

Additional context

Thanks so much

drobtravels commented 7 months ago

I did figure out the right formatting to call time.set_value with the following template: {{ (120|int*60)|timestamp_custom('%H:%M', false) }}

drobtravels commented 7 months ago

BTW, I'm happy to make a PR but wanted to check in for guidance first since this would be a major change.

pantherale0 commented 7 months ago

Hi,

I have made a start on this and have a working version, trying to add an experimental option at the moment to enable / disable "untested" features (#76 #83).

Just been busy with work lately.

pantherale0 commented 7 months ago

New update to be released soon:

image