Coder Social home page Coder Social logo

eero_tracker's Introduction

Eero Device Tracker for Home Assistant

License hacs_badge

Adds device tracking support for Eero Mesh WiFi routers to Home Assistant.

This project is based on @343max's eero-client project -- many thanks to him or this project probably wouldn't exist. Thanks to @rsnodgrass for the structural improvements. This code has no warranties, and please submit any pull requests you might have to improve upon it.

Setup Process

  1. Install using HACS or manually copy the files
  2. Run the eero_tracker_instantiate.py script to setup credentials (creates an eero.session in /config)
  3. Add eero_tracker to your configuration.yaml
  4. Restart Home Assistant

Now let's get on with installin' this thing!

Step 1: Installation

Option A: Installation with Home Assistant Community Store (HACS)

For easy updates whenever a new version is released, use the Home Assistant Community Store (HACS) and add the following Integration in the Settings tab:

jrlucier/eero_tracker

Then go to the Integration tab, search for "Eero Tracker", and click install.

Option B: Manual Installation

Copy the scripts!

SSH into your device. Download the zip file from the releases section and uncompress it in your configuration directory (e.g. ~/.homeassistant or /config):

cd ~/.homeassistant/
wget https://github.com/jrlucier/eero_tracker/releases/download/1.0.10/eero_tracker-1.0.10.zip
unzip eero_tracker-1.0.10.zip

Step 2: Generate Credentials for Connecting to Your Eeros

Why do I need to run a script in my config directory?

Eero doesn't have a traditional user/password login setup, so we need to use your phone's SMS or your email address to create an authenticated session token (eero.session). To do that, you'll need to SSH into your device running Home Assistant to run an interactive script that allows that to occur.

Note for Hass.io users

If you're running Hass.io, be aware that the official SSH server will not allow you to run python files (so I'm told, and which we require), so use the Secure Shell community add-on. Your configuration directory will be stored under /config instead of ~/.homeassistant/.

An alternative method would be to run eero_tracker_instantiate.py on another machine, and then manually copy over the eero.session file to the config directory on the Home Assistant host.

Running the Script

The scripts in this project rely on the "requests" package, so install it if it's not already installed:

python3 -m pip install requests

We need to get an authenticated session created with Eero's servers. So to do that, you'll need to go to your configuration directory (eg: cd ~/.homeassistant), and run the eero_tracker_instantiate.py file:

python3 eero_tracker_instantiate.py

This will prompt you for your phone number (no dashes), and then it will send you an SMS text with a code you will need to put in. You may also use an email address instead. Once done, it will create an eero.session file in your configuration directory. Subsequent calls to this python file will dump the list of connected wireless devices, their mac addresses, and hostnames for easier reference. You technically shouldn't need eero_tracker_instantiate.py after the creation of the eero.session file, but I keep it around for quick mac address referencing.

Manual Installation Permissions

If you aren't running Hass.io (whose default SSH user is root), and have Home Assistant configured differently, then check the permissions on the files. chown the files to the same permissions as your other HA configuration files (ls -al to check yours in your configuration directory). Mine are owned by homeassistant:nogroup:

sudo chown homeassistant:nogroup eero.session
sudo chown homeassistant:nogroup eero_tracker_instantiate.py 
sudo chown -R homeassistant:nogroup custom_components/

Step 3: Add Tracker to Home Assistant's Configuration

Now that that installation and authentication are done, all that is left is to add the device_tracker to your configuration.yaml.

The minimum required configuration:

device_tracker:
  - platform: eero_tracker

Example including optional configuration:

device_tracker:
  - platform: eero_tracker

    # optional eero_tracker settings:
    only_macs: "11:22:33:44:55:66,22:22:22:22:22:22"
    only_networks:
      - 30120

    # standard device_tracker options
    consider_home: 300     # default: 180
    interval_seconds: 30   # default: 25
    only_wireless: True    # default: True

Config Keys

Key Default Description
only_macs none comma separated list of MAC addresses that reduces the devices monitored to a smaller set.
interval_seconds 180 must be 25 seconds or greater to avoid DDoS of eero's servers.
only_networks none YAML list of network identifiers to search for devices (only useful if you have multiple eero locations under a single eero email address, for instance at work or a second home). Turn on HA debug logging to determine the network ids for your eeros
only_wireless True only track wireless devices if set to true (normally hardwired devices are not useful for tracking)

For additional device tracker configuration options, see the HA device_tracker docs.

Step 4: Restart and Test

You should see wireless devices populate using each device's nicknames, where possible, as the device name.

NOTE: This does not populate any devices that are not wirelessly connected to your eero.

Support

If you are experiencing any issues, first check the community support discussion thread to see if anyone else has solved your issue previously. You can also discuss the issue you are having there. If you feel it is a bug, please create an github Issue with the details.

Not Yet Implemented

The following features are not yet implemented (no plans currently for adding). If you are interested in contributing code, please submit a patch.

  • support for family profiles (pause/unpause switch) and assigning to Home Assistant "person" entities
  • support for rebooting the eero network
  • eero connection status and most recent upload/download speed test results
  • config_flow to allow all configuration through the Home Assistant UI (including eero.session setup)

See Also

eero_tracker's People

Contributors

cogwirrel avatar humphrep avatar jrlucier avatar ronaldheft avatar rsnodgrass avatar sstratoti 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

Watchers

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

eero_tracker's Issues

integration not showing up

I've tried installing both methods (through HASC and manual), I've removed browser cache, I've restarted server, rebooted host, uninstalled, re-installed but whatever I do I cannot get the integration to show up. Any help would be greatly appreciated.

Updated eero_tracker with new features

Updated eero_tracker with new features. @jrlucier please release whenever you are comfortable.

  • added only_networks option to allow specifying which eero networks to include (in case multiple networks are under a single email address, like a work network or second home)
  • added only_wireless option (defaulted on) to enable configuring whether non-wireless devices are tracked
  • updated to README to describe new features
  • code cleanup and logging improvements

Custom Updater is not working

I tried to add the custom updater component and it isn't showing up in my card. I have other custom components that do show up, so I believe I have my side set up correctly.

This is the url I am using:

https://raw.githubusercontent.com/jrlucier/eero_tracker/master/custom_updater.json

Here are the current contents of that file:
{
"device_tracker.eero_tracker": {
"updated_at": "2019-04-21",
"version": "1.0.4",
"local_location": "/custom_components/eero_tracker/device_tracker.py",
"remote_location": "https://raw.githubusercontent.com/jrlucier/eero_tracker/master/custom_components/eero_tracker/device_tracker.py",
"visit_repo": "https://github.com/jrlucier/eero_tracker",
"changelog": "https://github.com/jrlucier/eero_tracker/releases"
}
}

Integration Fails to pull eero configuration despite correct authentication credentials

Configured this on a hass.io runing 2022.2.8
Configured the eero.session as indicated and added the minimum requirements under configuration.yaml but getting the following errors:

2022-02-18 20:39:24 WARNING (MainThread) [homeassistant.util.async_] Detected blocking call inside the event loop. This is causing stability issues. Please report issue to the custom component author for eero_tracker doing blocking calls at custom_components/eero_tracker/eero.py, line 96: response = requests.post(self.API_ENDPOINT.format(action), **kwargs)
2022-02-18 20:39:24 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 435, in _handle_request
    resp = await request_handler(request)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 98, in forwarded_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 79, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 219, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 137, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 164, in post
    return await super().post(request, flow_id)
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 62, in wrapper
    result = await method(view, request, *args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 111, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 252, in async_configure
    result = await self._async_handle_step(flow, cur_step["step_id"], user_input)
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 325, in _async_handle_step
    result: FlowResult = await getattr(flow, method)(user_input)
  File "/config/custom_components/eero_tracker/config_flow.py", line 37, in async_step_user
    self.token = self.eero.login(self.username)
  File "/config/custom_components/eero_tracker/eero.py", line 27, in login
    data = self.client.post('login', json=json)
  File "/config/custom_components/eero_tracker/eero.py", line 96, in post
    response = requests.post(self.API_ENDPOINT.format(action), **kwargs)
  File "/usr/local/lib/python3.9/site-packages/requests/api.py", line 117, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/requests/api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 529, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 645, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/requests/adapters.py", line 440, in send
    resp = conn.urlopen(
  File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 703, in urlopen
    httplib_response = self._make_request(
  File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 398, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/local/lib/python3.9/site-packages/urllib3/connection.py", line 239, in request
    super(HTTPConnection, self).request(method, url, body=body, headers=headers)
  File "/usr/local/lib/python3.9/http/client.py", line 1279, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/local/lib/python3.9/http/client.py", line 1290, in _send_request
    self.putrequest(method, url, **skips)
  File "/usr/local/lib/python3.9/site-packages/urllib3/connection.py", line 219, in putrequest
    return _HTTPConnection.putrequest(self, method, url, *args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/util/async_.py", line 166, in protected_loop_func
    check_loop(func, strict=strict)
  File "/usr/src/homeassistant/homeassistant/util/async_.py", line 154, in check_loop
    raise RuntimeError(
RuntimeError: Blocking calls must be done in the executor or a separate thread; Use `await hass.async_add_executor_job()` at custom_components/eero_tracker/eero.py, line 96: response = requests.post(self.API_ENDPOINT.format(action), **kwargs)

Running in docker container--don't see the instantiate script.

Hi, I have the following files installed in my docker config folder for this custom component after installing from HACS:

device_tracker.py
init.py
manifest.json
services.yaml

I'm not sure where the script is I'm supposed to execute to finish install. I'm new to HA and HACS so I may be missing something obvious!

No devices appearing after installation + restart

Hi there, excited to try out this functionality. Wondering if you or @rsnodgrass can help me figure out what I'm doing wrongly. I installed this integration with HACS and then generated eero.session on another computer and copied the file contents over to /config/eero.session on my RPi and restarted Home Assistant.

Where would I find logs output so I can dig deeper into why 20+ minutes later no new entities were added? I've checked Logbook, Developer Tools -> Logs, and even Supervisor -> System -> System log. Don't see any mention of eero. I imagine I need to change the log level?

Thanks so much!

Any other things from the API?

Been using this for a while with great success (so thank you!)

Are there any other things available from the API?
Profile WiFi pausing, eero security reports, update versions?

I had a look but couldn’t figure out how to connect via the API.

Just a thought, not an issue at all

Device nicknames not updating.

Using the default configuration in configuration.yaml:

device_tracker:
  - platform: eero_tracker
    consider_home: 300
    interval_seconds: 60 

The device nicknames do not update when they are changed from the eero app. The mac addresses show just fine, and outside the names, there doesn't seem to be any issues. I have tried restarting the eero app, the modem, the eero router, and I've attempted to re-run eero_tracker_instantiate.py

Note: when re-running eero_tracker_instantiate.py the sytems obviously sees the nicknames, because they are printed out to the std.out

Seems to be something about not-updating. Because when I first installed the eero tracker on my HA, it picked up the ONE device that I had already given a nickname in the eero app. However, I have since changed the name of this one device, and the new nickname has not been reflected in the hassio interface.

HA version: 0.101.3

eeroOS version: 3.17.0

raspberry pi3

Let me know if you need any other details. (thanks for this sweet add on!)

Eero Connection Failure

I have been running eero_tracker for over a year with no issues even during migration period. Today the below started and i have tried uninstall/reinstall including new eero.session file and cannot solve this.

HA version 108.4
eero_tracker version 1.0.6 via HACS

Eero connection failure: error.session.invalid

Logger: custom_components.eero_tracker.device_tracker
Source: custom_components/eero_tracker/device_tracker.py:95

2020-04-14 19:27:54 ERROR (SyncWorker_7) [custom_components.eero_tracker.device_tracker] Eero connection failure: error.session.invalid
2020-04-14 19:27:54 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/device_tracker/setup.py", line 161, in async_device_tracker_scan
found_devices = await scanner.async_scan_devices()
File "/usr/src/homeassistant/homeassistant/components/device_tracker/legacy.py", line 482, in async_scan_devices
return await self.hass.async_add_job(self.scan_devices)
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/eero_tracker/device_tracker.py", line 95, in scan_devices
self._update_info()
File "/config/custom_components/eero_tracker/device_tracker.py", line 114, in _update_info
for network in self.__account['networks']['data']:

Any help would be much appreciated.

BTW...awesome addon

Eric

Home Assistant Error: Error setting up platform legacy

I have just set this integration up running the latest version of home assistant and I am receiving the following error on start up and I do not see any device trackers listed for my devices.

Home Assistant Version: 105.5
HACS Eero Tracker Install: 1.0.5

Error from Home Assistant:
Wed Feb 19 2020 20:26:18 GMT-0600 (Central Standard Time)
Error setting up platform legacy
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/device_tracker/setup.py", line 64, in async_setup_legacy
self.platform.get_scanner, hass, {DOMAIN: self.config}
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/eero_tracker/device_tracker.py", line 35, in get_scanner
return EeroDeviceScanner(hass, config[DOMAIN])
File "/config/custom_components/eero_tracker/device_tracker.py", line 56, in init
self.__scan_interval = int(config[CONF_SCAN_INTERVAL])
TypeError: int() argument must be a string, a bytes-like object or a number, not 'datetime.timedelta'

Unable to add integration (Unknown Error Occurred) - Logs attached

I am having issues logging into the integration. I was first linked to an Amazon account so I created a new account with an email. This did not fix the problem, which I have seen as a solution for other people. The logs are showing the following error.

Logger: homeassistant.util.async_
Source: util/async_.py:159
First occurred: 09:20:19 (5 occurrences)
Last logged: 09:20:48

Detected blocking call to putrequest inside the event loop. This is causing stability issues. Please report issue to the custom integration author for eero_tracker doing blocking calls at custom_components/eero_tracker/eero.py, line 96: response = requests.post(self.API_ENDPOINT.format(action), **kwargs)

Any help is appreciated. Thanks!

Deprecated folder structure

From the logs:

Integrations need to be in their own folder. Change device_tracker/eero_tracker.py to eero_tracker/device_tracker.py. This will stop working soon.

HA 113.2 Error doing job: Task exception was never retrieved


HA ver 113.2
python ver 3.8.3
host os HassOS 4.11
installation type Home Assistant OS
eero Mesh WiFi Device Tracker ver 1.0.7


I just upgraded to HA 113.2 and now my log is flooded with the below error message:

2020-07-29 01:10:07 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/device_tracker/setup.py", line 161, in async_device_tracker_scan
found_devices = await scanner.async_scan_devices()
File "/usr/src/homeassistant/homeassistant/components/device_tracker/legacy.py", line 482, in async_scan_devices
return await self.hass.async_add_job(self.scan_devices)
File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/eero_tracker/device_tracker.py", line 105, in scan_devices
self._update_info()
File "/config/custom_components/eero_tracker/device_tracker.py", line 119, in _update_info
self.__account = self._account()
File "/config/custom_components/eero_tracker/device_tracker.py", line 202, in _account
return self._refreshed(lambda: self._get_req('account', cookies=self._cookie_dict))
File "/config/custom_components/eero_tracker/device_tracker.py", line 172, in _refreshed
return func()
File "/config/custom_components/eero_tracker/device_tracker.py", line 202, in
return self._refreshed(lambda: self._get_req('account', cookies=self._cookie_dict))
File "/config/custom_components/eero_tracker/device_tracker.py", line 236, in _get_req
return self._parse_response(response)
File "/config/custom_components/eero_tracker/device_tracker.py", line 222, in _parse_response
data = json.loads(response.text)
File "/usr/local/lib/python3.8/json/init.py", line 357, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.8/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/lib/python3.8/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None

web_protocol.py (ERROR)

The tracker works, but it is filling my log with errors. Here is an example of what I am seeing:

Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/aiohttp/web_protocol.py", line 275, in data_received
messages, upgraded, tail = self._request_parser.feed_data(data)
File "aiohttp_http_parser.pyx", line 523, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: invalid HTTP method

I am on the latest versions (Hass.io and your tracker).

Eero tracker will stop working after HA 2021.6 - version key missing

See below log entry

Logger: homeassistant.loader
Source: loader.py:786
First occurred: 3:21:02 PM (1 occurrences)
Last logged: 3:21:02 PM

No 'version' key in the manifest file for custom integration 'eero_tracker'. As of Home Assistant 2021.6, this integration will no longer be loaded. Please report this to the maintainer of 'eero_tracker'

raw_input -> input in Python3

Running into an issue (line 138)
‘raw_input’ is not defined

EDIT: seems raw_input() was replaced with input()
Amending the 2 references fixed it (raised a change on your git)

Ability to delete device.tracker objects in HA

So I was troubleshooting my install and commented out "only_macs" section. Immediately realized how bad of a decision that was as suddenly 89 new device.tracker entities became available. How can I delete these as the option is greyed out.

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.