Commit Graph

59 Commits (f5975d4039760c0fadb194fdd3c65a444b3ceaf8)

Author SHA1 Message Date
G Johansson 72c1273d25
Fix Command Line update twice issue (#94672)
Command Line update twice issue
2023-06-16 09:08:51 +02:00
G Johansson bd74f03d0b
Fix reload service in Command Line (#94436)
* Fix reload in Command Line

* Add read new yaml
2023-06-12 21:51:57 +02:00
G Johansson f931cc3d1c
Fix manual update for Command Line (#94433)
Manual update command line
2023-06-12 21:50:23 +02:00
Ville Skyttä ca936d0b38
Replace bandit with ruff (#93200) 2023-06-08 22:46:04 +02:00
G Johansson 228da71cc4
Fix reload service in Command Line (#94085)
Fix multi platform reload service in command line
2023-06-05 15:54:51 -04:00
G Johansson b5b9a06c2c
Refactor Command Line sensor to use ManualTriggerEntity (#93999)
* Refactor sensor to use ManualTriggerEntity

* Add device and state class
2023-06-04 15:00:53 -04:00
G Johansson 1fe4c4fa59
Remove update_before_add from binary_sensor in Command Line (#94040)
Remove update_before_add
2023-06-04 14:53:34 -04:00
G Johansson 76d8c047ec
Refactor Command Line cover to use ManualTriggerEntity (#93997)
Refactor command_line cover
2023-06-03 14:19:59 -04:00
G Johansson 391c63640a
Refactor Command Line binary sensor to use ManualTriggerEntity (#94000)
Refactor binary sensor ManualTriggerEntity
2023-06-03 14:11:42 -04:00
G Johansson 038b0e6d23
Add scan interval to Command Line (#93752)
* Add scan interval

* Handle previous not complete

* Fix faulty text

* Add tests

* lingering

* Cool down

* Fix tests
2023-06-02 23:35:11 -04:00
G Johansson e1ef027461
Address late review comments for Command Line (#93743)
* Late review comments

* Rephrase
2023-05-29 19:45:42 +02:00
G Johansson 46e7486ce6
Move yaml configuration to integration key for command_line (#92824)
* Inital init commit

* bs and cover

* notify

* sensor

* switch

* Issues

* Finalize __init__

* First pass tests

* Fix Binary sensors

* Test cover

* Test notify

* Test sensor

* Tests switch

* Fix coverage

* Add codeowner

* Fix caplog

* test issue

* Flaky test notify

* Fix async

* Adjust yaml structure

* Change yaml format again

* Issue strings

* Fix tests

* string review comment
2023-05-29 08:00:50 +02:00
G Johansson 6ad4e13b38
Manual trigger entity and refactor command_line switch (#91506)
* TriggerEntity to CoordinatorTriggerEntity

* _render_templates

* split manual vs coordinator

* name

* ManualTriggerEntity

* value

* Remove ManualTriggerEntity

* ManualTriggerEntity

* process_manual_data

* Add test

* imports

* Move ManualTriggerEntity

* cmd_line switch

* Review comments

* Fix templating

* Review comments

* Remove unneeded logging
2023-05-08 10:19:37 +02:00
Steven Rollason 2b46734bd3
Fix command_template sensor value_template not being used if json_attributes set (#90603)
* Allow value_template to be used if json_attributes set

* Set state to None if no value_template and json_attributes used

* Refactor check for no value_template when json_attributes used

* Updated and additional unit test

* Updated to set _attr_native_value and return if value_template is None

* Update unit test docstring

* Updated test docstring based on feedback
2023-04-06 21:06:31 +02:00
G Johansson 96698813ef
Cleanup command_line (#90268)
* Cleanup command_line

* Fix ipv6 resolver

* Fix fix

* Fix tests

* Align states
2023-03-27 21:19:09 +02:00
epenet 33e698d67f
Improve notify type hints in integrations (#90034) 2023-03-21 11:40:19 +01:00
G Johansson 02389960ce
Refactor Command line sensor to inherit TemplateSensor (#81222)
* Refactor sensor

* Remove not needed

* block until done

* reset test

* test sensor

* Add time
2023-03-13 17:23:25 +01:00
G Johansson 5c4f93fa36
Refactor Command line cover to inherit TemplateEntity (#81214)
* Refactor cover

* Remove not needed
2023-03-13 10:57:30 +01:00
G Johansson 5c42261210
Refactor Command line binary sensor to inherit TemplateEntity (#81212)
* Refactor binary sensor

* Align
2023-03-13 10:56:18 +01: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 87420e949d
Sort manifests 2 (#87023) 2023-02-08 20:16:39 +01:00
Franck Nijhof 368694d6bf
Collection of DeviceClass related typing fixes (#82931) 2022-11-29 14:31:25 -05:00
epenet 0f792eb92e
Improve entity type hints [c] (#77023) 2022-08-19 13:02:46 +02:00
atlflyer da11cef29a
Report error code in log when command fails (#74319) 2022-07-02 09:58:08 -04:00
epenet a92ab7a669
Adjust CoverEntity function type hints in components (#73912)
Adjust CoverEntity functions in components
2022-06-24 06:40:26 +02:00
G Johansson 3771c154fa
Improve code quality command_line (#65333) 2022-02-12 08:19:37 -06:00
Gabriel Rauter d26275011a
Add unique_id configuration variable to command_line integration (#58596) 2022-01-03 11:44:47 +01:00
epenet 4f32a329a7
Add basic type hints to command_line (#62877)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2021-12-28 21:56:38 +01:00
Sebastian Lövdahl bc3bf2ffe3
Use Platform constants all over the place 1/3 (#62952) 2021-12-28 21:13:20 +01:00
Marius b61dede826
Add command_line icon_template (#58877)
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
2021-12-03 10:06:32 -08:00
Erik Montnemery 4e07ab1b32
Move temperature conversions to sensor base class (1/8) (#48261)
* Move temperature conversions to entity base class (1/8)

* Update integrations a-c

* Leave old temperature conversion until all integrations are migrated

* tweak

* Use contextlib.suppress

* Remove the MeasurableUnitEntity mixin

* Address comments, add tests

* Fix f-string

* Drop deprecation warning from base entity class

* Update with _attr-shorthand

* Fix rebase mistakes

* Fix additional rebase mistakes

* Only report temperature conversion once

* Fix additional rebase mistakes

* Format homeassistant/components/bbox/sensor.py

* Fix check for overidden _attr_state

* Remove test workarounds from implementation

* Remove useless None-check

* Tweaks

* Migrate new sensors a-c

* Update climacell

* Push deprecation of temperature conversion forward

* Override __repr__ in SensorEntity

* Include native_value in SensorEntity attributes

* Pylint

* Black

* Black

* Fix rebase mistakes

* black

* Fix rebase mistakes

* Revert changes in august/sensor.py

* Revert handling of unit converted restored state

* Apply code review suggestion

* Fix arlo test
2021-08-11 10:45:05 +02:00
tkdrob 6f5629cf14
Add targets and selectors for services (B-C) (#50189) 2021-05-14 13:38:41 +02: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
Erik Montnemery e0cd7072d6
Migrate integrations a-c to extend SensorEntity (#48210) 2021-03-22 12:37:16 +01:00
Erik Montnemery 6c084ae6ce
Update integrations a-e to override extra_state_attributes() (#47756) 2021-03-11 16:51:03 +01:00
Dermot Duffy be8584c0bc
Overhaul command_line tests (#46682) 2021-03-01 17:27:04 +01:00
Franck Nijhof a80921ab65
Minor service definition tweaks (#46741) 2021-02-18 17:14:36 +01:00
Philip Allgaier 625bbe6238
Cleanup unused loggers (components A-M) (#41600) 2020-10-12 16:59:05 +02:00
J. Nick Koston 215e3f2dab
Add the ability to reload command_line platforms from yaml (#39262) 2020-08-25 19:52:36 -05:00
Paulus Schoutsen 95835326f3
Do not print warning when command line switch queries off (#38591) 2020-08-06 12:36:59 +02:00
J. Nick Koston 7b728b17f7
Add missing timeout to command_line platforms: cover, notify, switch (#38497)
* Add missing timeout to command_line platforms: cover, notify, switch

* add timeout test for notify
2020-08-04 17:00:02 -10:00
Xiaonan Shen c65e72886c
Fix command line sensors removing quotes with template (#35559)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2020-06-10 18:31:59 +02:00
Erik Montnemery 066e921a8b
Rename SwitchDevice to SwitchEntity (#34673) 2020-04-26 18:50:37 +02:00
Erik Montnemery 8c5c963b96
Rename CoverDevice to CoverEntity (#34595) 2020-04-25 18:07:15 +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
Karthikeyan Singaravelan ab493eba96
Import ABC from collections.abc instead of collections for Pyt… (#34077) 2020-04-12 18:00:57 +02:00
Paulus Schoutsen f1d3c0d19b
Remove unused manifest fields (#33595) 2020-04-03 12:58:19 -07:00
Ville Skyttä 5e2ba2eb77
Enable some more bandit checks (#30857)
* Enable B108 (hardcoded tmp dir), address findings

* Enable B602 (subprocess popen with shell), address findings

* Enable B604 (start process with shell), address findings

* Enable B306 (mktemp), B307 (eval), and B325 (tempnam), no issues to address
2020-01-20 18:44:55 +02:00
Franck Nijhof 345cc244ed
Correct names in manifests (C-L) (#30532) 2020-01-07 08:19:17 +01:00