1
0
mirror of https://github.com/home-assistant/core.git synced 2026-06-29 02:36:12 +01:00
Commit Graph

80 Commits

Author SHA1 Message Date
G Johansson 70a1e627b6 Add device class to Command Line cover (#117183) 2024-05-11 06:22:30 +01:00
J. Nick Koston 3bcce2197c Fix incorrect call to async_schedule_update_ha_state in command_line switch (#116347) 2024-04-28 18:36:01 +02:00
G Johansson 448f8a9568 Refactor setup code in command_line (#114661)
* Refactor setup code in command_line

* Fix rebase

* Review comments
2024-04-02 22:47:04 +03:00
atlflyer ef7836be73 Add icon to command_line cover config (#114645)
* Add icon to command_line cover config

* Remove unwanted #noqa tag

* Remove redundancy from new test name

* Apply requested changes
2024-04-02 20:59:57 +03:00
Sid 6587ee20db Enable Ruff TRY300 (#114437)
* Enable Ruff TRY300

* Update validation.py

* Address review comments
2024-03-30 10:37:59 +01:00
Sid 6ee273a548 Clean up unneeded ruff noqa directives (#113616) 2024-03-16 09:48:37 -10:00
Joost Lekkerkerker 1abb448106 Add service icons to Command line (#113285) 2024-03-13 14:07:52 -10:00
Marc Mueller ff3a801936 Add empty line after module docstring [a-d] (#112697) 2024-03-08 14:51:32 +01:00
J. Nick Koston c0f7ade92b Convert command_line to use asyncio for subprocesses (#111927)
* Convert command_line to use asyncio for subprocesses

* fixes

* fix

* fixes

* more test fixes

* more fixes

* fixes

* preen
2024-03-01 23:15:10 -05:00
G Johansson 749ef45727 Add availability to command_line (#105300)
* Add availability to command_line

* Add tests

* freezer
2024-01-15 18:20:34 +01:00
Marc Mueller dcee8e67c4 Add strict typing to command_line (#106889)
* Add strict typing to command_line

* Code review
2024-01-02 20:04:28 +01:00
G Johansson 2d3318e767 Remove platform YAML from Command line (#103202) 2023-11-04 16:17:31 +01:00
Erik Montnemery f72f95549c Use DOMAIN constant in command_line (#101269) 2023-10-02 15:22:54 +02:00
RoboMagus 1db3d3c158 icon for commandline sensors (#101195)
* Add icon to schema for commandline sensor and binary_sensor

* Add icon tests
2023-10-01 20:17:53 +02:00
G Johansson 61c17291fb Move TemplateEntity to template (#98957)
* Move TemplateEntity to template

* Rename template_entity in helpers
2023-08-24 15:37:04 +02:00
G Johansson 268e5244f0 Cleanup ManualTriggerSensorEntity (#98629)
* Cleanup ManualTriggerSensorEntity

* ConfigType
2023-08-18 20:19:17 +02:00
G Johansson 2e263560ec Fix Command Line template error when data is None (#97845)
Command Line template error
2023-08-05 16:21:39 +02:00
G Johansson 4c395c0124 Fix date and timestamp device class in Command Line Sensor (#97663)
* Fix date in Command Line sensor

* prettier
2023-08-03 13:59:37 +02:00
Joost Lekkerkerker b367c95c81 Add more common translations (#96429)
* Add common translations

* Add common translations

* Add common translations

* Add common translations

* Add common translations

* Add common translations

* Add common translations

* Add common translations
2023-07-12 22:00:05 -04:00
Franck Nijhof c252758ac2 Migrate integration services (B-D) to support translations (#96363) 2023-07-11 23:06:32 +02:00
Franck Nijhof ed16fffa79 Bump breaking version for YAML features ADR-0021 (#95525) 2023-06-29 11:59:36 +02:00
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
https://github.com/python/cpython/blob/1b736838e6ae1b4ef42cdd27c2708face908f92c/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
https://github.com/python/cpython/blob/1b736838e6ae1b4ef42cdd27c2708face908f92c/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