Edit yaml through lovelace?

Here is a sample switch package (just tweek the switch entities and make the other variables uses unique and you can copy this for each switch (or blind in your case).

input_boolean:
  ib_switch_a2_timer_enable:
    name: Timer Enable
    #initial: on
    icon: mdi:timer
  ib_switch_a2_timeslot1_enable:
    name: Time Slot 1 Enable
    #initial: on
    icon: mdi:clock-outline
  ib_switch_a2_timeslot2_enable:
    name: Time Slot 2 Enable
    #initial: on
    icon: mdi:clock-outline

input_number:
  in_switch_a2_timer:
    name: On Timer (mins)
    #initial: 30
    min: 1
    max: 360
    step: 1
    mode: box
    icon: mdi:alarm

input_datetime:
  id_switch_a2_tmeslt1_on:
    name: Time Slot 1 On Time
    has_time: true
    #initial: '09:00:00'
    icon: mdi:clock-start
  id_switch_a2_tmeslt1_off:
    name: Time Slot 1 Off Time
    has_time: true
    #initial: '10:00:00'
    icon: mdi:clock-end
  id_switch_a2_tmeslt2_on:
    name: Time Slot 2 On Time
    has_time: true
    #initial: '18:00:00'
    icon: mdi:clock-start
  id_switch_a2_tmeslt2_off:
    name: Time Slot 2 Off Time
    has_time: true
    #initial: '19:00:00'
    icon: mdi:clock-end
    
automation:
    #name: Switch A2 Off Delay
  - alias: au_switch_a2_offdelay
    trigger:
      - platform: state
        entity_id: switch.switch_aeon_labs_dsc06106_02
        to: 'on'
    condition:
      - condition: state
        entity_id: input_boolean.ib_switch_a2_timer_enable
        state: 'on'
    action:
      - service: script.turn_off
        entity_id: script.sc_switch_a2_timer
      - service: script.sc_switch_a2_timer
    #radio button (toggle) timer to time slot
  - alias: au_switch_a2_radiob_tmr_to_slot
    trigger:
      - platform: state
        entity_id: input_boolean.ib_switch_a2_timer_enable
        to: 'on'
    action:
      - service: input_boolean.turn_off
        entity_id: input_boolean.ib_switch_a2_timeslot1_enable
    #radio button (toggle) time slot to timer
  - alias: au_switch_a2_radiob_slot_to_tmr
    trigger:
      - platform: state
        entity_id: input_boolean.ib_switch_a2_timeslot1_enable
        to: 'on'
    action:
      - service: input_boolean.turn_off
        entity_id: input_boolean.ib_switch_a2_timer_enable
    #turning off timer enable cancels timer
  - alias: au_switch_a2_cancel_tmr
    trigger:
      - platform: state
        entity_id: input_boolean.ib_switch_a2_timer_enable
        to: 'off'
    action:
      - service: script.turn_off
        entity_id: script.sc_switch_a2_timer
    #time slot 1 on
  - alias: au_switch_a2_ontime1
    trigger:
      - platform: template
        value_template: '{{ states("sensor.time") == states("input_datetime.id_switch_a2_tmeslt1_on") [0:5] }}'
    condition:
      - condition: state
        entity_id: input_boolean.ib_switch_a2_timeslot1_enable
        state: 'on'
    action:
      - service: switch.turn_on
        entity_id: switch.switch_aeon_labs_dsc06106_02
    #time slot 1 off
  - alias: au_switch_a2_offtime1
    trigger:
      - platform: template
        value_template: '{{ states("sensor.time") == states("input_datetime.id_switch_a2_tmeslt1_off") [0:5] }}'
    condition:
      - condition: state
        entity_id: input_boolean.ib_switch_a2_timeslot1_enable
        state: 'on'
    action:
      - service: switch.turn_off
        entity_id: switch.switch_aeon_labs_dsc06106_02
    #time slot 2 on
  - alias: au_switch_a2_ontime2
    trigger:
      - platform: template
        value_template: '{{ states("sensor.time") == states("input_datetime.id_switch_a2_tmeslt2_on") [0:5] }}'
    condition:
      - condition: state
        entity_id: input_boolean.ib_switch_a2_timeslot2_enable
        state: 'on'
    action:
      - service: switch.turn_on
        entity_id: switch.switch_aeon_labs_dsc06106_02
    #time slot 2 off
  - alias: au_switch_a2_offtime2
    trigger:
      - platform: template
        value_template: '{{ states("sensor.time") == states("input_datetime.id_switch_a2_tmeslt2_off") [0:5] }}'
    condition:
      - condition: state
        entity_id: input_boolean.ib_switch_a2_timeslot2_enable
        state: 'on'
    action:
      - service: switch.turn_off
        entity_id: switch.switch_aeon_labs_dsc06106_02
    #name: Switch A2 Off Cancels Timer
  - alias: au_switch_a2_offcancelstimer
    trigger:
      - platform: state
        entity_id: switch.switch_aeon_labs_dsc06106_02
        to: 'off'
    action:
      - service: script.turn_off
        entity_id: script.sc_switch_a2_timer

script:
  sc_switch_a2_timer:
    alias: Switch A2 Timer Script
    sequence:
    - delay: '00:{{ states("input_number.in_switch_a2_timer") | int }}:00'
    - service: switch.turn_off
      entity_id: switch.switch_aeon_labs_dsc06106_02

Note: No ‘Initial’ values so that they will retain current settings through reboots if you find settings you like.

And here is the lovelace yaml that goes with it

      - type: entities
        title: Switch A2 - Unallocated
        show_header_toggle: false
        entities:
        - entity: switch.switch_aeon_labs_dsc06106_02
        - entity: input_boolean.ib_switch_a2_timer_enable
        - entity: input_number.in_switch_a2_timer
        - entity: input_boolean.ib_switch_a2_timeslot1_enable
        - entity: input_datetime.id_switch_a2_tmeslt1_on
        - entity: input_datetime.id_switch_a2_tmeslt1_off
        - entity: input_boolean.ib_switch_a2_timeslot2_enable
        - entity: input_datetime.id_switch_a2_tmeslt2_on
        - entity: input_datetime.id_switch_a2_tmeslt2_off

1 Like

Thanks! This is really nice of you! I will take a closer look in the weekend. Took a look at the image-element card and I will try to implement this as well. Pedagogical design is very important I was told by the mrs😡
At least know I got some intelligence into our fans turning on max inflow when temp is lower outside than inside and outflow when temp inside is higher than outside. That was a good thing🤣

Sorry, in this context I’m assuming that you are the student and she is the master ???
What does she do for a living ?

She’s an airline captain and the meaning refers to that the HA design should be self teaching in itself aka no programming. I am doing my best but I have doubt about my capacity to perform to an acceptable standard regarding the requirements. :rofl: I may pull it off but may not live to enjoy it myself :ghost:

Join the club … You will often see a WAF acronym used here … Wife Approval Factor (yet to atain it myself)

‘Self teaching’ usually requires more lables, entities grouped together where they are used together (even if it means repeating entities for other groupings) all this consume screen space … !
Good Luck with that ; - )))))

WAF… I love it🤣

Its always funny to read that we need the WAF here. We men think we wear the pants at home, but the wifes always wear the big pants

Amen to that.

Sounds like the solution is a new wife.

Nah, THAT sounds like a VERY expensive course of action …

Eh, might be worth it.

Yeah ! tell me that again when you are living on the streets, hiding from gangs of ravenous street thugs, using newspaper that you stole from a dumpster to line your shoes, provide some ‘separation’ from the skid marks in your underwear, extra insulation under your coat (if you’re lucky enough to have a coat) and to form a makeshift hat to keep the rain off.
All because you couldn’t keep up with payments for your wife and kids.
What ? … I’m being negative ??? … surely not !

Having said that I’ve met some women (and men for that matter, with the shoe on the other foot) where that would be preferable. That’s when I say … “She’s not sooooo bad !” and “Well, look what she has to put up with”

See ? the topic has to take an upturn from this ! : - )))))))))))))))))))))))))))))

This took quite the turn lmao

thanks for posting your example.

Hey!
Started my mission… but the automation to turn switch on is not working.
Checked the template editor and all times show up.

  trigger:
  - platform: template
    value_template: '"{{ states.sensor.time.state == states("input_datetime.timeswitch_light_evening_on")[0:5]
      }}"'
  condition: []
  action:
  - data:
      entity_id: switch.matsal, switch.vinkel, group.sw_ikea_matsal, group.sw_ikea_vardrum,
        group.sw_ikea_vardupp, switch.sw_gastrum, switch.telldus_tzwp_100_plug_in_switch_switch_2
    service: switch.turn_on

Somehow they trigger is not ok… manual trigger is working

Any thoughts?

SOLVED MYSELF
:crazy_face:
Wrong form on the template…
Correct below

  trigger:
  - platform: template
    value_template: "{{ states.sensor.time.state == states.input_datetime.timeswitch_light_evening_on.state[0:5] }}"
  condition: []
  action:
  - data:
      entity_id: switch.matsal, switch.vinkel, group.sw_ikea_matsal, group.sw_ikea_vardrum,
        group.sw_ikea_vardupp, switch.sw_gastrum, switch.telldus_tzwp_100_plug_in_switch_switch_2
    service: switch.turn_on

It’s always nicer when you solve it yourself, the lesson sticks in deeper that way ; - )))))))

1 Like

Love your positive attitude! :100:
Thank you so much for your inputs on the timer setup…
My WAF is increasing by 0.2 units :+1:

Do you have any clue how to implement the input_datetime inputfield in a picture-element?
Or can I include the entities card in the picture-element card?
Am I clear enough? :thinking:

You are 100% clear, but I can’t help.
I’ve only just moved over to lovelace, I have a new house (new to me that is) with a ‘lot’ of new kit installed and I’m busy just pulling automations and scripts together (that’s why my controls are just entity cards)
Making it look pretty is a project for next year (maybe) ; - P
Cheers

I hear you! Congrats on your new house!
I´ll post here if I find any progress.
Fell in :heart_eyes: with this layout that I found… by John Sollecito

https://community.home-assistant.io/t/picture-elements-custom-layout-card-interface/126132?u=onslope

Just stumbled into this thread and the wifey comments have pretty much made my night. The struggle is real.

2 Likes