puttyman / hass-amplifi Goto Github PK
View Code? Open in Web Editor NEWA home assistant integration for Ubiquiti Amplifi
A home assistant integration for Ubiquiti Amplifi
Hi there, in the newest version of HomeAssistant (2023.2.2) the following error pops up on starting. It looks like compatibility of this awesome Amplifi integration will (partially) break as of version 2023.3. I hope it is possible to amend the integration to ensure it keeps working after 2023.3.
Logger: homeassistant.helpers.frame
Source: helpers/frame.py:77
First occurred: 08:10:51 (1 occurrences)
Last logged: 08:10:51
Detected integration that called async_setup_platforms instead of awaiting async_forward_entry_setups; this will fail in version 2023.3. Please report issue to the custom integration author for amplifi using this method at custom_components/amplifi/init.py, line 37: hass.config_entries.async_setup_platforms(entry, PLATFORMS)
Getting the following error message in the logs after updating to 2.0.0:
To try and resolve the issue I have:
My HA is containered, and running the following version:
How do I set this up? What trigger would I use to send a notification when an unknown device connects to my Wifi?
There is a problem that would be nice to fix. I have an amplifi with a satellite. When the connection of the telephone, it jumps from the base to the satellite, it stops being activated in the base and therefore its status is "away from home". Is there something that can be done?
I would like to have a list of devices connected to Amplifi in my HA dashboard. The documentation seems to hint that this is possible. I do see a list of entities created by the Integration but by default most of them are disables. So I manually enabled some of them and I can check status for them but I would like to have the list of all connected devices updated automatically if possible.
And it would then be really neat if I could get a notification if a new device connects to my Amplifi.
Is this possible?
Hello, just want to thank you for this great extension to Home Assistant. I currently use it to notify my when my SPA looses power so it does not freeze over during the wintermonths. Thanks for your work and the fact that you made so easy to integrate for others. Thanks alot!
I installed the repo through HACS, but I could not find the integration in Config -> Integrations -> Add
The component is in custom_components folder, restarted HA many times, cleared browser cache, no joy.
Is it compatible with HA 2022.6.7?
Thank you.
Thanks for developing this integration!
Does anyone know if this works with the Amplifi Instant line?
I am using HACS to install this integration. I download it in HACS, then restart as directed.
I can now find the integration in the "Add Integration" feature in HA. It opens the dialog box that allows me to enter the host and password, but when I click "Submit" it says:
"Enable to connect to amplifi router"
I can't see any steps that I have missed in the setup instructions, now do I see anywhere I have to "Enable" as it is suggesting.
Can you please let me know what I have missed?
I can't for the life of me get presence detection to work with this.
Hi,
Thanks for your integration.
From what I can read it is the perfect solution for some of my automation requirements.
But:
I did a mistake the first time I installed it, whee I used the SSID password not the admin password.
(For some reason it's possible to log in also using the SSID password, but the integration didn't return any enteties etc).
To solve this I uninstalled and installed the integration a second time.
The problem is that the config screen doesn't come up again. I've tried uninstalling / reinstalling several times, with restarting HA in between.
Any ideas how to solve this?
It might be that there is some config-files I need to clean up manually as well?
I tried deleting what I found in the core.config_entries file, where I found some data realted to this bu that haven't helped so far.
I have assigned DHCP serving to my firewall. In the AMPLIFI app I can still see all devices but since making this change I can not see devices in Home assistant.
Is there a simple change I can make to allow the integration to continue working while the AMPLIFI router is in bridge mode?
Since update to HA 2024.1 there is a deprecation warning:
SOURCE_TYPE_ROUTER was used from amplifi, this is a deprecated constant which will be removed in HA Core 2025.1. Use SourceType.ROUTER instead, please create a bug report at https://github.com/puttyman/hass-amplifi/issues
This constants warning affects many integrations and also for the Amplifi integration.
Hi,
I just updated to the lastest version and HA logs started showing the following error. Fixing the indentation error of @property
on line 140 resolves the error.
Logger: homeassistant.loader
Source: loader.py:796
First occurred: 06:59:29 (1 occurrences)
Last logged: 06:59:29
Unexpected exception importing platform custom_components.amplifi.device_tracker
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/loader.py", line 779, in get_platform
cache[full_name] = self._import_platform(platform_name)
File "/usr/src/homeassistant/homeassistant/loader.py", line 796, in _import_platform
return importlib.import_module(f"{self.pkg_path}.{platform_name}")
File "/usr/local/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 879, in exec_module
File "<frozen importlib._bootstrap_external>", line 1017, in get_code
File "<frozen importlib._bootstrap_external>", line 947, in source_to_code
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/config/custom_components/amplifi/device_tracker.py", line 141
def entity_registry_enabled_default(self) -> bool:
IndentationError: unexpected unindent
Logger: homeassistant.setup
Source: setup.py:347
First occurred: 06:59:29 (1 occurrences)
Last logged: 06:59:29
Unable to prepare setup for platform amplifi.device_tracker: Platform not found (Exception importing custom_components.amplifi.device_tracker).
Sadly I can't revert to previous version, since these updates arent seperate releases
.
When deleting the config entry, the following error is raised:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 780, in async_unload
await self._async_process_on_unload(hass)
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 934, in _async_process_on_unload
if job := self._on_unload.pop()():
^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/amplifi/device_tracker.py", line 56, in async_unsub_discover_device_tracker
coordinator.async_remove_listener(async_discover_device_tracker)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'AmplifiDataUpdateCoordinator' object has no attribute 'async_remove_listener'. Did you mean: 'async_add_listener'?
The coordinator does not have an "async_remove_listener" function. This is the same error message mentioned in #40 but now I know what the issue actually is... I'm just not sure how to fix it right now. Raising this issue as something I hope to do in the future.
I get this error shortly after adding the integration and all related entities gets unavailable.
Logger: custom_components.amplifi.coordinator
Source: custom_components/amplifi/client.py:81
Integration: Amplifi (documentation, issues)
First occurred: 08:32:36 (21 occurrences)
Last logged: 08:35:56
Unexpected error fetching amplifi data: Session is closed
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 205, in _async_refresh
self.data = await self._async_update_data()
File "/config/custom_components/amplifi/coordinator.py", line 55, in _async_update_data
devices = await self._client.async_get_devices()
File "/config/custom_components/amplifi/client.py", line 26, in async_get_devices
return await self._async_get_info()
File "/config/custom_components/amplifi/client.py", line 81, in _async_get_info
resp = await self._client.post(info_async_url, data=form_data)
File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 399, in _request
raise RuntimeError("Session is closed")
RuntimeError: Session is closed
When reinitialising integration, there are a number of device tracker entities added for connected devices that are disabled by default. In my HA, I am trying to use this integration for general network observation with connected devices and throughput.
After enabling the disabled entities, after approx 5 minutes, the integration stops providing any entities at all.
This error message is found in home-assistant.log:
2023-11-02 20:57:17.059 ERROR (MainThread) [homeassistant.config_entries] Error unloading entry 172.20.0.1 for sensor Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 551, in async_unload await self._async_process_on_unload(hass) File "/usr/src/homeassistant/homeassistant/config_entries.py", line 685, in _async_process_on_unload if job := self._on_unload.pop()(): ^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/amplifi/__init__.py", line 41, in async_stop_coordinator coordinator._async_stop_refresh(None) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'AmplifiDataUpdateCoordinator' object has no attribute '_async_stop_refresh' 2023-11-02 20:57:17.077 ERROR (MainThread) [homeassistant.config_entries] Error unloading entry 172.20.0.1 for device_tracker Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 551, in async_unload await self._async_process_on_unload(hass) File "/usr/src/homeassistant/homeassistant/config_entries.py", line 685, in _async_process_on_unload if job := self._on_unload.pop()(): ^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/amplifi/device_tracker.py", line 56, in async_unsub_discover_device_tracker coordinator.async_remove_listener(async_discover_device_tracker) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'AmplifiDataUpdateCoordinator' object has no attribute 'async_remove_listener'
3 minutes earlier, there was also this error logged. This appears to be the actual time the entities stopped being provided:
2023-11-02 20:54:13.914 ERROR (MainThread) [homeassistant.config_entries] Error unloading entry 172.20.0.1 for sensor Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 543, in async_unload result = await component.async_unload_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 132, in async_unload_entry return await component.async_unload_entry(entry) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 202, in async_unload_entry raise ValueError("Config entry was never loaded!") ValueError: Config entry was never loaded! 2023-11-02 20:54:13.934 ERROR (MainThread) [homeassistant.config_entries] Error unloading entry 172.20.0.1 for device_tracker Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 543, in async_unload result = await component.async_unload_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/device_tracker/config_entry.py", line 81, in async_unload_entry return await component.async_unload_entry(entry) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 202, in async_unload_entry raise ValueError("Config entry was never loaded!") ValueError: Config entry was never loaded!
172.20.0.1 is the IP address of my Amplifi Router so why it is trying to be unloaded, I’m not entirely sure. My best guess is that Home Assistant is either disconnecting or switching to another mesh point and in momentarily disconnecting from the router, it tries to remove… the router? To rule out any issues with bouncing between mesh points, I will create an SSID only broadcast from one device so HA can’t roam and see if that solves the issue.
Any insight that anyone can offer into what is going on here would be greatly appreciated. Unfortunately I’m not massively experienced with Python at this level so I’m pushed for how far I can take this, but happy to lend a hand where I can.
Cheers
Hello, thanks so much for this integration. I bought the amplifi without checking/realizing there isn't a device-tracker component readily available so you saved my day(s).
The sensor seems really stable, but I have had a few times where my phone maybe sleeps or saves battery and it tracks as away even though I'm at home.
Is there any way to set a "consider home" timeout-period like with the standard device tracker? So that it ignores disconnected devices until they've been away for that amount of time.
Can this be changed so that entities show up as device trackers and can work with persons instead of sensors?
Loading now gives the message " ERROR (MainThread) [homeassistant.loader] No 'version' key in the manifest file for custom integration 'amplifi'. As of Home Assistant 2021.6, this integration will no longer be loaded. Please report this to the maintainer of 'amplifi' "
I'd really like to continue using this, so I hope iut will be possible to update it.
Michael
Hi. I am running on Hass.io (0.117.6). I was able to add the repository and install the component through HACS and it shows up under installed HACS integrations (and I checked the folder is also in the correct location), but even after restarting I am not able to search for it under Configuration -> Integration. I followed the instructions for installation, restarted HA, navigated to Configuration -> Integration, clicked the + and searched for Amplifi, but nothing shows up.
I have noted the caveat that says the session will be invalidated if you log in which I assume might be happening. I have not logged in to the AmpliFi web interface at all though.
Error shown in logs:
`Logger: homeassistant.config_entries
Source: custom_components/amplifi/coordinator.py:63
Integration: Amplifi (documentation, issues)
First occurred: 09:05:16 (1 occurrences)
Last logged: 09:05:16
Error setting up entry 10.23.23.65 for amplifi
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 304, in async_setup
result = await component.async_setup_entry(hass, self) # type: ignore
File "/config/custom_components/amplifi/init.py", line 32, in async_setup_entry
await coordinator.async_config_entry_first_refresh()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 156, in async_config_entry_first_refresh
await self._async_refresh(log_failures=False, raise_on_auth_failed=True)
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 265, in _async_refresh
update_callback()
File "/config/custom_components/amplifi/coordinator.py", line 63, in extract_wifi_devices
raw_wifi_devices = self.data[WIFI_DEVICES_IDX]
TypeError: 'NoneType' object is not subscriptable
`
If I remove the integration and re-set it up again it works immediately.
As soon as I restart Home Assistant the entity is not available and the above error is in the logs.
I've restarted the entire host and it still does not come back. Seems only if I remove the integration and re-setup it will work until such time as HA restarts.
I am running an AmpliFi Router HD (HW Revision 19) with Firmware 3.6.2
My entities are unavailable and my logfile is getting filled with this message:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 205, in _async_refresh
self.data = await self._async_update_data()
File "/config/custom_components/amplifi/coordinator.py", line 55, in _async_update_data
devices = await self._client.async_get_devices()
File "/config/custom_components/amplifi/client.py", line 26, in async_get_devices
return await self._async_get_info()
File "/config/custom_components/amplifi/client.py", line 81, in _async_get_info
resp = await self._client.post(info_async_url, data=form_data)
File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 399, in _request
raise RuntimeError("Session is closed")
RuntimeError: Session is closed
Does anyone know what might be the issue?
Firmware version 3.7.1
Amplifi Router HD
Would it be possible to add an entry to the wireless device tracker parameters that reports the MAC address of the mesh point that device is connected to?
Here's the context:
I've been mucking about with an ad-hoc presence sensor for my garage lights. I have an AmplifiHD mesh point set up in the garage, and an automation set up to toggle the lights based on the mesh point I'm connected to and the wifi signal strength.
What I'm trying to do is convert an existing binary sensor so that it taps into hass-amplifi rather than the HA mobile app. The app only seems to 'phone home' every 60 seconds, which is a long time to wait for the lights to come on!
garage_wifi: friendly_name: "Garage Wifi" value_template: > {% set bssid = states('sensor.phone_wifi_bssid_mobile_app') %} {% if bssid in ('XX:XX:XX:XX:XX:XX', 'YY:YY:YY:YY:YY:YY') %} true {% else %} false {% endif ##%}
From what I can see this should be possible. The topology map provided in the Amplifi web interface shows which mesh point the devices are connected to. Additionally I can see the hass-amplifi code referencing { "role" : "Router" }, while the JSON response from info-async.php also contains references to { "role" : "Extender" }.
I've tried to tackle this myself but honestly it's all a bit above my pay grade!
After about a week I find the Amplifi Wifi becomes really slow. Best solution seems to be a restart of the router. Would there be a way to do this from Home Assistant towards this hass-amplifi plugin? The app supports a remote restart.
I have tried setting this up on My Amplifi Mesh Point HD it Registers but it doesn't show any devices attached when I can see on the App there are devices running. It is running Firmware 3.4.4 Hardware Revision 3. Thankyou for any help you can provide.
Hi
I Get the following error continuously in the log:
`This error originated from a custom integration.
Logger: homeassistant
Source: custom_components/amplifi/coordinator.py:80
Integration: Amplifi (documentation, issues)
First occurred: 07:41:29 (43 occurrences)
Last logged: 07:48:29
Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 137, in _handle_refresh_interval
await self._async_refresh(log_failures=True, scheduled=True)
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 268, in _async_refresh
update_callback()
File "/config/custom_components/amplifi/coordinator.py", line 80, in extract_ethernet_ports
self._ethernet_ports = self.data[ETHERNET_PORTS_IDX][router_mac_addr]
KeyError: '74:83:c2:xx:xx:xx'
`
Any idea what’s wrong?
I'm having issue with the last step when entering hostname and password. I can't find in AmpliFi app any details regarding hostname. Do you mean 'Device name' under Settings > General???
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.