Linked Browser Based Editor for Scripts and Automations

I know this is going to be controversial.
I have spent the last 2 days trying to write an automation that triggers on a change of input_select and actions the assigning of a value to an input_number. The code examples for trigger are inconsistent as are the ones for condition and action.
Given that some people use directory include then this may require the use of a header line similar to a bash or python script #automation or #script or similar just so the editor knows what it is looking at.
Here is an example of the code I wanted to write (the uncommented bits) :-

- id: light_tod_set_mstr_br1 # WOT
  alias: Set Master Brightness On ToD1
  trigger:
    plateform: state
    entity_id: input_select.slct_light_tod
    to: 'Night'
  # trigger: # taken from :- https://home-assistant.io/cookbook/perform_actions_based_on_input_select/
    # platform: state # ditto
    # entity_id: input_select.lullaby # ditto
    # to: "Rain" # ditto, have tried Night, 'Night' and "Night" (values are Night, Day, Dusk)
  action:
    - service: input_number.set_value
      data:
        entity_id: input_number.num_light_mstr_value
        value: 64
  # action: # taken from :- https://home-assistant.io/components/input_number/
    # service: input_number.set_value # ditto
    # data_template: # ditto, okay it's not a template so just replace with data: ???
      # entity_id: input_number.target_temp # ditto, tried this, tried placing above data: with less indent
      # value: '{{ trigger.payload}}' # ditto, as data: used just number 64, also tried '64' and "64"

The errors I was getting in the log were baffling and not helpful.
So I made a copy of my automations.yaml file expecting it to be destroyed when using the automation editor (it was)
So I emptied the file and started again (clean sheet)
I placed the trigger - okay
I went to place the action and stated the service was input_number.set_value
The next thing that I had to fill in was service data - Whatā€™s that ???
I tried to set an entity_Id - no go
Okay do I set a value and then it asks for the entity then ? - no

This is what the automation editor produced and to be honest I canā€™t make head nor tail of it

- action:
  - service: input_number.set_value
  alias: Set Master Brightness On ToD1
  condition: []
  id: '1513271551107'
  trigger:
  - entity_id: input_select.slct_light_tod
    platform: state
    to: Night

Okay, so the ref is ā€˜1513271551107ā€™, but why does the action come first at to level ?
The trigger seems fine but ā€¦

So what I was thinking is that you canā€™t enter anything direct, just pick elements as you go.
Select Insert point
Insert - (top level so only New Automation or Comment available)
Okay you picked automation - What to you want to ref (id) it as ? and whatā€™s its alias ?
Okay Now you have to have a Trigger so thatā€™s a given (all appropriately indented)
So what platform ?
etc. etc.
Iā€™m not saying itā€™s an easy thing to do, but look at all the issues with newbies (Iā€™m one) and code, spacing, formatting and syntax And that is fundamental to getting anything done and how much of this forum is going over these basics ?
How many times have you seen leading dashes, oh and it appears you can leave them out sometimes (well at least the parser doesnā€™t complain)

The following is a direct ā€˜copyā€™ from the HA documentation website :-

  trigger:
    platform: sun
    event: sunset
  action:
    service: light.turn_on
    entity_id:
      - light.kitchen
      - light.living_room
    data:
      brightness: 150
      rgb_color: [255, 0, 0]

So it seems that once you state a service, you can merely list the affected entities and then shove the required change and that will have it apply to ALL of them ā€¦ So how come then next bit of code does not work ? (yes, I know itā€™s a script)

scr_turnofftodbool:
sequence:
- service: input_boolean.turn_off
entities:
input_boolean.boo_light_night
input_boolean.boo_light_day
input_boolean.boo_light_dusk

I just think if the appropriate lego blocks are fed people in the right order, then they will have a better chance.
Let us know what you think, though this probably more to the less experienced end of the scale ; - ))) (me)

Mutt

Hey ! Look what I found when trawling today.
It only got 1 vote too, And that was me
(for info to : @Burningstone , @tom_l )

All I can say is ā€¦ Sorry !
:sob:

Edit: Iā€™ve just read it properly and I want to scream ā€œformattingā€ at the poster ! What an idiot !

1 Like