Get Dashio to work with a switch

Afternoon All,

Hope you’re enjoying your Christmas / Holiday season.

I’m trying to get my dash button to operate a switch I have.

I have Dashiop installed and have tried the following parameters:

{
  "buttons": [
    {
      "name": "Gillette",
      "address": "FC:A6:67:E0:A4:E4",
      "url": "https://MY_SUBDOMAIN.duckdns.org/api/services/switch/on",
      "headers": "{\"x-ha-access\": \"MY_PASSWORD\"}",
      "body": "{\"entity_id\": \"switch.landing_light\"}"
    }
  ]
}

I’m not going to lie this was a stab in the dark based on examples i’ve seen for “lights”.

I’ve tried going through this but to no avail:

“switch.”
I would look at the entity_id again.

Sorry it does have switch.landing_light on my server.

It took me a lot of trial and error. Make sure your hass can connect to the url you supply. I no longer have double presses.

Here is one that works for me:

{"buttons":[
  {
    "name": "Medication Log",
    "address": "18:74:00:00:00:00",
    "url": "https://my_hasio.me.local/api/services/script/turn_on?api$
    "method": "POST",
    "insecure": true,
    "headers": {"x-ha-access": "myPassword"},
    "json": true,
    "protocol": "udp",
    "timeout": "60000",
    "body": {"entity_id": "script.meds_taken"}
  }
]}

No joy =/. I even added a script to run my switch to make it as identicle to yours as possible.

I have a static local ip assigned to the pi so have used that to see if that was part of the issue.

Thanks for your input though.

Any reason you’re not using the format made available by the latest update which uses Hass.io internal comms…

{
  "buttons": [
  {
    "name": "Gillette",
    "address": "AC:63:BE:77:C4:0D",
    "domain": "group",
    "service": "toggle",
    "service_data": "{\"entity_id\": \"group.room_lights\"}"
  }]
}
1 Like

@Bobby_Nobble

I started with that but had no joy either. I have reverted just to test and used this:

{
  "buttons": [
    {
      "name": "Gilette",
      "address": "FC:A6:67:E0:A4:E4",
      "domain": "script",
      "service": "landing_fix",
      "service_data": "{}"
    }
  ]
} 

Above based on https://github.com/danimtb/dasshio

I also tried:

{
  "buttons": [
    {
      "name": "Bounty",
      "address": "FC:A6:67:E0:A4:E4",
      "domain": "script",
      "service": "on",
      "service_data": "{\"entity_id\": \"script.landing_fix\"}"
    }
  ]
}

Again no joy with either. I must be doing something stupid. I’m going to feel like an idiot asking this but other than installing do I need to enable in the configuration.yaml?

It’s got to be something else as I even copied what you put and changed it to a group I have (upstairs_lights) with no joy:

{
  "buttons": [
  {
    "name": "Gillette",
    "address": "FC:A6:67:E0:A4:E4",
    "domain": "group",
    "service": "toggle",
    "service_data": "{\"entity_id\": \"group.upstairs_lights\"}"
  }]
}

Right no idea why but after going through all the options one last time this worked (might help someone in the future):

{
  "buttons": [
    {
      "name": "Gillette",
      "address": "FC:A6:67:E0:A4:E4",
      "domain": "switch",
      "service": "turn_on",
      "service_data": "{\"entity_id\": \"switch.landing_light\"}"
    }
  ]
}
1 Like

Hi all,
Sorry for my newbie question. I have a harmony hub and created a script named “Mute_TV”. The script can be executed from Hass Home web. Now I would like to use dasshi to execute this script. I tried like this in the dasshi configuration.

{ "buttons": 
[ { 
"name": "Dash name", 
"address": "Dash MAC", 
"domain": "script", 
"service": "Mute_TV", 
"service_data": "{\"entity_id\": \"remote.my_hub_name\"}" 
}]
 } 

When never I press the button, the log show bad request error.
I also tried to leave the" service data" emply but it still the same.
Could you kindly advise how I should do to implement the script?
Many thanks