diff --git a/atom.xml b/atom.xml index 3f3c454347..03d9c72500 100644 --- a/atom.xml +++ b/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Home Assistant]]> - 2017-04-28T11:38:40+00:00 + 2017-04-28T14:30:40+00:00 https://home-assistant.io/ diff --git a/blog/categories/announcements/atom.xml b/blog/categories/announcements/atom.xml index c6cc9534a1..746ee8d1cf 100644 --- a/blog/categories/announcements/atom.xml +++ b/blog/categories/announcements/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Announcements | Home Assistant]]> - 2017-04-28T11:38:40+00:00 + 2017-04-28T14:30:40+00:00 https://home-assistant.io/ diff --git a/blog/categories/community/atom.xml b/blog/categories/community/atom.xml index 58b83b798c..66fa53ba3d 100644 --- a/blog/categories/community/atom.xml +++ b/blog/categories/community/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Community | Home Assistant]]> - 2017-04-28T11:38:40+00:00 + 2017-04-28T14:30:40+00:00 https://home-assistant.io/ diff --git a/blog/categories/device-tracking/atom.xml b/blog/categories/device-tracking/atom.xml index 2cc02795f5..04bc0e7e63 100644 --- a/blog/categories/device-tracking/atom.xml +++ b/blog/categories/device-tracking/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Device-Tracking | Home Assistant]]> - 2017-04-28T11:38:40+00:00 + 2017-04-28T14:30:40+00:00 https://home-assistant.io/ diff --git a/blog/categories/esp8266/atom.xml b/blog/categories/esp8266/atom.xml index 2dee7d3ac3..e2b2dbaea0 100644 --- a/blog/categories/esp8266/atom.xml +++ b/blog/categories/esp8266/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: ESP8266 | Home Assistant]]> - 2017-04-28T11:38:40+00:00 + 2017-04-28T14:30:40+00:00 https://home-assistant.io/ diff --git a/blog/categories/how-to/atom.xml b/blog/categories/how-to/atom.xml index ef9e525afd..5d770cb1de 100644 --- a/blog/categories/how-to/atom.xml +++ b/blog/categories/how-to/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: How-To | Home Assistant]]> - 2017-04-28T11:38:40+00:00 + 2017-04-28T14:30:40+00:00 https://home-assistant.io/ diff --git a/blog/categories/ibeacons/atom.xml b/blog/categories/ibeacons/atom.xml index dc1a3b59dd..e4f1944503 100644 --- a/blog/categories/ibeacons/atom.xml +++ b/blog/categories/ibeacons/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: iBeacons | Home Assistant]]> - 2017-04-28T11:38:40+00:00 + 2017-04-28T14:30:40+00:00 https://home-assistant.io/ diff --git a/blog/categories/internet-of-things/atom.xml b/blog/categories/internet-of-things/atom.xml index f2d1923bee..3de777530b 100644 --- a/blog/categories/internet-of-things/atom.xml +++ b/blog/categories/internet-of-things/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Internet-of-Things | Home Assistant]]> - 2017-04-28T11:38:40+00:00 + 2017-04-28T14:30:40+00:00 https://home-assistant.io/ diff --git a/blog/categories/iot-data/atom.xml b/blog/categories/iot-data/atom.xml index fa5c5ba570..58e5431c89 100644 --- a/blog/categories/iot-data/atom.xml +++ b/blog/categories/iot-data/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: IoT-Data | Home Assistant]]> - 2017-04-28T11:38:40+00:00 + 2017-04-28T14:30:40+00:00 https://home-assistant.io/ diff --git a/blog/categories/merchandise/atom.xml b/blog/categories/merchandise/atom.xml index 5f2e59e89a..aec84582a5 100644 --- a/blog/categories/merchandise/atom.xml +++ b/blog/categories/merchandise/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Merchandise | Home Assistant]]> - 2017-04-28T11:38:40+00:00 + 2017-04-28T14:30:40+00:00 https://home-assistant.io/ diff --git a/blog/categories/micropython/atom.xml b/blog/categories/micropython/atom.xml index 34be762bfd..961d18f6f3 100644 --- a/blog/categories/micropython/atom.xml +++ b/blog/categories/micropython/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Micropython | Home Assistant]]> - 2017-04-28T11:38:40+00:00 + 2017-04-28T14:30:40+00:00 https://home-assistant.io/ diff --git a/blog/categories/mqtt/atom.xml b/blog/categories/mqtt/atom.xml index b4185fbbc6..23973ff2cd 100644 --- a/blog/categories/mqtt/atom.xml +++ b/blog/categories/mqtt/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: MQTT | Home Assistant]]> - 2017-04-28T11:38:40+00:00 + 2017-04-28T14:30:40+00:00 https://home-assistant.io/ diff --git a/blog/categories/organisation/atom.xml b/blog/categories/organisation/atom.xml index 15dca438cb..6c9db86ba8 100644 --- a/blog/categories/organisation/atom.xml +++ b/blog/categories/organisation/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Organisation | Home Assistant]]> - 2017-04-28T11:38:40+00:00 + 2017-04-28T14:30:40+00:00 https://home-assistant.io/ diff --git a/blog/categories/owntracks/atom.xml b/blog/categories/owntracks/atom.xml index f16cb276c3..38b8e9ee0c 100644 --- a/blog/categories/owntracks/atom.xml +++ b/blog/categories/owntracks/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: OwnTracks | Home Assistant]]> - 2017-04-28T11:38:40+00:00 + 2017-04-28T14:30:40+00:00 https://home-assistant.io/ diff --git a/blog/categories/presence-detection/atom.xml b/blog/categories/presence-detection/atom.xml index 742c220ff7..8958aa6b90 100644 --- a/blog/categories/presence-detection/atom.xml +++ b/blog/categories/presence-detection/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Presence-Detection | Home Assistant]]> - 2017-04-28T11:38:40+00:00 + 2017-04-28T14:30:40+00:00 https://home-assistant.io/ diff --git a/blog/categories/public-service-announcement/atom.xml b/blog/categories/public-service-announcement/atom.xml index 96cafd71ce..382ec2e903 100644 --- a/blog/categories/public-service-announcement/atom.xml +++ b/blog/categories/public-service-announcement/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Public-Service-Announcement | Home Assistant]]> - 2017-04-28T11:38:40+00:00 + 2017-04-28T14:30:40+00:00 https://home-assistant.io/ diff --git a/blog/categories/release-notes/atom.xml b/blog/categories/release-notes/atom.xml index 82d3595b90..5aeaaa88e2 100644 --- a/blog/categories/release-notes/atom.xml +++ b/blog/categories/release-notes/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Release-Notes | Home Assistant]]> - 2017-04-28T11:38:40+00:00 + 2017-04-28T14:30:40+00:00 https://home-assistant.io/ diff --git a/blog/categories/survey/atom.xml b/blog/categories/survey/atom.xml index b81912e005..9fe40ba88b 100644 --- a/blog/categories/survey/atom.xml +++ b/blog/categories/survey/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Survey | Home Assistant]]> - 2017-04-28T11:38:40+00:00 + 2017-04-28T14:30:40+00:00 https://home-assistant.io/ diff --git a/blog/categories/talks/atom.xml b/blog/categories/talks/atom.xml index 5b99904762..b95bc63133 100644 --- a/blog/categories/talks/atom.xml +++ b/blog/categories/talks/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Talks | Home Assistant]]> - 2017-04-28T11:38:40+00:00 + 2017-04-28T14:30:40+00:00 https://home-assistant.io/ diff --git a/blog/categories/technology/atom.xml b/blog/categories/technology/atom.xml index 52da302e49..7a13deb63c 100644 --- a/blog/categories/technology/atom.xml +++ b/blog/categories/technology/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Technology | Home Assistant]]> - 2017-04-28T11:38:40+00:00 + 2017-04-28T14:30:40+00:00 https://home-assistant.io/ diff --git a/blog/categories/user-stories/atom.xml b/blog/categories/user-stories/atom.xml index 67584c2b91..c3b9d4fe1b 100644 --- a/blog/categories/user-stories/atom.xml +++ b/blog/categories/user-stories/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: User-Stories | Home Assistant]]> - 2017-04-28T11:38:40+00:00 + 2017-04-28T14:30:40+00:00 https://home-assistant.io/ diff --git a/blog/categories/video/atom.xml b/blog/categories/video/atom.xml index 288e7c7f08..678978976d 100644 --- a/blog/categories/video/atom.xml +++ b/blog/categories/video/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Video | Home Assistant]]> - 2017-04-28T11:38:40+00:00 + 2017-04-28T14:30:40+00:00 https://home-assistant.io/ diff --git a/blog/categories/website/atom.xml b/blog/categories/website/atom.xml index ae2b1e2212..65da73a8a1 100644 --- a/blog/categories/website/atom.xml +++ b/blog/categories/website/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Website | Home Assistant]]> - 2017-04-28T11:38:40+00:00 + 2017-04-28T14:30:40+00:00 https://home-assistant.io/ diff --git a/components/device_tracker.ubus/index.html b/components/device_tracker.ubus/index.html index a8abc89c5b..51b6491caf 100644 --- a/components/device_tracker.ubus/index.html +++ b/components/device_tracker.ubus/index.html @@ -67,7 +67,7 @@

This is one of the two ways we support OpenWRT. If you encounter problems, try luci.

-

This is a presence detection scanner for OpenWRT using ubus.

+

This is a presence detection scanner for OpenWRT using ubus. It scans for changes in hostapd.*, which will detect and report changes in devices connected to the access point on the router.

Before this scanner can be used you have to install the ubus RPC package on OpenWRT:

opkg install rpcd-mod-file
 
@@ -112,6 +112,103 @@ file
  • password (Required): The password for your given account.
  • See the device tracker component page for instructions how to configure the people to be tracked.

    +

    Troubleshooting

    +

    If you find that this never creates known_devices.yaml, or if you need more information on the communication chain between Home Assistant and OpenWRT, follow these steps to grab the packet stream and gain insight into what’s happening.

    +

    Increase Log Level

    +
      +
    1. On your Home Assistant device, stop Home Assistant
    2. +
    3. Adjust configuration.yaml to log more detail for the device_tracker component +
      logger:
      +  default: warn
      +  logs:
      + homeassistant.components.device_tracker: debug
      +
      +
      +
    4. +
    5. In another window, tail the logfile in the configuration directory: +
      $ tail -f home-assistant.log  | grep device_tracker
      +
      +
      +
    6. +
    7. If you see a python stack trace like the following, check your configuration for correct username/password. +
      17-04-28 10:43:30 INFO (MainThread) [homeassistant.loader] Loaded device_tracker from homeassistant.components.device_tracker
      +17-04-28 10:43:30 INFO (MainThread) [homeassistant.loader] Loaded device_tracker.ubus from homeassistant.components.device_tracker.ubus
      +17-04-28 10:43:30 INFO (MainThread) [homeassistant.setup] Setting up device_tracker
      +17-04-28 10:43:31 INFO (MainThread) [homeassistant.components.device_tracker] Setting up device_tracker.ubus
      +17-04-28 10:43:31 ERROR (MainThread) [homeassistant.components.device_tracker] Error setting up platform ubus
      +  File "/opt/homeassistant/venv/lib/python3.4/site-packages/homeassistant/components/device_tracker/__init__.py", line 152, in async_setup_platform
      +  File "/opt/homeassistant/venv/lib/python3.4/site-packages/homeassistant/components/device_tracker/ubus.py", line 36, in get_scanner
      +  File "/opt/homeassistant/venv/lib/python3.4/site-packages/homeassistant/components/device_tracker/ubus.py", line 58, in __init__
      +  File "/opt/homeassistant/venv/lib/python3.4/site-packages/homeassistant/components/device_tracker/ubus.py", line 156, in _get_session_id
      +  File "/opt/homeassistant/venv/lib/python3.4/site-packages/homeassistant/components/device_tracker/ubus.py", line 147, in _req_json_rpc
      +17-04-28 10:43:31 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_registered[L]: domain=device_tracker, service=see>
      +17-04-28 10:43:31 INFO (MainThread) [homeassistant.core] Bus:Handling <Event component_loaded[L]: component=device_tracker>
      +
      +
      +
    8. +
    9. If you see lines like the following repeated at intervals that correspond to the check interval from the config (12 seconds by default), then Home Assistant is correctly polling the router, and you’ll need to look at what the router is sending back. +
      17-04-28 10:50:34 INFO (Thread-7) [homeassistant.components.device_tracker.ubus] Checking ARP
      +
      +
      +
    10. +
    +

    Inspect Packets With TCPDump

    +

    These steps require that tcpdump is installed on your Home Assistant device, and that you have a utility such as Wireshark for viewing the packets. It also assumes that Home Assistant is communicating with your router over HTTP and not HTTPS.

    +
      +
    1. On your Home Assistant device, stop Home Assistant
    2. +
    3. In another shell on your Home Assistant device, start tcpdump +
      $ sudo tcpdump -nnvXSs 0 -w /var/tmp/dt.out 'host <router_ip> and port 80'
      +
      +
      +
        +
      • In this example we are only looking for traffic to or from port 80, and we are writing the packet stream out to /var/tmp/dt.out
      • +
      +
    4. +
    5. Start Home Assistant
    6. +
    7. After a few seconds you should see a line like Got xx where xx is an incrementing number. This indicates that it has captured packets that match our filter. After you see this number increment a few times (>20), you can hit Ctrl-C to cancel the capture.
    8. +
    9. Transfer /var/tmp/dt.out to the machine where you’re running Wireshark and either drag/drop it onto the Wireshark window or use File/Open to open the capture file.
    10. +
    11. In the window that opens, look for the first line that reads POST /ubus. Right click on this line, choose Follow and then HTTP Stream to view just the HTTP stream for this connection.
    12. +
    13. The first POST will show Home Assistant logging into ubus and receiving a session identifier back. It will look something like this: +``` +POST /ubus HTTP/1.1 +Host: 10.68.0.1 +Accept: / +User-Agent: python-requests/2.13.0 +Connection: keep-alive +Accept-Encoding: gzip, deflate +Content-Length: 161
    14. +
    +

    {“jsonrpc”: “2.0”, “params”: [“00000000000000000000000000000000”, “session”, “login”, {“password”: “", "username": "root"}], "method": "call", "id": 1}

    +

    HTTP/1.1 200 OK +Date: Fri, 28 Apr 2017 12:04:46 GMT +Content-Type: application/json +Transfer-Encoding: chunked +Connection: keep-alive

    +

    {“jsonrpc”:”2.0”,”id”:1,”result”:[0,{“ubus_rpc_session”:”8b4e1632389fcfd09e96a792e01c332c”,”timeout”:300,”expires”:300,”acls”:{“access-group”:{“unauthenticated”:[“read”],”user”:[“read”]},”ubus”:{“”:[“”],”session”:[“access”,”login”]},”uci”:{“*”:[“read”]}},”data”:{“username”:”root”}}]}

    +
    9. In the response above, the portion that reads `"result":[0,` indicates that ubus accepted the login without issue. If this is not `0`, search online for what ubus status corresponds to the number you're receiving and address any issues that it brings to light.
    +10. Otherwise, back in the main Wireshark window click the `x` in the right side of the filter bar where it reads `tcp.stream eq 0`. Scroll down until you find the next `POST /ubus` line and view the HTTP stream again. This request is Home Assistant actually requesting information and will look something like the following:
    +
    +
    +

    POST /ubus HTTP/1.1 +Host: 10.68.0.1 +Accept: / +User-Agent: python-requests/2.13.0 +Connection: keep-alive +Accept-Encoding: gzip, deflate +Content-Length: 114

    +

    {“jsonrpc”: “2.0”, “params”: [“8b4e1632389fcfd09e96a792e01c332c”, “hostapd.*”, “”, {}], “method”: “list”, “id”: 1}

    +

    HTTP/1.1 200 OK +Date: Fri, 28 Apr 2017 12:04:46 GMT +Content-Type: application/json +Transfer-Encoding: chunked +Connection: keep-alive

    +

    {“jsonrpc”:”2.0”,”id”:1,”result”:{}} +```

    +
      +
    1. In this case we are actually receiving a valid response with no data. The request says that we are looking for ARP information from hostapd.*, which is the access point on the router. In my environment I don’t use the AP on the router, and so it was correctly returning no data. Armed with this information, I know that I cannot use this component for device tracking or presence.
    2. +
    +

    Cleanup

    +

    When you’re done troubleshooting, remember to reset your logging configuration and delete any capture files that contain sensitive information.