Giter VIP home page Giter VIP logo

dasshio's Introduction

Dasshio - Amazon Dash Buttons Hass.io add-on

Hass.io add-on to use Amazon Dash Buttons in Home Assistant.

Description: How dasshio works

This is a python script used to scan Wifi devices connected to your network (using ARP and UDP). If a device matches any MAC address of the options, it will perform a HTTP POST request to the Home Assistant API.

Usage

The purpose of Dasshio is to "integrate" Amazon's Dash buttons in Home Assistant in an easy way with Hass.io.

See RESTful API Post Services documentation to see what you can do.

Examples:

  • Set a Dash Button to toggle room_light light:
    • domain: light
    • service: toggle
    • service_data: {\"entity_id\": \"light.room_light\"}
  • Set a Dash Button to activate a welcome_home script:
    • domain: script
    • service: turn_on
    • service_data: {\"entity_id\": \"script.welcome_home\"}

Have a look at Service calls to know what services you can use and what you can do with them.

How to install this Hass.io add-on

To install this add-on, please, follow Home Assistant documentation on how to Install Third-party Add-ons

How to connect your Dash button to your Wifi

Amazon has annouced that Dash Buttons will be no longer supported after 2019. In some countries, the configuration of the buttons has been disabled from Amazon's app.

However, there is an alternative method to connect the divice to your wifi network.

  1. Set the button into configuration mode by pressing the button for 6 seconds.
  2. Connect your laptop to the Wifi SSID that the button generates called Amazon Configure me.
  3. Open your favourite browser and navigate to the following URL http://192.168.0.1 here you will see a table with the MAC of your device. Copy the MAC address in order to indetify your device in the Dasshio configuration later.
  4. Navigate to the following URL: http://192.168.0.1/?amzn_ssid=<SSID>&amzn_pw=<PASSWORD> where <SSID> is the name of your Wifi network and <PASSWORD> is the password.
  5. Once you navigate to that URL, the button's Amazon Configure me Wifi will disappear and if <SSID> and <PASSWORD> were right, the button will connect to the Wifi network once you press the button.

Options example: domain, service, service_data

Here it is an example of a Dash Gillette button used to toggle a light and a Dash Bounty to call a script. Note you can add as many buttons as you like inside the "buttons" array.

  • name: name of your device
  • address: MAC of your device
  • domain: Home Assistant domain (light, switch, script, automation...). Check Home Assistant RESTful API.
  • service: Home Assistant service.
  • service_data: Home Assistant service data to call the service (Optional).

/data/options.json

{
  "timeout": 20,
  "buttons": [
  {
    "name": "Gillette",
    "address": "AC:63:BE:77:C4:0D",
    "domain": "light",
    "service": "toggle",
    "service_data": "{\"entity_id\": \"light.room_light\"}"
  },
  {
    "name": "Bounty",
    "address": "AC:63:BE:77:C4:0C",
    "domain": "script",
    "service": "turn_on",
    "service_data": "{\"entity_id\": \"script.welcome_home\"}"
  }]
}

Note: Dasshio uses http://hassio/homeassistant/api/services/{domain}/{service} as the base url to route requests over the Hassio local network between the containers. This is the prefered method as it means the requests don't have to leave the machine Hassio is running on (See Hass.io Addon Communication).

WARNING: As headers and body sections have to be strings, it is necessary to use backslashes ( \ ) before double quotes ( " ) to escape them. Like this: \"

Options: url, body, headers

Another possibility would be to use Dasshio to perform a HTTP Post request to an URL outside Home Assistant. To do so you can use the configuration below.

  • name: name of your device
  • address: MAC of your device
  • url: Url to perform the HTPP Post request (http or https). Check Home Assistant RESTful API.
  • headers: HTTP Post headers (Useful for Home Assistant API password -see example-).
  • body: HTTP Post Body (Normally the entity_id in Home Assistant)

/data/options.json

{
  "timeout": 20,
  "buttons": [
  {
    "name": "Gillette",
    "address": "AC:63:BE:77:C4:0D",
    "url": "http://httpbin.org/post",
    "headers": "{}",
    "body": "{\"payload\": \"This is an HTTP Post request!\"}"
  },
  {
    "name": "Bounty",
    "address": "AC:63:BE:77:C4:0C",
    "url": "http://hassio/homeassistant/api/services/script/welcome_home",
    "headers": "{}",
    "body": "{}"
  }]
}

Note: As described above, you can still use http://hassio/homeassistant/api to route requests over the Hassio local network and perform API calls to Home Assistant. You can see Hass.io Addon Communication for more information. For those running Hass.io in Docker you must add the docker internal IP address to HTTP trusted_networks in the configuration.yaml file.

# Example configuration.yaml entry
http:
    trusted_networks:
    - 127.0.0.1
    - 192.168.0.0/24
    - 172.17.0.0/16 # Example Docker bridge - change to your relevent ip subnet range.
    - 172.30.32.0/23 # Example Docker hassio - change to your relevent ip subnet range.

Options: timeout

By default Dasshio waits 10 seconds after a button press before resuming, this is to avoid detecting duplicate button presses. This option allows you to change this delay, if you want more responsive buttons then decrease this value and increase it if you experience duplicate presses.

Options: request_timeout_secs

In case you suffer some latency in the HTTP requests, you can increase the request_timeout_secs (default to 2 seconds).

How to find the MAC address of your Dash

At the moment, the best way to do this is to hold down the button for 6 seconds, disconnect from the current Wifi and connect to the Amazon ConfigureMe SSID. If prompted, "stay connected" and open web page 192.168.0.1. You will see your button’s ‘about’ page with the MAC and the additional information.

Alternatively, you can access your Wifi Router and check the MAC addresses in the history of connected devices. Then, copy and paste the MAC in a service like MA:CV:en:do:rs to find the Vendor of that device. The Amazon Dash button vendor should be: Amazon Technologies Inc.

Manual installation (not as an addon)

Requirements: To have installed Home Assistant following this guide: https://www.home-assistant.io/docs/installation/virtualenv/

  1. Create the folder /srv/homeassistant/dasshio to store the files:

    /srv/homeassistant/dasshiodasshio.py
    /srv/homeassistant/dasshiodata/config.json
    /srv/homeassistant/dasshiodata/options.json
  2. In options.json define the url, headers, body and domain of your Home Assistant integration:

    {
      "server": "http://localhost:8123",
      "timeout": 30,
      "buttons": [
      {
        "name": "Duracell",
        "address": "xx:xx:xx:xx:xx:xx",
        "url": "http://localhost:8123/api/services/switch/toggle",
        "headers": "{\"x-ha-access\": \"ha_password\"}",
        "body": "{\"entity_id\":\"switch.socket_power\"}",
        "domain": "switch"
      }]
    }
  3. To run dasshio as a service, create the file: /lib/systemd/system/dasshio.service

    [Unit]
    Description=dasshio - Amazon Dash Buttons
    After=network.target,home-assistant\@homeassistant.service
    StartLimitIntervalSec=0
    [Service]
    Type=simple
    Restart=always
    RestartSec=1
    User=root
    ExecStart=/srv/homeassistant/bin/python3 /srv/homeassistant/dasshio/dasshio.py
    
    [Install]
    WantedBy=multi-user.target
    
  4. Manually start/stop the service:

    sudo systemctl start dasshio
    sudo systemctl status dasshio
    sudo systemctl stop dasshio
  5. Automatically start the service on boot

    sudo systemctl enable dasshio

Credit

Sources & Inspiration:

dasshio's People

Contributors

adamcohenrose avatar cwmoriarty avatar danimtb avatar danrspencer avatar emericklaw avatar genestealer avatar gpotter2 avatar imarkus avatar juliankahnert avatar kavajnaruj avatar kotopoulos10 avatar paulfinch avatar r1ch avatar shoejosh avatar stickystyle avatar sunnythaper avatar vancetran avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dasshio's Issues

Timeout for each button

It would be nice if the timeout affected to each button separatly. Currently, if you press two different buttons at the same time, dasshio addon only sniff one of them.

PD: Btw the addon is very useful it makes really easy to use Amazon Dash buttons within Hass.io Thanks a lot for the effort!!

Dasshio randomly stops

My Dasshio add-on service randomly stops. Sometimes the dash buttons seem to stop working, but on inspecting the add-on I find that it has changed state to "stopped", with an error in the log.

The last time, this is what happened:

  • I pressed a dash button once
  • it correctly performed the associated action
  • then I pressed it again but it didn't work
  • I checked the Hass.io web interface and the add-on was in "state: stopped"
  • I started the add-on and then it worked correctly in detecting button presses several times.

This is the log:

2017-12-13 07:01:35,704 | INFO | Gillette button pressed!
2017-12-13 07:01:35,705 | INFO | Request: http://homeassistant:8123/api/services/light/toggle
2017-12-13 07:01:35,810 | INFO | Status Code: 200
2017-12-13 07:01:35,811 | INFO | Successful request
Traceback (most recent call last):
File "dasshio.py", line 81, in <module>
sniff(stop_filter=arp_display, filter='arp or (udp and src port 68 and dst port 67 and src host 0.0.0.0)', store=0, count=0)
File "/usr/lib/python3.6/site-packages/scapy/sendrecv.py", line 617, in sniff
s.close()
File "/usr/lib/python3.6/site-packages/scapy/arch/linux.py", line 499, in close
set_promisc(self.ins, i, 0)
File "/usr/lib/python3.6/site-packages/scapy/arch/linux.py", line 151, in set_promisc
mreq = struct.pack("IHH8s", get_if_index(iff), PACKET_MR_PROMISC, 0, b"")
File "/usr/lib/python3.6/site-packages/scapy/arch/linux.py", line 294, in get_if_index
return int(struct.unpack("I",get_if(iff, SIOCGIFINDEX)[16:20])[0])
File "/usr/lib/python3.6/site-packages/scapy/arch/linux.py", line 288, in get_if
ifreq = ioctl(s, cmd, struct.pack("16s16x",bytes(iff,'utf-8')))
OSError: [Errno 19] No such device

Connection lost. Reconnecting…

This is the add-on configuration. Notice that at the moment I am actively using only the first configured button, "Gillette".

Description Use Amazon Dash Buttons in Home Assistant
Version 0.0.9
State stopped
Boot auto
Auto update X
Uses host network V
Builds locally V
Detached V
Options
{
  "buttons": [
    {
      "name": "Gillette",
      "address": "**:**:**:**:**:ea",
      "url": "http://homeassistant:8123/api/services/light/toggle",
      "headers": "{\"x-ha-access\": \"*******\"}",
      "body": "{\"entity_id\": \"light.abatjour\"}"
    },
    {
      "name": "Angelica",
      "address": "**:**:**:**:**:B8",
      "url": "http://homeassistant:8123/api/services/persistent_notification/create",
      "headers": "{\"x-ha-access\": \"*******\"}",
      "body": "{\"message\": \"prova angelica\"}"
    },
    {
      "name": "Finish",
      "address": "**:**:**:**:**:B9",
      "url": "http://homeassistant:8123/api/services/persistent_notification/create",
      "headers": "{\"x-ha-access\": \"*******\"}",
      "body": "{\"message\": \"prova finish\"}"
    },
    {
      "name": "Duracell",
      "address": "**:**:**:**:**:A0",
      "url": "http://homeassistant:8123/api/services/automation/trigger",
      "headers": "{\"x-ha-access\": \"*******\"}",
      "body": "{\"entity_id\":\"automation.demo_audio_e_luce\"}"
    },
    {
      "name": "Barilla",
      "address": "**:**:**:**:**:0D",
      "url": "http://homeassistant:8123/api/services/persistent_notification/create",
      "headers": "{\"x-ha-access\": \"*******\"}",
      "body": "{\"message\": \"prova barilla\"}"
    }
  ]
}

Hass.io version is 0.59.2 running on Raspberry Pi 3.

Hass.io crashes when attempting to install

Hass.io installed on Pi (HassOS 1.13)
Home assistant 0.86.2
hass.io supervisor 143

Trying to install the add on after adding the repo but within seconds the entire system crashes and reboots. Can't see anything in the logs because it crashes then reboots with fresh logs, anyone else getting this?

The last thing spotted in the logs was that the SyncWorker was attempting to pull data from this repo.

Last log: 19-02-13 22:28:57 INFO (SyncWorker_8) [hassio.docker.interface] Pull image danimtb/armhf-dasshio tag 0.3.1.

Repository not found by Hass.io

When i add the repo to my add-on-store, nothing happen.
In the system tab i get this errors:
19-04-09 18:45:38 ERROR (MainThread) [hassio.addons.git] Can't clone https://github.com/danimtb/ repository: Cmd('git') failed due to: exit code(128)
cmdline: git clone --depth=1 --recursive --shallow-submodules -v https://github.com/danimtb/ /data/addons/git/4fae26c1
stderr: 'Cloning into '/data/addons/git/4fae26c1'...
remote: Not Found
fatal: repository 'https://github.com/danimtb/' not found
'.
19-04-09 18:45:38 ERROR (MainThread) [hassio.addons] Can't load from repository https://github.com/danimtb/

Unable to make a call to node-red on the same host

I have Hassio with the dashio and node-red addons. Dashio is working fine with a physical Amazon Dash when sending a RESTful call to the hassio api URL.

Triggering the workflow via curl on the pi and/or hassio (using the community ssh addon) also works fine.

The trouble comes when trying to do the same to a node-red URL. Now when trying to trigger the node-red URL via the Dash button, dashio logs shows it's getting a 404. Again, a basic curl to the same node-red URL works fine.

Below is the dashio setup (node-red is on port 1880)

    {
      "buttons": [
        {
          "name": "Seventh Generation",
          "address": "18:74:2E:XX:XX:XX",
          "url": "https://XXXXX.duckdns.org:1880/bedroom_lights",
          "headers": "{}",
          "body": "{}"
        }
      ]
    }

Seems like the dashio docker is getting to the endpoint but for some reason it's getting back a 404

    2018-08-10 12:03:24,736 | INFO | Reading config file: /data/options.json
    2018-08-10 12:03:24,737 | INFO | Starting sniffing...
    2018-08-10 12:03:31,709 | INFO | Seventh Generation button pressed!
    2018-08-10 12:03:31,709 | INFO | Request: https://xxxxx.duckdns.org:1880/bedroom_lights
    2018-08-10 12:03:32,038 | INFO | Status Code: 404
    2018-08-10 12:03:32,038 | ERROR | Bad request
    2018-08-10 12:03:32,100 | INFO | Packet captured, waiting 20s ...

Showing how it works fine by doing a simple curl from the hass.io terminal to the same URL

$ curl -v https://xxxx.duckdns.org:1880/bedroom_lights
 *   Trying 47.152.XX.XX...
 * TCP_NODELAY set
 * Connected to xxxxx.duckdns.org (47.152.XX.XX) port 1880 (#0)
 * ALPN, offering http/1.1
 * Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
 * successfully set certificate verify locations:
 *   CAfile: /Applications/Anaconda/anaconda2/ssl/cacert.pem
   CApath: none
 * TLSv1.2 (OUT), TLS header, Certificate Status (22):
 * TLSv1.2 (OUT), TLS handshake, Client hello (1):
 * TLSv1.2 (IN), TLS handshake, Server hello (2):
 * TLSv1.2 (IN), TLS handshake, Certificate (11):
 * TLSv1.2 (IN), TLS handshake, Server key exchange (12):
 * TLSv1.2 (IN), TLS handshake, Server finished (14):
 * TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
 * TLSv1.2 (OUT), TLS change cipher, Client hello (1):
 * TLSv1.2 (OUT), TLS handshake, Finished (20):
 * TLSv1.2 (IN), TLS change cipher, Client hello (1):
 * TLSv1.2 (IN), TLS handshake, Finished (20):
 * SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
 * ALPN, server accepted to use http/1.1
 * Server certificate:
 *  subject: CN=xxxxxx.duckdns.org
 *  start date: Jun 25 18:45:12 2018 GMT
 *  expire date: Sep 23 18:45:12 2018 GMT
 *  subjectAltName: host "xxxxx.duckdns.org" matched cert's "xxxxxx.duckdns.org"
 *  issuer: C=US; O=Let's Encrypt; CN=Let's Encrypt Authority X3
 *  SSL certificate verify ok.
 > GET /bedroom_lights HTTP/1.1
 > Host: xxxxx.duckdns.org:1880
 > User-Agent: curl/7.55.1
 > Accept: */*
 >
 < HTTP/1.1 200 OK
 < X-Powered-By: Express
 < X-Content-Type-Options: nosniff
 < Content-Type: application/json; charset=utf-8
 < Content-Length: 2
 < ETag: W/"2-vyGp6PvFo4RvsFtPoIWeCReyIC8"
 < Date: Fri, 10 Aug 2018 19:01:10 GMT
 < Connection: keep-alive
 <
 * Connection #0 to host xxxxx.duckdns.org left intact
 {}

Amend readme - add docker network to

May I suggest you add the following:
Note: Dasshio uses http://hassio/homeassistant/api/services/{domain}/{service} as the base url to route requests over the Hassio local network between the containers. This is the prefered method as it means the requests don't have to leave the machine Hassio is running on (See Hass.io Addon Communication).
For those running Hass.io in Docker you must add the docker internal IP address to HTTP trusted_networks in the configuration.yaml file.

# Example configuration.yaml entry
http:
    trusted_networks:
    - 127.0.0.1
    - 192.168.0.0/24
    - 172.17.0.0/16 # Docker bridge
    - 172.30.32.0/23 # Docker hassio

502 Bad request with HA v0.75.0

I'm getting 502 errors again (since installing homeassistant v0.75):

2018-08-06 13:13:54,889 | INFO | button1 button pressed!
2018-08-06 13:13:54,889 | INFO | Request: http://hassio/homeassistant/api/services/automation/trigger
2018-08-06 13:13:54,933 | INFO | Status Code: 502
2018-08-06 13:13:54,934 | ERROR | Bad request
2018-08-06 13:13:54,950 | INFO | Packet captured, waiting 20s ...
2018-08-06 13:14:14,966 | INFO | Starting sniffing...

my config hasn't changed since HA v0.74.2, I think something has broken in the HA api auth system (again)
This is what I can see in the hassio log:

18-08-06 11:13:54 INFO (MainThread) [hassio.api.proxy] /homeassistant/api/services/automation/trigger access from 03d23610_dasshio
18-08-06 11:13:54 ERROR (MainThread) [hassio.homeassistant] Authenticate problem with HomeAssistant!
18-08-06 11:13:54 ERROR (MainThread) [hassio.api.proxy] Authenticate error on API for request services/automation/trigger

newbie :-)

  "service": "toogle",

solved the error was TOOGLE instead TOGGLE :-)

Huge Dasshio File in Hass.io

In my quest to find the cause of otherwise random hangs in the Frontend/SSH/Samba where my automations etc continue despite needing to power cycle my Pi3, I have noticed that the Dasshio segment of my snapshots often grows into excess of 70-80MB. Is this normal?

Use HA service names

Update config.json to use the same name parameters as in the service tab page on Home Assistant:

  • Domain
  • Service
  • Service Data

This may be done after issue #12

Authentification failure

Hi, I am running the latest Hassio and HA 0.75.2. Dasshio captures the dash button packet but fails on the api request:

Request: http://hassio/homeassistant/api/services/script/ifttt.trigger
Status Code: 401

The logs of HA show

Login attempt or request with invalid authentication from 172.30.32.2
12:10 PM components/http/ban.py (WARNING)

Here's how my http component looks like in configuration.yaml:

http:
  api_password: !secret http_password

Am I missing something basic? Thanks!

Can't trigger script with alias name

This configuration works:

{
  "buttons": [
    {
      "name": "Nerf",
      "address": "AC:XX:XX:XX:XX:XX",
      "domain": "script",
      "service": "12334567890",
      "service_data": "{}"
    }
  ]
}

while this doesn't:

{
  "buttons": [
    {
      "name": "Nerf",
      "address": "AC:XX:XX:XX:XX:XX",
      "domain": "script",
      "service": "aktiviereradio",
      "service_data": "{}"
    }
  ]
}

My script (only the beginning):

'12334567890':
  alias: AktiviereRadio
  sequence: 

In case it doesn't work, I see the following error in the log:

WARNING (MainThread) [homeassistant.core] Unable to find service script/aktiviereradio

| INFO | Nerf button pressed!
| INFO | Request: http://hassio/homeassistant/api/services/script/aktiviereradio
| INFO | Status Code: 200
| INFO | Successful request
| INFO | Packet captured, waiting 20s ..

Using Dashio 0.2.0
Home Assistant Hass.io 0.59.2

Great add-on by the way! Thanks for developing it

Only works when webpage is open.

HASSIO 0.77.3
Dasshio 0.3.1

The system seems to work ok, but only when a web page with homeassistant loaded is open.

Any ideas of how can identify the issue?

Sniffing restarts after every button press

Any idea why the sniffing restarts after each button press? I have two buttons next to each other and I sometimes press them right after each other. But due to this 20sec delay the seccond button press is not recognized...

2018-03-02 00:53:27,507 | INFO | Starting sniffing...

2018-03-02 00:53:45,691 | INFO | 01 - button pressed!
...
2018-03-02 00:53:56,051 | INFO | Packet captured, waiting 20s ...

2018-03-02 00:54:16,053 | INFO | Starting sniffing...
2018-03-02 00:54:29,577 | INFO | 03 - button pressed!
...
2018-03-02 00:54:30,275 | INFO | Successful request
2018-03-02 00:54:30,331 | INFO | Packet captured, waiting 20s ...

2018-03-02 00:54:50,339 | INFO | Starting sniffing...

Dasshio add-on not running

The add-on does not auto start and when manually starting it does not indicate it has started from the dashboard (puzzle piece is grey). Nothing is shown in the dasshio log.

Dasshio broken in 65.0.

This config worked perfectly in 64.3 and never registers a button press in 65.0.
I have done a rebuild, stop and start, but not an uninstall yet. Log looks good for dasshio.

Maybe the new entity ID stuff?

starting version 3.2.4
WARNING: No route found for IPv6 destination :: (no default route?). This affects only IPv6
2018-03-10 18:15:55,107 | INFO | Reading config file: /data/options.json
2018-03-10 18:15:55,113 | INFO | Starting sniffing...
{
  "timeout": 8,
  "buttons": [
    {
      "name": "Hammermill",
      "address": "00:fc:8b:54:41:d9",
      "domain": "light",
      "service": "toggle",
      "service_data": "{\"entity_id\": \"light.bathroom_2, light.bathroom_1\"}"
    }
  ]
}

Config not saved in /data/options.json

Where can I find the options.json file, my config isn't saved to /data/options.json (where the docs say that it should be), that file has my settings for the default ssh addon saved in it.

The settings persist on reboot, so must be saved somewhere, but I can't find them! I'd like to be able to store them under /config so that they can be kept in VCS with the rest of the config

service_data - how two set more than one setting

I'd like to toggle my light, and when it turns on it should always turn on at a certain brightness value?

How do I have to set service_data for more than one setting?
"service_data": "{\"entity_id\": \"light.trainingszimmer\"}"

I tried this:
"service_data": "{\"entity_id\": \"light.trainingszimmer\"}, {\"brightness_pct\": \"50\"}"

But this did not work, I dont know how to format it correct.

"repository name must be lowercase"

I'm unable to install Dasshio on the latest Hassio release. Here's the error from the supervisor logs:

17-09-28 04:34:04 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/aiohttp/web_protocol.py", line 422, in start
    resp = yield from self._request_handler(request)
  File "/usr/lib/python3.6/site-packages/aiohttp/web.py", line 306, in _handle
    resp = yield from handler(request)
  File "/usr/lib/python3.6/site-packages/hassio/api/util.py", line 31, in wrap_api
    answer = await method(api, *args, **kwargs)
  File "/usr/lib/python3.6/site-packages/hassio/api/addons.py", line 169, in install
    addon.install(version=version), loop=self.loop)
  File "/usr/lib/python3.6/site-packages/hassio/addons/addon.py", line 437, in install
    if not await self.docker.install(version):
  File "/usr/lib/python3.6/site-packages/hassio/dock/util.py", line 18, in wrap_api
    return await method(api, *args, **kwargs)
  File "/usr/lib/python3.6/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/lib/python3.6/site-packages/hassio/dock/addon.py", line 184, in _install
    return self._build(tag)
  File "/usr/lib/python3.6/site-packages/hassio/dock/addon.py", line 197, in _build
    image = self.docker.images.build(**build_env.get_docker_args(tag))
  File "/usr/lib/python3.6/site-packages/docker/models/images.py", line 175, in build
    raise BuildError(chunk['error'])
docker.errors.BuildError: invalid reference format: repository name must be lowercase```



Any idea what's going on? 

Concurrency not supported

If you have 2 dash buttons and press both at the same time ( I guess within the timeout configured in config.json), it is only detected one of them.

Version 0.3.1

Related to: #34

Dashio stopped, reinstalled, now starts but 401 error

My Hassio setup was fine with Dashio installed and running, then one day it stopped and would not restart. Uninstalled Dashio, reinstalled it and now it starts but although it detects button presses, refuses to talk to the api. My entity ID is fine and I can toggle the switch using the Hassio services page, but Dashio refuses to communicate with the api.
Here is my Config:
{ "timeout": 20, "buttons": [ { "name": "SimpleHuman", "address": "6C:56:97:76:BE:17", "domain": "switch", "service": "toggle", "service_data": "{\"entity_id\": \"switch.plug\"}" } ] }

and here is the log showing button press detection but failure to communicate with the api:
2018-07-27 10:19:16,315 | INFO | Reading config file: /data/options.json
2018-07-27 10:19:16,319 | INFO | Starting sniffing...
2018-07-27 10:19:20,688 | INFO | SimpleHuman button pressed!
2018-07-27 10:19:20,689 | INFO | Request: http://hassio/homeassistant/api/services/switch/toggle
2018-07-27 10:19:20,756 | INFO | Status Code: 401
2018-07-27 10:19:20,757 | ERROR | Bad request
2018-07-27 10:19:20,797 | INFO | Packet captured, waiting 20s ...

Repeats API call 5x on every press

Hi, there is an issue where this addon repeats the API call 5x for every button press. I have tried forking the repo and changing the wait value to 60 seconds, 300 seconds, and 1 second. no matter what, it just waits X seconds and repeats until it has called the API 5x... I don't know enough to troubleshoot further. Hopefully, you can take a look at this and help fix it? thx!

Logs (1 second delay in place):

root@hassio:~# docker logs -f 9cc5e9e13520
starting version 3.2.2
WARNING: No route found for IPv6 destination :: (no default route?). This affects only IPv6
2017-10-31 23:36:38,327 | INFO | Reading config file: /data/options.json
2017-10-31 23:36:38,329 | INFO | Starting sniffing...
2017-10-31 23:37:02,977 | INFO | ziplock button pressed!
2017-10-31 23:37:02,978 | INFO | Request: http://x.x.x.x:8123/api/services/script/dash_ziplock
2017-10-31 23:37:03,426 | INFO | Status Code: 200
2017-10-31 23:37:03,427 | INFO | Successful request
2017-10-31 23:37:04,439 | INFO | ziplock button pressed!
2017-10-31 23:37:04,440 | INFO | Request: http://x.x.x.x:8123/api/services/script/dash_ziplock
2017-10-31 23:37:04,868 | INFO | Status Code: 200
2017-10-31 23:37:04,869 | INFO | Successful request
2017-10-31 23:37:05,881 | INFO | ziplock button pressed!
2017-10-31 23:37:05,882 | INFO | Request: http://x.x.x.x:8123/api/services/script/dash_ziplock
2017-10-31 23:37:06,302 | INFO | Status Code: 200
2017-10-31 23:37:06,303 | INFO | Successful request
2017-10-31 23:37:07,315 | INFO | ziplock button pressed!
2017-10-31 23:37:07,316 | INFO | Request: http://x.x.x.x:8123/api/services/script/dash_ziplock
2017-10-31 23:37:07,740 | INFO | Status Code: 200
2017-10-31 23:37:07,742 | INFO | Successful request
2017-10-31 23:37:08,755 | INFO | ziplock button pressed!
2017-10-31 23:37:08,756 | INFO | Request: http://x.x.x.x:8123/api/services/script/dash_ziplock
2017-10-31 23:37:09,266 | INFO | Status Code: 200
2017-10-31 23:37:09,267 | INFO | Successful request

Manual installation (not as an add-on)

Hello,

I have intalled Home Assistant manually in a python environment and I'd like to integrate dasshio, but the only installation process described is as Hassio addon. Is it possible to install dasshio manually (not as an addon)?

Thanks!

Cannot install add-on in hass.io

Hass.io installed in docker on Ubuntu 16.04.4.
Home assistant 65.5
hass.io supervisor 0.98

try to install via addon store and get the following error.

18-03-15 21:57:34 INFO (SyncWorker_5) [hassio.docker.addon] Start build 03d23610/amd64-addon-dasshio:0.2.1
18-03-15 21:57:34 ERROR (SyncWorker_5) [hassio.docker.addon] Can't build 03d23610/amd64-addon-dasshio:0.2.1: Please provide a source image with from prior to commit

Dasshio script failing when pressing Dash button - IndexError: Layer [ARP] not found

I set up Dasshio version 0.3.0 in Hass.io supervisor version 121 on an Ubuntu 16.04 host. When I configure a button and then press it, I get the results below:

2018-07-31 18:52:35,229 | INFO | Reading config file: /data/options.json
2018-07-31 18:52:35,230 | INFO | Starting sniffing...
Traceback (most recent call last):
  File "/dasshio.py", line 27, in arp_display
    mac = pkt[ARP].hwsrc.lower()
  File "/usr/lib/python3.6/site-packages/scapy/packet.py", line 966, in __getitem__
    raise IndexError("Layer [%s] not found" % lname)
IndexError: Layer [ARP] not found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/dasshio.py", line 149, in <module>
    count=0)
  File "/usr/lib/python3.6/site-packages/scapy/sendrecv.py", line 783, in sniff
    if stop_filter and stop_filter(p):
  File "/dasshio.py", line 29, in arp_display
    mac = pkt[Ether].src.lower()
  File "/usr/lib/python3.6/site-packages/scapy/packet.py", line 966, in __getitem__
    raise IndexError("Layer [%s] not found" % lname)
IndexError: Layer [Ether] not found

Unable to perform request (Dasshio)

Can anyone help me with this please, this is driving me crazy, from few days i'm trying to solve it but i'm new to this stuff couldn't get it.

Thanks

image

Dashio crashing itself

I just moved HASSIO (RP3) to UBUNTU 16.04 (VM).

Dashio v0.3.1

All dependicies installed and all add-on works perfectly. But Dashio keeps crashing sometimes. Here is the error log:

`2018-10-31 14:26:03,323 | INFO | Reading config file: /data/options.json
2018-10-31 14:26:03,324 | INFO | Starting sniffing...
Traceback (most recent call last):
  File "/dasshio.py", line 27, in arp_display
    mac = pkt[ARP].hwsrc.lower()
  File "/usr/lib/python3.6/site-packages/scapy/packet.py", line 966, in __getitem__
    raise IndexError("Layer [%s] not found" % lname)
IndexError: Layer [ARP] not found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/dasshio.py", line 149, in <module>
    count=0)
  File "/usr/lib/python3.6/site-packages/scapy/sendrecv.py", line 783, in sniff
    if stop_filter and stop_filter(p):
  File "/dasshio.py", line 29, in arp_display
    mac = pkt[Ether].src.lower()
  File "/usr/lib/python3.6/site-packages/scapy/packet.py", line 966, in __getitem__
    raise IndexError("Layer [%s] not found" % lname)
IndexError: Layer [Ether] not found`

Any advice?

Some of my buttons no longer being detected

Recently a number of my buttons have stopped working, they still flash etc. and appear to be working. However, I see nothing in the dasshio logs. This is after months of everything working flawlessly.

Is there a good way to debug and investigate this?

ModuleNotFoundError: No module named 'scapy'

I recently started fresh with hassio and installed dasshio again. Before I started fresh I had dasshio working with hassio.

this is the log:

Traceback (most recent call last):
  File "dasshio.py", line 7, in <module>
    from scapy.all import sniff
ModuleNotFoundError: No module named 'scapy'

dasshio does not start when I reboot hassio, even though start on boot is enabled. I have to manually start the add-on.

this is my config in the dasshio add-on:

{
  "timeout": 8,
  "buttons": [
    {
      "name": "test",
      "address": "fc:65:de:ca:a3:8d",
      "domain": "light",
      "service": "toggle",
      "service_data": "{\"entity_id\": \"light.bedroom\"}"
    }
  ]
}

The dash button is connecting to my wifi, but dasshio isn’t working.

hassio ver: 0.69.1
dasshio ver: 0.2.1

tried rebuilding dasshio, restarting, uninstalling dasshio and reinstalling.
dasshio keeps disabling itself.

Registering a press every 2 mins

I have done two things at the same time so am slightly lost which might be causing a problem based on the rest of you having a happy experience.

I updated HassIO to .83.1 and I added a brand new, and my first, dash button to my set-up. Dashio is 0.3.1
Supervisor v140

According to my log files, presses are being detected regularly. This matches with my house going dark as the config is mapped to a test scene that turns everything off.

Has anyone else seen this behaviour please? The thing that really jumps out from the HASSIO log is it exactly every 2 mins, although I don't know if this is an Amazon thing or something at our end?

{
  "timeout": 15,
  "buttons": [
    {
      "name": "Lights Dash Button",
      "address": "7C:5C:F8:2F:3D:2F",
      "domain": "scene",
      "service": "turn_on",
      "service_data": "{\"entity_id\": \"scene.test\"}"
    }
  ]
}

ADD-ON LOG:
2018-11-30 10:14:35,618 | INFO | Reading config file: /data/options.json
2018-11-30 10:14:35,623 | INFO | Starting sniffing...
2018-11-30 10:15:09,105 | INFO | Lights Dash Button button pressed!
2018-11-30 10:15:09,106 | INFO | Request: http://hassio/homeassistant/api/services/scene/turn_on
2018-11-30 10:15:09,669 | INFO | Status Code: 200
2018-11-30 10:15:09,670 | INFO | Successful request
2018-11-30 10:15:09,707 | INFO | Packet captured, waiting 15s ...
2018-11-30 10:15:24,723 | INFO | Starting sniffing...
2018-11-30 10:17:09,106 | INFO | Lights Dash Button button pressed!
2018-11-30 10:17:09,107 | INFO | Request: http://hassio/homeassistant/api/services/scene/turn_on
2018-11-30 10:17:09,585 | INFO | Status Code: 200
2018-11-30 10:17:09,586 | INFO | Successful request
2018-11-30 10:17:09,627 | INFO | Packet captured, waiting 15s ...
2018-11-30 10:17:24,637 | INFO | Starting sniffing...

HassIO LOG:
18-11-30 08:17:09 INFO (MainThread) [hassio.api.proxy] /homeassistant/api/services/scene/turn_on access from 03d23610_dasshio
18-11-30 08:19:09 INFO (MainThread) [hassio.api.proxy] /homeassistant/api/services/scene/turn_on access from 03d23610_dasshio
18-11-30 08:21:09 INFO (MainThread) [hassio.api.proxy] /homeassistant/api/services/scene/turn_on access from 03d23610_dasshio
18-11-30 08:23:09 INFO (MainThread) [hassio.api.proxy] /homeassistant/api/services/scene/turn_on access from 03d23610_dasshio
18-11-30 08:25:09 INFO (MainThread) [hassio.api.proxy] /homeassistant/api/services/scene/turn_on access from 03d23610_dasshio
18-11-30 08:27:09 INFO (MainThread) [hassio.api.proxy] /homeassistant/api/services/scene/turn_on access from 03d23610_dasshio
18-11-30 08:29:09 INFO (MainThread) [hassio.api.proxy] /homeassistant/api/services/scene/turn_on access from 03d23610_dasshio
18-11-30 08:31:09 INFO (MainThread) [hassio.api.proxy] /homeassistant/api/services/scene/turn_on access from 03d23610_dasshio

Add MQTT support?

I love this, it's almost exactly what I was looking for. If I could offer some feature suggestion, however, it would be to add some MQTT support.

I'm still new to HA and MQTT in general, but if it was possible to specify the broker, the topic and the message to be sent, all within the config json, that would be awesome, and go a long way towards what I'm hoping to achieve with the system.

Thank you :)

Collaboration

Hi @JulianKahnert!

This is my dasshio repository. It was originally cloned from your amazon-dashbutton one (https://github.com/JulianKahnert/amazon-dashbutton). As you can see is pretty much the same but I have changed its shape to work as a Hass.io add-on.

I know it is not a big thing, but as I took your work as a basis, I would like to show you this kind of fork and collaborate if you are interested on a hass.io integration like this.

Cheers!

Edit: I have not forked you repo directly because it think this is something different. However, if you'd like so I can fork it and cherrypick the changes. Just tell me! Thanks

Even though the button is pressed one Dasshio is acting as if pressed multiple times

Hi! Love the add-on and have 15 buttons configured.. But on some of them, when I press the button once, it acts as if I am pressing it multiple times.. Ie. It waits until the time out.. and then acts as if it was pressed a second time.. This happens for about 45 seconds... Is there anything I can do to prevent this from happening? The workaround, is in Node-Red to not let the Boolean (which I have linked to the button) act upon the Home Assistant action for 1 minutes after the first press.. (in the process of implementing this)... It should work, but curious as to why Dasshio would act is if the button is pressed more than once.. The light on the button, indeed stays on for about that period of time, but that is above the 20 seconds default. So either I am doing something wrong and/or I've got defective buttons or?

Thanks again for such a fabulous add-on!

HassOS, VMDK - Status Code 401, Bad Request

Running HassOS VMDK 1.8, I get a status code of 401 status code after each button press.

{
  "timeout": 10,
  "buttons": [
    {
      "name": "Living Room | Accessory",
      "address": "12:34:56:78:90:ab",
      "domain": "switch",
      "service": "toggle",
      "service_data": "{\"entity_id\": \"switch.living_room_accessory\"}"
    }
  ]
}
2018-07-23 22:44:25,412 | INFO | Living Room | Accessory button pressed!
2018-07-23 22:44:25,414 | INFO | Request: http://hassio/homeassistant/api/services/switch/toggle
2018-07-23 22:44:25,431 | INFO | Status Code: 401
2018-07-23 22:44:25,432 | ERROR | Bad request
2018-07-23 22:44:25,450 | INFO | Packet captured, waiting 10s ...

Cannot use tts successfully.

Hi,

I hope you can help. I am trying to use the Dash button as a doorbell so that my Google home speakers say "Someone is at the door" when it is pressed.

I have successfully set it up to control a smart bulb but the doorbell setup will not work.

My Dashio config looks like this:

{
"timeout": 20,
"buttons": [
{
"name": "Doorbell",
"address": "XX:XX:XX:XX:XX:XX",
"domain": "media_player",
"service": "tts.google_say",
"service_data": "{"entity_id": "media_player.downstairs", "message": "'someones at the door'"}"
}
]
}

And the log when I press the button reads:

Log
starting version 3.2.4
WARNING: No route found for IPv6 destination :: (no default route?). This affects only IPv6
2018-03-22 18:48:19,912 | INFO | Reading config file: /data/options.json
2018-03-22 18:48:19,922 | INFO | Starting sniffing...
2018-03-22 18:48:23,523 | INFO | Doorbell button pressed!
2018-03-22 18:48:23,526 | INFO | Request: http://hassio/homeassistant/api/services/media_player/tts.google_say

So it recognised the button press and there are no errors generated, but nothing come out of the speakers. TTS seems to work fine through the media player widgets on the overview page of Home Assistant.

Any help would be much appreciated.

Nick.

Edit: masked MAC address.

Problem with new install

Fresh Ubuntu 16.04LTS w/updates, HASSIO Docker install, Supervisor 0.78, Host OS 0.3, Home Assistant 0.60

I add the dassho repo, go to install. click Install, the button lights up goes back to default and the following is shown in error log.

Any ideas where to being looking for the issue?

Thank you.

``
18-01-05 03:51:24 INFO (SyncWorker_4) [hassio.dock.addon] Start build 03d23610/amd64-addon-dasshio:0.2.0
18-01-05 03:51:24 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/aiohttp/web_protocol.py", line 410, in start
resp = yield from self._request_handler(request)
File "/usr/lib/python3.6/site-packages/aiohttp/web.py", line 325, in _handle
resp = yield from handler(request)
File "/usr/lib/python3.6/site-packages/aiohttp/web_middlewares.py", line 93, in impl
return (yield from handler(request))
File "/usr/lib/python3.6/site-packages/hassio/api/util.py", line 33, in wrap_api
answer = await method(api, *args, **kwargs)
File "/usr/lib/python3.6/site-packages/hassio/addons/addon.py", line 515, in install
if not await self.docker.install(self.last_version):
File "/usr/lib/python3.6/site-packages/hassio/dock/util.py", line 18, in wrap_api
return await method(api, *args, **kwargs)
File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/lib/python3.6/site-packages/hassio/dock/addon.py", line 251, in _install
return self._build(tag)
File "/usr/lib/python3.6/site-packages/hassio/dock/addon.py", line 264, in _build
image = self.docker.images.build(**build_env.get_docker_args(tag))
File "/usr/lib/python3.6/site-packages/docker/models/images.py", line 179, in build
raise BuildError(chunk['error'])
docker.errors.BuildError: Please provide a source image with from prior to commit
`

Integrate find_button

Integrate find_button.py into main functionality.
Testing with setup of a new button is needed: Connect a dash button to wifi for the first time while this ad-on is running and check new MAC appears in log

Any way to stop the "Your dash button is almost ready" notification?

Is there any way to stop the "Your dash button is almost ready" notification on your phone without turning off all amazon notifications? I dont suppose there is

P.S. thanks for such an easy to use addon, the other methods I looked at to get a dash button working seamed lots more complicated. I found it super simple to setup (can I give a bit of feedback on the readme notes. I did spend a while trying to edit the /data/options.json file until I realised the config is done in the addon config within HASSIO you dont have to ssh into the pi to edit the file).

Many Thanks

Installation failing

Raspberry Pi 3B+ running latest 32bit hassio image.
The only other addons I have install are Duckdns and SSH server.

Clicking install does nothing, here is the log.
Sorry if I've done something stupid :)

19-03-11 12:53:34 INFO (SyncWorker_14) [hassio.docker.interface] Pull image danimtb/armv7-dasshio tag 0.3.1.
19-03-11 12:53:36 ERROR (SyncWorker_14) [hassio.docker.interface] Can't install danimtb/armv7-dasshio:0.3.1 -> 404 Client Error: Not Found ("pull access denied for danimtb/armv7-dasshio, repository does not exist or may require 'docker login'").

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.