Dash button and TP-Link HS105 with Dasshio automation help

I am trying to setup an automation to press a dash button and turn on my TP-Link smart plug. I believe that I have both devices setup correctly. I get a success 200 with the button and can manually turn on/off the plug. What am I doing incorrectly?

Dasshio config

{
  "buttons": [
    {
      "name": "Amazon Dash Button (Red Bull) 1",
      "address": "fc:a6:67:3a:e3:82",
      "domain": "switch",
      "service": "toggle",
      "service_data": "{\"entity_id\": \"light.redbull1\"}"
    }
  ]
}

configurations.yaml

switch:
  - platform: tplink
    host: 192.168.1.165

automations.yaml

- action:
  - condition: state
    entity_id: switch.nightstand
    state: 'On'
  alias: Nightstand
  condition: []
  id: '1514814676706'
  trigger:
  - entity_id: light.redbull1
    from: 'Off'
    platform: state
    to: 'On'

Lowercase for on and off?

Also you’ve put a condition where your action should be, which probably doesn’t help :+1:

I am new to this automation thing. Tried lowercase, no change. I used the visual Automation setup, so hoped that it would set up correctly. I want to be able to turn the plug on and also off, but started with just the on function.

Will light.redbull1 (Amazon Dash button) show up automatically in the entity field when creating an Automation?

Can I get some help getting my automation set up correctly?

Certainly…

Please confirm for me the entity_id of the dash button and the entity_id of the tp link socket you want to toggle.

button is light.redbull1
tp-link is switch.nightstand

Shouldn’t the dash button be switch dot something?

Assuming those are correct, your automaton is…

id: '1514814676706'
trigger:
  platform: state 
  entity_id: light.redbull1
action:
  service: homeassistant.toggle
  entity_id: switch.nightstand

This will turn it on when you press it the first time, then off the next time.

Hope this helps.

Why aren’t you controlling the switch directly as intended?

This line in the button setup should read…

"service_data": "{\"entity_id\": \"switch.nightstand\"}"

Nothing else needed.

This works! Thanks for your help. I will try the other as well and see if I can make that work.

trigger:
  platform: state 
  entity_id: light.redbull1
action:
  service: homeassistant.toggle
  entity_id: switch.nightstand```

Good stuff, so why do you still want to make it more complicated than it is?