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
    plateform: state
    entity_id: input_select.slct_light_tod
    to: 'Night'
  # trigger: # taken from :-
    # platform: state # ditto
    # entity_id: input_select.lullaby # ditto
    # to: "Rain" # ditto, have tried Night, 'Night' and "Night" (values are Night, Day, Dusk)
    - service: input_number.set_value
        entity_id: input_number.num_light_mstr_value
        value: 64
  # action: # taken from :-
    # 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'
  - 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 :-

    platform: sun
    event: sunset
    service: light.turn_on
      - light.living_room
      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)

- service: input_boolean.turn_off

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)


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 !

Edit: I’ve just read it properly and I want to scream “formatting” at the poster ! What an idiot !

1 Like