My first automation - FAIL

Hey guys, brand new to HA ( trying to test the water and move from SmartThings ). Ive got a bunch of devices added, a conbee and a chunk of integrations all added ok. Now trying to create a simple automation to turn on a Hue scene and a nanoleaf scene by the press of a SmartThings button.

Yea, ok maybe not the easiest place to start but I’m comfortable with the real basic automations :wink:

Using some suggestions in this thread for the Nanoleafs - which seem to work ok if I just run the code, but I cannot save the automation in the UI, get the message malformed error.

I kind of didnt really know what I was doing between the UI and the YAML file edits…I created a base automation in the UI. Then pasted the nanoleaf into the YAML in file editor, and the YAML then appeared in the UI and ive been going from there since. It just wont save due to the error.

What utter noob error am I making here ?

- id: '1648121970272'
  alias: Comp button long press
  description: ''
  trigger:
  - device_id: 3bad9b605dd12a3e3c6e0765f05c9e45
    domain: zha
    platform: device
    type: remote_button_long_press
    subtype: remote_button_long_press
  condition: []
  action:
  - service: scene.turn_on
    target:
      entity_id: scene.computer_room_cr_netflix
    metadata: {}
  - - service: light.turn_on
      data:
        entity_id: light.shapes_58c3
        brightness_pct: 30
        effect: 'Bed of Roses'
  mode: single

this doesn’t seem right:

    metadata: {}
  - - service: light.turn_on
      data:
1 Like

Any time you edit YAML you’ll need to do two things:

  1. Run a command line config check to check the YAML. This is probably going to be ha core check over SSH - but see the Common Tasks section of the docs.
  2. Reload the integration in question, or restart HA. In this case you’ll need to reload the automations once the config check passes.

There are two likely issues with your automation:

    metadata: {}

There’s no such option to scene.turn_on.

  - - service: light.turn_on
      data:

you’ve gained a - - likely through your use of the YAML editor for just that action.

1 Like

Thanks gus, still struggling though.

I stripped it all out and just built a basic automation for the hue portion in the UI. This then allowed me to save and created the entry in the YAML

  alias: Comp room button test
  description: ''
  trigger:
  - device_id: 3bad9b605dd12a3e3c6e0765f05c9e45
    domain: zha
    platform: device
    type: remote_button_long_press
    subtype: remote_button_long_press
  condition: []
  action:
  - service: scene.turn_on
    target:
      entity_id: scene.computer_room_blue_and_yellows
    metadata: {}
  - device_id: 58c4d07bba642a30c14f0c5b4622cc98
    domain: light
    entity_id: light.shapes_58c3
    type: brightness_increase
  mode: single

All i want to do is replace the brightness bit, or add the nanoleaf scene action. Which is this -

 - service: light.turn_on
      data:
        entity_id: light.shapes_58c3
        brightness_pct: 30
        effect: 'Bed of Roses'

As i cant seem to add this in the UI, is it just a case of pasting that additional code after the ‘type: brightness_increase’ line and before the ’ mode: single’ line ?

Or have i got this completely wrong ?

Ok ive sussed it…you can actually do it all in the UI now with Call service and input the Light Effect.

Ill stick with what I know until im more comfortable :wink: