Help with first time user

Hi, I have just started with Hass.io after using Tasker, IFTTT and Stringify to do my home automations.

I’m trying to sort my first Automation - dim lights when casting, and I’m not getting very far when using the very simple walkthroughs. I’m normally OK at picking things up once I have done one correctly, so I can see, in practice, what it looks like.

Here is the config I have tried…
</>scene:

  • name: Living_Room_Movie
    entities:
    light.chair_lamp:
    state: on
    brightness: 58
    hs_color: 273.701,65.49
    rgb_color: 181,88,255
    xy_color: 0.279,0.149
    light.corner_lamp:
    state: on
    brightness: 58
    hs_color: 254.238,92.941
    rgb_color: 74,18,255
    xy_color: 0.164,0.058
    light.sofa_lamp:
    state: on
    brightness: 58
    hs_color: 273.701,65.49
    rgb_color: 181,88,255
    xy_color: 0.279,0.149

  • name: Living_Room_Normal
    entities:
    light.chair_lamp:
    state: on
    brightness: 216
    hs_color: 42.166,78.039
    rgb_color: 255,195,55
    xy_color: 0.499,0.45
    light.corner_lamp:
    state: on
    brightness: 216
    hs_color: 42.166,78.039
    rgb_color: 255,195,55
    xy_color: 0.499,0.45
    light.sofa_lamp:
    state: on
    brightness: 216
    hs_color: 42.166,78.039
    rgb_color: 255,195,55
    xy_color: 0.499,0.45
    automation:

  • alias: “Media player paused/stopped”
    trigger:

    • platform: state
      entity_id: media_player.living_room_tv
      from: ‘playing’
      to: ‘idle’
      condition:
    • condition: state
      entity_id: sun.sun
      state: ‘below_horizon’
      action:
      service: scene.turn_on
      entity_id: scene.Living_Room_Normal
  • alias: “Media player playing”
    trigger:

    • platform: state
      entity_id: media_player.htpc
      to: ‘playing’
      from: ‘idle’
      condition:
    • condition: state
      entity_id: sun.sun
      state: ‘below_horizon’
      action:
      service: scene.turn_on
      entity_id: scene.Living_Room_Movie</>

But I am getting an error…YAML file /config/configuration.yaml contains duplicate key “automation”. Check lines 69 and 113.

Any help would be much appreciated!

Thanks

Without proper formatting of your automations it’s impossible to tell, but yaml is very particular about spacing and where dashes should be used.

edit you post above by formatting the code with the </> icon

I’ll try doing that when I get home tonight - first time posting on here too.

Just while I’m out and waiting to get home I’m looking at other possible problems, as I’m reasonably confident of my spacing (using notepad++ seems to group everything in a way that makes sense).

I’m using Hue bulbs, and the ‘states’ bit has loads of information that I’ve removed from the scene as I didn’t think it was relevant - should this be added back, or can I take out even more and just leave ‘rgb_colour’ and ‘brightness’ values.

How do I call a scene, so I can see if the error is with the scene or the automation element?

Thanks :grin:

to trigger the scene you can go to the services dev page and use the drop menu to select ‘scene.turn_on’, then below that select the scene name and hit the ‘call service’ button.

In your configuration.yaml on both line 69 and 113 you have

automation:

try changing 1 of these to

automation 1:

ie

line 69 --> automation:

line 113 --> automation 1:

Have I got a different version? I’m running on Pi2 B. Here is the services from the developer options I have.

scene:
 - name: Living_Room_Movie
   entities:
    light.chair_lamp:
     state: on
     brightness: 58
     hs_color: 273.701,65.49
     rgb_color: 181,88,255
     xy_color: 0.279,0.149
    light.corner_lamp:
     state: on
     brightness: 58
     hs_color: 254.238,92.941
     rgb_color: 74,18,255
     xy_color: 0.164,0.058
    light.sofa_lamp:
     state: on
     brightness: 58
     hs_color: 273.701,65.49
     rgb_color: 181,88,255
     xy_color: 0.279,0.149
 - name: Living_Room_Normal
   entities:
    light.chair_lamp:
     state: on
     brightness: 216
     hs_color: 42.166,78.039
     rgb_color: 255,195,55
     xy_color: 0.499,0.45
    light.corner_lamp:
     state: on
     brightness: 216
     hs_color: 42.166,78.039
     rgb_color: 255,195,55
     xy_color: 0.499,0.45
    light.sofa_lamp:
     state: on
     brightness: 216
     hs_color: 42.166,78.039
     rgb_color: 255,195,55
     xy_color: 0.499,0.45
automation:
  - alias: "Media player paused/stopped"
    trigger:
      - platform: state
        entity_id: media_player.living_room_tv
        from: 'playing'
        to: 'idle'
    condition:
      - condition: state
        entity_id: sun.sun
        state: 'below_horizon'
    action:
        service: scene.turn_on
        entity_id: scene.Living_Room_Normal

  - alias: "Media player playing"
    trigger:
      - platform: state
        entity_id: media_player.htpc
        to: 'playing'
        from: 'idle'
    condition:
      - condition: state
        entity_id: sun.sun
        state: 'below_horizon'
    action:
        service: scene.turn_on
        entity_id: scene.Living_Room_Movie

There is no Drop Down Option on Services for scene.turn_on

I’m assuming Entity would show up afterwards?

Hopefully, once I have worked out the little quirks on the first one I’m trying to set up, I’ll not be asking such basic questions. Hopefully…

you have indent issues in you scene entities. There needs to be 2 spaces difference between entities: and the lines below. I’m guessing that the scenes are not loading because of this and therefore you aren’t seeing the option in the service call dev page.

needs to be like this:

scene:
  - name: Living_Room_Movie
    entities:
      light.chair_lamp:
        state: on
        brightness: 58
        hs_color: 273.701,65.49
        rgb_color: 181,88,255
        xy_color: 0.279,0.149
      light.corner_lamp:
        state: on
        brightness: 58
        hs_color: 254.238,92.941
        rgb_color: 74,18,255
        xy_color: 0.164,0.058

etc…

I use the IDE addon for all my yaml coding because it makes it so easy to see all the issues. I definitely recommend it. just remember that you always need 2 spaces between different types of entry (for lack of better wording)

Thats great, thanks. I’m now able to call the scene, so that’s a start.

They just aren’t doing anything yet. Is there anywhere to go for a little more help on setting Hue lights from HA?

I don’t have Hue lights so can’t help with those but there is plenty of info on this forum about them.