Commit graph

79 commits

Author SHA1 Message Date
Steven Looman
39c81cb4b1
Prefer IPv4 locations over IPv6 locations for upnp devices/component (#103792) 2023-11-13 10:09:27 -06:00
J. Nick Koston
bbcae19d0e
Disable always responding to all SSDP M-SEARCH requests with the root device (#100224) 2023-09-12 17:15:13 -05:00
J. Nick Koston
bb2cdbe7bc
Change SSDP discovery scan interval to 10 minutes (#99975)
* Change SSDP discovery scan interval to 10 minutes

The first version used a scan interval of 1 minute which we
increased to 2 minutes because it generated too much traffic.

We kept it at 2 minutes because Sonos historicly needed to
get SSDP discovery to stay alive. This is no longer the case
as Sonos has multiple ways to keep from going unavailable:

- mDNS support was added
- We now listen for SSDP alive and good bye all the time
- Each incoming packet from the device keeps it alive now
- We probe when we think the device might be offline

This means it should no longer be necessary to have such a
frequent scan which is a drag on all devices on the network
since its multicast

* adjust tests
2023-09-09 10:54:40 -04:00
J. Nick Koston
d1ac4c9c46
Switch a few ssdp calls to use get_lower (#99931)
get_lower avoids lower casing already lower-cased strings
2023-09-08 13:59:25 -04:00
Ville Skyttä
b51c0f6ddc
Remove unnnecessary pylint configs from components [s-z]* (#98925) 2023-08-24 01:25:32 +02:00
J. Nick Koston
1c814b0ee3
Defer SSDP UPNP server start until the started event (#96555) 2023-07-14 14:28:29 -10:00
Erik Montnemery
8896b27f70
Add empty config schema to integrations p-s (#93700) 2023-05-29 20:57:18 +02:00
epenet
c01b1eb013
Adjust async_track_time_interval name argument (#90838)
Adjust async_track_time_interval naming
2023-04-05 10:58:02 -04:00
J. Nick Koston
0cc9b2e803
Use slots for discovery dataclasses (#90751) 2023-04-04 12:44:59 +02:00
J. Nick Koston
02ef7d445d
Allow passing an optional name to async_track_time_interval (#90244)
* Allow passing an optional name to async_track_time_interval

This is the same idea as passing a name to asyncio.create_task which
makes it easier to track down bugs

* more

* short

* still cannot find it

* add a few more

* test
2023-03-25 10:11:14 -04:00
J. Nick Koston
331102e592
Dismiss discoveries when the underlying device disappears (#88340)
* Implement discovery removals

Bluetooth, HomeKit, SSDP, and Zeroconf now implement
dismissing discoveries when the underlying discovered
device disappears

* cover

* add zeroconf test

* cover

* cover bluetooth

* fix rediscover
2023-02-17 15:51:19 -05:00
Steven Looman
50373500c3
Ensure a proper scope_id is given for IPv6 addresses when initializing the SSDP component (#86975)
fixes undefined
2023-01-30 22:14:48 +01:00
Steven Looman
a9be2adf06
Actually try port when finding next available port for ssdp server (#84206)
fixes undefined
2022-12-30 15:30:29 +01:00
Steven Looman
682501eb47
Less tasks when receiving SSDP messages (#84186)
Co-authored-by: J. Nick Koston <nick@koston.org>
2022-12-21 11:35:52 -10:00
Franck Nijhof
08772004b3
Fix SSDP failure to start on missing URLs (#81453) 2022-11-03 11:13:23 +01:00
Paulus Schoutsen
770aefbd52
SSDP to allow more URLs (#81171)
Co-authored-by: J. Nick Koston <nick@koston.org>
2022-10-29 14:26:12 -04:00
Steven Looman
b5f70a404a
Fix SSDP/UPnP server after testing (#80815) 2022-10-24 15:19:19 -05:00
Steven Looman
731f618028
Make home assistant discoverable via UPnP/SSDP (#79820) 2022-10-15 14:00:46 -04:00
Steven Looman
2be54de448
Don't verify ssl certificates for ssdp/upnp devices (#73647) 2022-06-17 11:26:25 -05: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
J. Nick Koston
109b4d45ca
Allow matching ssdp by manufacturerURL only (#71125) 2022-04-30 14:17:18 -05:00
J. Nick Koston
5224cf5968
Update async_upnp_client to 0.29.0 (#70604) 2022-04-25 09:53:35 -07:00
Shay Levy
2a538f6ae1
Downgrade SSDP failed to setup listener warning to debug (#68129) 2022-03-14 19:14:45 +01:00
Steven Looman
dbbb5655e5
Bump async-upnp-client to 0.25.0 (#66414)
Co-authored-by: J. Nick Koston <nick@koston.org>
2022-02-27 08:29:29 -10:00
J. Nick Koston
30eacdbea0
Change ssdp scanning interval to 2 minutes (#64688) 2022-01-22 11:12:58 -06:00
Marc Mueller
67c35652f0
Update typing - collections.abc (2) (#63934) 2022-01-12 09:04:37 +01:00
J. Nick Koston
70947b14a3
Improve SSDP callback performance (#62359) 2021-12-19 21:04:45 -08:00
epenet
da7c5f4722
Break long lines in discovery_info (#61431) 2021-12-10 12:48:47 +01: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
6a926b41f2
Enable warnings for SsdpServiceInfo (#60756)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2021-12-01 08:35:39 -10:00
epenet
ec1c52d945
Use dataclass for SsdpServiceInfo (#59931)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2021-11-29 06:10:07 -10:00
epenet
22bdd38583
Use SsdpServiceInfo for SOURCE_SSDP tests (part 4) (#60339)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2021-11-25 17:13:52 -06:00
epenet
f292691b7b
Use SsdpServiceInfo for ssdp tests (part 3) (#60334)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2021-11-25 11:46:20 -06:00
epenet
2468724378
Use SsdpServiceInfo for ssdp tests (part 2) (#60322)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2021-11-25 09:45:35 -06:00
epenet
62bf42e421
Introduce SsdpServiceInfo for ssdp discovery (#60284)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2021-11-24 19:35:15 -06:00
epenet
d990fe1957
Update ssdp matching_domain constant (#60283)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2021-11-24 07:49:44 -06:00
epenet
9027ee7828
Revert "Add type hints to SSDP (#59840)" (#60270) 2021-11-24 10:14:48 +01:00
epenet
329904dfbb
Add type hints to SSDP (#59840) 2021-11-18 09:49:36 -06:00
Michael Chisholm
44aa1fdc66
dlna_dmr won't support devices that don't provide all DMR services (#58374) 2021-10-25 19:54:58 -05:00
Michael Chisholm
ee087c7a05
Discovery ignores DLNA DMR devices when they are better supported by another integration (#57363) 2021-10-22 10:26:33 -10:00
Steven Looman
dcf60b54ce
Improve SSDP discovery compatibility when device was discovery through an SSDP advertisement (#58133) 2021-10-21 10:57:34 -10:00
J. Nick Koston
b86e19143d
Prevent event loop delay / instability from discovery (#57463) 2021-10-13 08:37:14 -07:00
Michael Chisholm
a28fd7d61b
Config-flow for DLNA-DMR integration (#55267)
* Modernize dlna_dmr component: configflow, test, types

* Support config-flow with ssdp discovery
* Add unit tests
* Enforce strict typing
* Gracefully handle network devices (dis)appearing

* Fix Aiohttp mock response headers type to match actual response class

* Fixes from code review

* Fixes from code review

* Import device config in flow if unavailable at hass start

* Support SSDP advertisements

* Ignore bad BOOTID, fix ssdp:byebye handling

* Only listen for events on interface connected to device

* Release all listeners when entities are removed

* Warn about deprecated dlna_dmr configuration

* Use sublogger for dlna_dmr.config_flow for easier filtering

* Tests for dlna_dmr.data module

* Rewrite DMR tests for HA style

* Fix DMR strings: "Digital Media *Renderer*"

* Update DMR entity state and device info when changed

* Replace deprecated async_upnp_client State with TransportState

* supported_features are dynamic, based on current device state

* Cleanup fully when subscription fails

* Log warnings when device connection fails unexpectedly

* Set PARALLEL_UPDATES to unlimited

* Fix spelling

* Fixes from code review

* Simplify has & can checks to just can, which includes has

* Treat transitioning state as playing (not idle) to reduce UI jerking

* Test if device is usable

* Handle ssdp:update messages properly

* Fix _remove_ssdp_callbacks being shared by all DlnaDmrEntity instances

* Fix tests for transitioning state

* Mock DmrDevice.is_profile_device (added to support embedded devices)

* Use ST & NT SSDP headers to find DMR devices, not deviceType

The deviceType is extracted from the device's description XML, and will not
be what we want when dealing with embedded devices.

* Use UDN from SSDP headers, not device description, as unique_id

The SSDP headers have the UDN of the embedded device that we're interested
in, whereas the device description (`ATTR_UPNP_UDN`) field will always be
for the root device.

* Fix DMR string English localization

* Test config flow with UDN from SSDP headers

* Bump async-upnp-client==0.22.1, fix flake8 error

* fix test for remapping

* DMR HA Device connections based on root and embedded UDN

* DmrDevice's UpnpDevice is now named profile_device

* Use device type from SSDP headers, not device description

* Mark dlna_dmr constants as Final

* Use embedded device UDN and type for unique ID when connected via URL

* More informative connection error messages

* Also match SSDP messages on NT headers

The NT header is to ssdp:alive messages what ST is to M-SEARCH responses.

* Bump async-upnp-client==0.22.2

* fix merge

* Bump async-upnp-client==0.22.3

Co-authored-by: Steven Looman <steven.looman@gmail.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
2021-09-27 15:47:01 -05:00
Michael Chisholm
6c2674734a
SSDP starts config flow only for alive devices (#56551)
Co-authored-by: J. Nick Koston <nick@koston.org>
2021-09-27 08:39:22 +02:00
J. Nick Koston
26e031984b
Ensure sonos always gets ssdp callbacks from searches (#56591) 2021-09-26 17:16:03 -05:00
J. Nick Koston
6399730d2f
Optimize SSDP matching (#56622)
* Optimize SSDP matching

* tweak

* remove

* remove dupe
2021-09-26 16:30:39 -05:00
Steven Looman
73260c5b88
Move parts of ssdp to async_upnp_client (#55540)
* Move parts of ssdp to async_upnp_client

* Fix test for environments with multiple sources

* Fix sonos tests

* More fixes/changes

* More fixes

* Use async_upnp_client==0.21.0

* Pylint/test fixes

* More changes after review

* Fix tests

* Improve testing

* Fix mypy

* Fix yamaha_musiccast tests?

* Changes after review

* Pylint

* Reduce calls to combined_headers

* Update to async_upnp_client==0.21.1

* Update to async_upnp_client==0.21.2

* use as_dict

Co-authored-by: J. Nick Koston <nick@koston.org>
2021-09-11 13:38:16 -10:00
J. Nick Koston
25b39b36e7
Ignore missing devices when in ssdp unsee (#55553) 2021-09-03 09:06:07 -07:00
J. Nick Koston
2cc87cb7ab
Retrigger config flow when the ssdp location changes for a UDN (#55343)
Fixes #55229
2021-08-27 09:53:29 -07:00
J. Nick Koston
6d0ce814e7
Add new network apis to reduce code duplication (#54832) 2021-08-18 12:33:26 -05:00