UI customizable timer

Hello!
My mom would like to turn on and off by timer some devices. So I need now to make it doable from UI.
I know how to do half of that - input boolean to choose time. But I do not know how to choose entity from UI (ios app). Is there a nice way to do that?
Seems that it is pretty simple
Have a good day :slight_smile:

I guess you could you use an input_select to chose between the entities and then som automation to save the configured on/off time.

I would probably go for two input_datetime (on/off) and an input_boolean (manual/auto) per light.

Not at my HA instance so don’t want to provide any example code since I can’t check it :stuck_out_tongue: (can fix later if you want me to).

I will play with that and try to make it work. Maybe will need some more help with examples, so I will write. Thank you

Maybe this topic could be of some help Manual timer in frontend

Hi
Getting a little bit trouble with automation. I used input_select and input_datetime (on and off) but do not know how to create automations.

input_select:
  plugs:
    name: Plug timer
    options:
      - "Курица"
      - "Утюг"

input_datetime:
  timer_start:
    name: "Включить"
    has_date: true
    has_time: true
  timer_stop:
    name: "Выключить"
    has_date: true
    has_time: true

Can not find here the way to make it a trigger.
Here is it in UI

Would be nice to see some examples.

Check this thread Trigger an Action on Specific Date & Time

Actually they end up using 9:00 as a trigger and then date_time as a condition. That is not what I need
I want to set first date_time to turn device on and set second date_time for turning that device off

There is an example of using input_datetime as a trigger in the input_datetime documentation https://www.home-assistant.io/components/input_datetime/

I hope that helps :grin:

I got working the trigger and now struggling with action. I have more than 1 device, so I need in some way to write “if input_select is “one” - do one thing; if input_select is “two” - do another thing…”
How can I write that? It should be doable with templates?

I guess you should be able to do something like

data_template: >-
  {% if states.input_select.xxx.state == 'one' %}
    entity_id: switch.a
  {% elif states.input_select.xxx.state == 'two' %}
    entity_id: switch.b
  {% endif %}

The template editor under developer tools in the menu is a great resource to figure out templates.

1 Like

Thank you
Finally got it working

  action:
  - service: switch.turn_on
    data_template: 
      entity_id: >-
        {% if states.input_select.plugs.state == 'Утюг' %}
          switch.neo_coolcam_unknown_type_0003_id_2087_switch_2
        {% elif states.input_select.plugs.state == 'Курица' %}
          switch.neo_coolcam_unknown_type_0003_id_2087_switch_3
        {% endif %}

Your example did not want to work in automation but it did in template editor

Sweet! :+1: that you post the solution so others might find it :slight_smile:

:slight_smile: Thank you for help and finding the way again