Commit Graph

50 Commits

Author SHA1 Message Date
David Rapan
ab5d60e33d Make DHCP discovery aware of the network integration (#144767)
Co-authored-by: J. Nick Koston <nick@koston.org>
2025-05-14 00:59:48 -05:00
J. Nick Koston
ba6ce28d3c Add DHCP discovery subscribe websocket API (#143106)
* Add DHCP discovery subscribe websocket API

* fix circular import

* fixes

* fixes

* fixes

* reduce

* reduce

* reduce

* fix tests

* fix tests

* rework

* tests

* reduce number of lines changed

* reduce
2025-04-21 10:25:04 -04:00
epenet
7b1b229718 Standardize homeassistant imports in component tests (a-l) (#136806) 2025-01-29 10:00:45 +01:00
epenet
b43379be7d Standardize helpers.xxx_registry imports (#136688)
Standardize registry imports
2025-01-28 08:48:34 +01:00
epenet
31c36beb2e Move DhcpServiceInfo to service_info helpers (#135658)
* Move DhcpServiceInfo to service_info helpers

* Fix mypy/pylint
2025-01-15 13:09:18 +01:00
epenet
6a3b4a6a23 Adjust minimum scapy version to 2.6.1 (#130565) 2024-11-13 17:49:39 -06:00
epenet
81a5722708 Fix flaky DHCP tests in CI (#129327) 2024-10-28 13:41:50 -10:00
Michael
8e9e738bb8 Fix ci (dhcp tests) (#128207)
remove unused import
2024-10-12 02:20:54 +02:00
Erik Montnemery
7ec911c4df Correct typing in rediscovery tests (#127777) 2024-10-07 08:42:04 +02:00
Erik Montnemery
7d61cb1ef5 Remove unignore flow (#126765) 2024-09-25 20:29:14 +02:00
Erik Montnemery
972dc89c0f Reinitialize dhcp discovery flow on config entry removal (#126556)
* Reinitialize dhcp discovery flow on unignore

* Tweak

* Rediscover on any removed config entry

* Adjust log message
2024-09-24 14:43:05 +02:00
Joost Lekkerkerker
6bb4e7d62c Bump ruff to 0.3.4 (#112690)
Co-authored-by: Sid <27780930+autinerd@users.noreply.github.com>
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
2024-03-26 00:02:16 +01:00
J. Nick Koston
e293afe46e Bump aiodhcpwatcher to 1.0.0 (#113469) 2024-03-14 14:16:19 -10:00
Marc Mueller
38adfbf1a3 Add empty line after module docstring [tests a-e] (#112708) 2024-03-08 08:50:25 -05:00
J. Nick Koston
122ac059bc Convert dhcp watcher to asyncio (#109938) 2024-02-08 22:23:42 -06:00
J. Nick Koston
73589015c3 Improve scalability of DHCP matchers (#109406) 2024-02-04 16:50:08 -06:00
J. Nick Koston
54f460b7c9 Improve performance of dhcp on high activity networks (#105884)
* Improve performance of dhcp on high activity networks

Most of the overhead was constructing IPAddress objects
which is solved with https://github.com/bdraco/cached-ipaddress

* fix test

* fix: bump

* bump again

* lets do it on the correct branch
2023-12-21 20:36:09 +01:00
Aarni Koskela
706add4a57 Switch formatting from black to ruff-format (#102893)
Co-authored-by: Franck Nijhof <git@frenck.dev>
2023-11-27 14:38:59 +01:00
Jan-Philipp Benecke
81450f0117 Update d-e* tests to use entity & device registry fixtures (#103804) 2023-11-12 10:38:32 +01:00
Ville Skyttä
3b4774d9ed Remove unnnecessary pylint configs from components/[a-d]* (#98911) 2023-08-24 00:54:02 +02:00
epenet
728f62b1ec Add type hints to integration tests (part 5) (#87850) 2023-02-12 19:39:48 +01:00
epenet
3052de3e8e Add type hints to integration tests (d-e) (#87699) 2023-02-08 13:01:44 +01:00
Franck Nijhof
5e81d28116 Update black to 23.1.0 (#87188) 2023-02-02 18:35:24 +01:00
Franck Nijhof
24fdd588fd Code styling tweaks to the tests - Part 1 (#86192) 2023-01-20 13:52:46 +01:00
epenet
4f31f28e67 Cleanup SourceType in tests (#78809) 2022-09-20 10:50:07 -04:00
epenet
7bc2712142 Adjust root-import in tests (#78761)
* Adjust root-import in tests

* Adjust diagnostics

* Adjust button

* Adjust select

* Adjust device_tracker

* Adjust camera

* Adjust humidifier

* Adjust media_source

* Adjust update

* Adjust siren

* Adjust number

* Adjust alarm_control_panel

* Adjust notify

* Adjust sensor

* Adjust switch

* Revert anthemav

* Don't adjust demo humidifier
2022-09-19 15:22:23 +02:00
epenet
141688e210 Cleanup ServiceInfo compatibility (#60540)
Co-authored-by: epenet <epenet@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
2022-05-09 14:17:48 +02:00
Martin Hjelmare
d9abd5efea Fix dhcp None hostname (#67289)
* Fix dhcp None hostname

* Test handle None hostname
2022-02-26 19:37:24 +01:00
J. Nick Koston
a18d4c51ff Ensure dhcp can still discover new devices from device trackers (#66822)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-02-19 09:01:34 -06:00
J. Nick Koston
f069a37f7d Allow integrations to request dhcp discovery flows for registered devices (#66528) 2022-02-15 11:02:52 -06:00
J. Nick Koston
adbc0e5955 Prevent multiple dhcp flows from being started for the same device/domain (#65753) 2022-02-05 10:59:22 -06:00
epenet
c05eca1c82 Remove log flooding prevention logic from discovery info (#61243)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2021-12-08 10:28:26 -10:00
epenet
7f355681a7 Add compatibility tests for DhcpServiceInfo (#60752)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2021-12-01 05:43:09 -10:00
epenet
45d41e584f Use DhcpServiceInfo in dhcp tests (#59962)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2021-11-19 12:49:28 +01:00
J. Nick Koston
b86e19143d Prevent event loop delay / instability from discovery (#57463) 2021-10-13 08:37:14 -07:00
J. Nick Koston
2ed35debdc Fix dhcp discovery matching due to deferred imports (#56814) 2021-09-29 23:50:21 -05:00
Erik Montnemery
dd7dea9a3f Make scapy imports in DHCP local (#55647) 2021-09-06 10:10:27 -07:00
J. Nick Koston
6a5dcf0869 Handle dhcp packets without a hostname (#52882)
* Handle dhcp packets without a hostname

- Since some integrations only match on OUI we want to
  make sure they still see devices that do not request
  a specific hostname

* Update tests/components/dhcp/test_init.py

* Update homeassistant/components/dhcp/__init__.py

Co-authored-by: Franck Nijhof <git@frenck.dev>

Co-authored-by: Franck Nijhof <git@frenck.dev>
2021-07-12 17:25:16 +02:00
Ville Skyttä
153d6e891e Use config_entries.SOURCE_* constants (#49631) 2021-04-25 11:27:40 +02:00
J. Nick Koston
f91de1c8b9 Add support for capturing renewals to dhcp discovery (#48242) 2021-03-30 15:41:12 +02:00
J. Nick Koston
2ff94c8ed9 Add additional data source to dhcp (#48430) 2021-03-28 09:47:28 -10:00
J. Nick Koston
958c4764f7 Handle routers that convert hostnames to lowercase in dhcp (#48429)
Some routers will lowercase all the hostnames. Since we
already lowercase hostnames for matching purposes, we now
pass the lowercased hostname to the integration.

Currently only roomba cared about this, and has been adjusted.
2021-03-28 11:23:06 +02:00
J. Nick Koston
1dd35ff059 Catch dhcp setup permission errors sooner (#47639)
This solves an unexpected thread exception on macs when running as
a user intead of root
2021-03-08 15:15:22 -08:00
J. Nick Koston
01e73911d6 Do not listen for dhcp packets if the filter cannot be setup (#46006) 2021-02-05 00:36:55 +01:00
J. Nick Koston
e8cda598ac Fix memory leak in dhcp integration (#45378)
* Fix memory leak in dhcp integration

Passing the L2socket to AsyncSniffer caused a memory
leak on some systems. To ensure we can create a socket,
we do a test creation before starting AsyncSniffer
since the sniffer will create it in another thread
and we cannot see any permission error otherwise.

* Update tests

* space

* do not store packets
2021-01-21 08:26:58 +01:00
J. Nick Koston
3ae527c158 Switch dhcp to use async sniff for faster shutdown (#45339)
* Switch dhcp to use async sniff for faster shutdown

* Do not actually start the thread since we do not know when it will finish starting
2021-01-19 20:49:49 +01:00
J. Nick Koston
fbc98b1291 Make DHCP discovery ignore self assigned ip addresses (#45256) 2021-01-17 10:35:02 +01:00
J. Nick Koston
5e01b828af Discover devices from device_trackers with router sources (#45160)
* Discover devices from device_trackers with router sources

* Update homeassistant/components/dhcp/__init__.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* fix stop being called on the wrong context

* clean

* move it to base

* cleanup was too agressive

* Update homeassistant/components/dhcp/__init__.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* coverage

* revert legacy changes

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2021-01-16 01:01:37 +01:00
J. Nick Koston
7fada806af Downgrade dhcp log message error message when running without CAP_NET_RAW (#45157) 2021-01-14 10:46:15 -10:00
J. Nick Koston
da677f7d5a Add support for discovery via DHCP (#45087)
* Add support for discovery via DHCP

* additional tesla ouis

* merge tests

* dhcp test

* merge requirements test

* dhcp test

* dhcp discovery

* dhcp discovery

* pylint

* pylint

* pylint

* fix

* Add matching tests

* 100% cover

* cleanup

* fix codespell

* Update exception handling

* remove unneeded comment

* fix options handling exception

* fix options handling exception
2021-01-14 09:09:08 +01:00