Commit graph

61 commits

Author SHA1 Message Date
G Johansson
67586caaf9
Cleanup ping (#95168) 2023-06-25 09:00:52 -05:00
Erik Montnemery
f9037d5f6d
Add platform only config schema to nsw_fuel_station and ping (#93913) 2023-06-01 17:30:15 +02:00
Erik Montnemery
25b5ad7de4
Fix typo in ping (#93701) 2023-05-28 10:11:46 -05:00
epenet
753c790a25
Use async_timeout in integrations (#88697) 2023-02-24 08:13:03 -05:00
J. Nick Koston
03eea7bd3f
Avoid subprocess memory copy when c library supports posix_spawn (#87958)
* use posix spawn on alpine

* Avoid subprocess memory copy when c library supports posix_spawn

By default python 3.10 will use the fork() which has to
copy all the memory of the parent process (in our case
this can be huge since Home Assistant core can use
hundreds of megabytes of RAM). By using posix_spawn
this is avoided.

In python 3.11 vfork will also be available
https://github.com/python/cpython/issues/80004#issuecomment-1093810689
https://github.com/python/cpython/pull/11671 but we won't
always be able to use it and posix_spawn is considered safer
https://bugzilla.kernel.org/show_bug.cgi?id=215813#c14

The subprocess library doesn't know about musl though
even though it supports posix_spawn https://git.musl-libc.org/cgit/musl/log/src/process/posix_spawn.c
so we have to teach it since it only has checks for glibc
1b736838e6/Lib/subprocess.py (L745)

The constant is documented as being able to be flipped here:
https://docs.python.org/3/library/subprocess.html#disabling-use-of-vfork-or-posix-spawn

* Avoid subprocess memory copy when c library supports posix_spawn

By default python 3.10 will use the fork() which has to
copy memory of the parent process (in our case
this can be huge since Home Assistant core can use
hundreds of megabytes of RAM). By using posix_spawn
this is avoided and subprocess creation does not
get discernibly slow the larger the Home Assistant
python process grows.

In python 3.11 vfork will also be available
https://github.com/python/cpython/issues/80004#issuecomment-1093810689
https://github.com/python/cpython/pull/11671 but we won't
always be able to use it and posix_spawn is considered safer
https://bugzilla.kernel.org/show_bug.cgi?id=215813#c14

The subprocess library doesn't know about musl though
even though it supports posix_spawn https://git.musl-libc.org/cgit/musl/log/src/process/posix_spawn.c
so we have to teach it since it only has checks for glibc
1b736838e6/Lib/subprocess.py (L745)

The constant is documented as being able to be flipped here:
https://docs.python.org/3/library/subprocess.html#disabling-use-of-vfork-or-posix-spawn

* missed some

* adjust more tests

* coverage
2023-02-13 09:02:51 -05:00
Erik Montnemery
1450b44c63
Sort manifests 7 (#87028) 2023-02-08 20:32:43 +01:00
epenet
275438adf3
Improve typing in ping binary sensor (#87073) 2023-02-02 16:31:09 -05:00
Marc Mueller
6d336ec136
Remove unnecessary try-else (5) (#86164) 2023-01-18 14:10:13 +01:00
epenet
9205020fa4
Avoid import homeassistant.const as a module (#85991) 2023-01-16 16:49:49 +01:00
Franck Nijhof
94755a5773
String formatting and max line length - Part 4 (#84445)
Co-authored-by: jjlawren <jjlawren@users.noreply.github.com>
2022-12-23 13:27:27 +01:00
epenet
b5402f9b57
Import device tracker constants from root (#78242) 2022-09-12 20:50:44 -04:00
epenet
474844744b
Improve entity type hints [p] (#77871) 2022-09-06 09:51:33 +02:00
epenet
4a84a8caa9
Use Platform enum (#76967) 2022-08-18 10:22:49 +02:00
Marc Mueller
450b7cd644
Use device_tracker SourceType enum [n-r] (#75965) 2022-07-31 15:48:43 +02:00
Marc Mueller
003fe9220e
Add protocol types for device_tracker async_see and see (#75891) 2022-07-29 00:27:47 +02:00
J. Nick Koston
5b755b74fb
Add loggers to integration manifest.json (#65083) 2022-01-28 13:37:53 -08:00
Joakim Sørensen
b086c8d898
Set ping data to None instead of False (#65013) 2022-01-27 10:03:45 +01:00
epenet
211b99e22d
Remove ping from mypy ignored modules (#64439)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-01-19 20:59:20 +01:00
Erik Montnemery
0fa4f616ed
Remove Windows workarounds from ping (#64069) 2022-01-13 20:43:00 +01:00
epenet
0ac9b62f97
Fix incorrect type hint in async_setup_scanner (#63833)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-01-10 22:47:24 +01:00
epenet
c6aaa24027
Add type hints to async_setup_scanner (#63826)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-01-10 16:13:54 +01:00
epenet
d94f68d697
Add setup type hints [n-r] (#63607)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-01-07 16:28:24 +01:00
epenet
0d7b531285
Add init type hints [p-q] (#63191)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-01-02 16:35:23 +01:00
Robert Hillis
a5cf783e6a
Use enums in ping (#62066) 2021-12-16 15:38:02 +01:00
Guess
2a99ef2046
Set PARALLEL_UPDATES for ping binary sensor (#59524)
Changing PARALLEL_UPDATES from 0 (unlimited) to 50 as with many sensors (above 500) successful pings weren't being recorded. Resolves https://github.com/home-assistant/core/issues/54860
2021-11-11 08:38:01 +01:00
Ville Skyttä
470f2dd73f
Upgrade pyupgrade to 2.21.2, apply its changes (#52987) 2021-07-19 10:46:09 +02:00
Daniel Hjelseth Høyer
fbad453c89
Pylint 2.9.3 (#52972)
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
2021-07-14 21:44:57 -07:00
J. Nick Koston
68714c2067
Update ping to use asyncio function in icmplib (#50808) 2021-06-02 06:10:33 -10:00
tkdrob
2d5f5bfa9f
Add targets and selectors for services (P-R) (#50628) 2021-05-14 22:07:17 -07:00
Marc Mueller
f1d48ddfe3
Update pylint to 2.8.0 (#49637) 2021-04-24 14:39:24 -10:00
Franck Nijhof
055cdc64c0
Add support for IoT class in manifest (#46935) 2021-04-15 10:21:38 +02:00
J. Nick Koston
54322f84c5
Do not schedule future ping device tracker updates once hass is stopping (#49236) 2021-04-15 08:49:28 +02:00
J. Nick Koston
9b0b2d9168
Prevent ping id allocation conflict with device_tracker (#48969)
* Prevent ping id allocation conflict with device_tracker

- Solves id conflict resulting unexpected home state

* Update homeassistant/components/ping/device_tracker.py

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2021-04-09 16:56:15 -07:00
J. Nick Koston
bee55a0494
Prevent ping integration from delaying startup (#43869) 2021-03-31 15:06:49 +02:00
Franck Nijhof
6932cf9534
Use contextlib.suppress where possible (#48189) 2021-03-23 14:36:43 +01:00
Marc Mueller
3d2b81a401
Update typing 11 (#48072) 2021-03-18 13:21:46 +01:00
Erik Montnemery
14ff6d4d1f
Update integrations p-s to override extra_state_attributes() (#47759) 2021-03-11 21:23:20 +01:00
Fabian Affolter
7a691f9d26
Upgrade icmplib to 2.0.2 (#47039) 2021-02-25 11:11:40 +01:00
J. Nick Koston
4ef93feb9a
Bump icmplib to 2.0 for ping (#43868) 2020-12-03 12:02:18 -07:00
J. Nick Koston
c7bbba9d48
Reduce icmplib ping timeout to match ping binary behavior (#41620) 2020-10-11 11:12:27 -05:00
J. Nick Koston
00b338002a
Update icmplib to 1.2.2 (#41608)
Fixes IPv6 lookups
2020-10-10 17:28:13 +02:00
J. Nick Koston
f3d50e2104
Do not log an error when a host is unreachable while pinging (#40024) 2020-09-13 16:44:37 +02:00
springstan
3d4ef8cfe1
Use connectivity device class constant in various integrations (#39972) 2020-09-12 13:21:57 -05:00
J. Nick Koston
b5005430be
Fix ping log level to be debug instead of warning (#39900) 2020-09-10 12:10:43 -04:00
J. Nick Koston
b7ad83c655
Use a unique id for each icmplib ping to avoid mixing unrelated responses (#39830) 2020-09-09 22:19:14 +02:00
J. Nick Koston
57848cdf35
Add the ability to reload ping platforms from yaml (#39344) 2020-08-28 12:40:30 -05:00
J. Nick Koston
7c191388a9
Use icmplib for ping when available (#39284)
* Use icmplib for ping when available

* Update homeassistant/components/ping/binary_sensor.py

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>

* Revert "Update homeassistant/components/ping/binary_sensor.py"

This reverts commit 618f42512a.

* move it up so its easier to see

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-08-28 08:50:09 -05:00
Tomasz
81b4c6956b
Make ping binary_sensor update async (#35301)
* async_update

* isort and pylint

* @shenxn suggestions

Co-authored-by: Xiaonan Shen <s@sxn.dev>

* async_update

* store the command from the beginning

* command as string

* f-string instead of str.format

* create_subprocess_shell > create_subprocess_exec
more logs

* isort

* types

* use asyncio.wait_for

* Update homeassistant/components/ping/binary_sensor.py

Co-authored-by: J. Nick Koston <nick@koston.org>

* @bdraco review changes

* Update homeassistant/components/ping/binary_sensor.py

Co-authored-by: J. Nick Koston <nick@koston.org>

Co-authored-by: Xiaonan Shen <s@sxn.dev>
Co-authored-by: J. Nick Koston <nick@koston.org>
2020-08-18 17:25:50 -05:00
J. Nick Koston
a91f5b7192
Prevent ping integration from blocking startup (#38504) 2020-08-05 12:43:35 +02:00
Erik Montnemery
b022e08db9
Rename BinarySensorDevice to BinarySensorEntity (#34462)
* Rename BinarySensorDevice to BinarySensorEntity

* Tweak

* Move deprecation warning to __new__, add test

* Move deprecation warning back to __init__

* Move deprecation warning to __init_subclass
2020-04-23 21:57:07 +02:00