epenet
f4c13645d2
Add support for CCF volume unit ( #84029 )
2022-12-19 14:57:04 +01:00
epenet
4a848e8222
Add stones to mass units ( #83933 )
2022-12-13 17:35:14 +01:00
epenet
583b4aef07
Enable automatic conversion for pressures ( #83525 )
...
* Enable automatic conversion between bar and psi
* Fix tests
* Fix mazda tests
* Fix oncue tests
* Adjust US pressures
* Adjust metric pressures
* Adjust tests
* Adjust tests
2022-12-12 12:42:35 +01:00
epenet
b172abaeeb
Add new atmospheric pressure device class ( #83455 )
...
* Add new atmospheric pressure device class
* Translations
* Automatic conversion
* Convert all pressure units
2022-12-09 08:02:53 +01:00
Joakim Plate
c576a68d33
Upgrade pytest-aiohttp ( #82475 )
...
* Upgrade pytest-aiohttp
* Make sure executors, tasks and timers are closed
Some test will trigger warnings on garbage collect, these warnings
spills over into next test.
Some test trigger tasks that raise errors on shutdown, these spill
over into next test.
This is to mimic older pytest-aiohttp and it's behaviour on test
cleanup.
Discussions on similar changes for pytest-aiohttp are here:
https://github.com/pytest-dev/pytest-asyncio/pull/309
* Replace loop with event_loop
* Make sure time is frozen for tests
* Make sure the ConditionType is not async
/home-assistant/homeassistant/helpers/template.py:2082: RuntimeWarning: coroutine 'AsyncMockMixin._execute_mock_call' was never awaited
def wrapper(*args, **kwargs):
Enable tracemalloc to get traceback where the object was allocated.
See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.
* Increase litejet press tests with a factor 10
The times are simulated anyway, and we can't stop the normal
event from occuring.
* Use async handlers for aiohttp
tests/components/motioneye/test_camera.py::test_get_still_image_from_camera
tests/components/motioneye/test_camera.py::test_get_still_image_from_camera
tests/components/motioneye/test_camera.py::test_get_stream_from_camera
tests/components/motioneye/test_camera.py::test_get_stream_from_camera
tests/components/motioneye/test_camera.py::test_camera_option_stream_url_template
tests/components/motioneye/test_camera.py::test_camera_option_stream_url_template
/Users/joakim/src/hass/home-assistant/venv/lib/python3.9/site-packages/aiohttp/web_urldispatcher.py:189: DeprecationWarning: Bare functions are deprecated, use async ones
warnings.warn(
* Switch to freezegun in modbus tests
The tests allowed clock to tick in between steps
* Make sure skybell object are fully mocked
Old tests would trigger attempts to post to could services:
```
DEBUG:aioskybell:HTTP post https://cloud.myskybell.com/api/v3/login/ Request with headers: {'content-type': 'application/json', 'accept': '*/*', 'x-skybell-app-id': 'd2b542c7-a7e4-4e1e-b77d-2b76911c7c46', 'x-skybell-client-id': '1f36a3c0-6dee-4997-a6db-4e1c67338e57'}
```
* Fix sorting that broke after rebase
2022-11-29 22:36:36 +01:00
J. Nick Koston
1589c06203
Significantly reduce clock_gettime syscalls on platforms with broken vdso ( #81257 )
2022-10-31 09:35:08 -04:00
epenet
2a2e097e17
Use unit enums in unit utilities ( #81030 )
2022-10-26 20:47:17 +02:00
epenet
842cb18d39
Migrate energy units to an enum ( #80998 )
2022-10-26 13:56:51 +02:00
Erik Montnemery
352976fd1d
Add rules for converting volumes ( #80951 )
...
* Add rules for converting volumes
* Use SensorDeviceClass in new tests
* Tweak tests
* Update flo tests
* Update sensor tests
2022-10-26 10:29:33 +02:00
epenet
870a5b6f37
Adjust formatting in unit system tests ( #80958 )
...
* Adjust black formatting in unit system tests
* Split tests
2022-10-25 17:36:21 +02:00
epenet
7838bb3ebe
Replace new PRECIPITATION_INTENSITY with enum ( #80653 )
2022-10-25 16:45:45 +02:00
Erik Montnemery
727eccfec4
Add GJ as supported unit for energy sensors ( #80870 )
...
* Add GJ as supported unit for energy sensors
* Update homeassistant/const.py
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
2022-10-25 16:43:00 +02:00
epenet
0018939142
Adjust unit_system type hints ( #80946 )
2022-10-25 15:56:18 +02:00
Erik Montnemery
b07e1281da
Add rules for converting speeds ( #80943 )
...
* Add rules for converting speeds
* Update metoffice wind speed sensors to prefer mph
* Don't convert speeds measured in knots
2022-10-25 14:53:59 +02:00
Erik Montnemery
aea0067e49
Add additional rules for converting distances ( #80940 )
...
* Add additional rules for converting distances
* Convert in to mm
* Adjust existing tests
* Add test
2022-10-25 12:51:23 +02:00
Erik Montnemery
6979cd95b0
Add suggested_unit_of_measurement attribute to sensors ( #80638 )
...
* Add suggested_unit_of_measurement attribute to sensors
* Lazy calculation of initial entity options
* Add type alias for entity options
* Small tweak
* Add tests
* Store suggested_unit_of_measurement in its own option key
* Adapt to renaming of IMPERIAL_SYSTEM
* Fix rebase mistakes
* Apply suggestions from code review
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
2022-10-24 16:08:02 +02:00
epenet
8a1cc05e0c
Enforce kwargs in unit system initialisation ( #80620 )
...
* Enforce kwargs in unit system initialisation
* Fix tests
* Sort kwargs in unit_system
2022-10-20 10:43:32 +02:00
epenet
9afb4c6c9e
Adjust precipitation units ( #79780 )
...
* Adjust precipitation units
* Use PRECIPITATION_INTENSITY
* Revert isy994
* Adjust SensorDeviceClass docstring
* Adjust comment
2022-10-19 14:35:49 +02:00
epenet
67d1dde69f
Rename IMPERIAL_SYSTEM to US_CUSTOMARY_SYSTEM ( #80253 )
...
* Rename IMPERIAL_SYSTEM
* Deprecate is_metric property and adjust tests
* Adjust unit_system config validation
* Add yaml tests
* Add tests for private name
* Fix incorrect rebase
* Adjust docstring
* Add store migration
* Update unit_system.py
* Minimise test tweaks
* Fix tests
* Add conversion to migration
* Rename new key and adjust tests
* Adjust websocket_detect_config
* Move original_unit_system tracking to subclass
2022-10-19 13:31:08 +02:00
epenet
bff5d1123f
Deprecate CONF_UNIT_SYSTEM_*** constants ( #80320 )
...
* Deprecate CONF_UNIT_SYSTEM_*** constants
* Adjust pylint plugin
* Add tests
* Remove single-use function
* Revert logic change
* Revert "Revert logic change"
This reverts commit 60959a0050
.
* Tweak again
2022-10-14 16:50:04 +02:00
epenet
6a757662e4
Deprecate is_metric property of unit system ( #80313 )
2022-10-14 13:44:18 +02:00
epenet
4dd0c079d5
Deprecate name property of unit system ( #80257 )
2022-10-14 12:06:14 +02:00
epenet
aa0bb9c3d2
Improve precision in pressure conversion ( #79362 )
...
* Improve precision in pressure conversion
* Use _STANDARD_GRAVITY
* Add again pytest.approx
2022-10-06 12:48:31 +02:00
Erik Montnemery
47d0598e75
Use Kelvin as the preferred color temperature unit ( #79591 )
...
* Use Kelvin as the preferred white temperature unit
* Update homekit
* Adjust tests
2022-10-06 12:22:39 +02:00
epenet
825f9502ad
Align temperature conversion with other converters ( #79521 )
...
* Align temperature conversion with other converters
* Add comments and docstring
* Align tests
2022-10-03 10:09:55 +02:00
epenet
9c3b40dad1
Deprecate conversion utilities ( #78957 )
...
* Deprecate utilities
* Deprecate distance and speed
* Add tests
* Adjust pylint
* Simplify temperature deprecation
2022-09-28 19:39:44 +02:00
epenet
5438552d4a
Cleanup unit conversion ( #79197 )
...
* Move UNIT_RATIO to BaseUnitConverter
* Make UNIT_CONVERSION private
* Remove STATISTIC_UNIT_TO_UNIT_CLASS constant
* Cleanup websocket_api
* Imrpove valid_units check
2022-09-28 13:49:46 +02:00
epenet
5389ff3253
Add new weight device class ( #79185 )
2022-09-28 12:13:49 +02:00
epenet
c96c5bed7d
Remove argument validation in Unit Converter ( #79107 )
...
* Remove argument validation in Unit Converter
* Use HomeAssistantError
* Adjust tests
* Improve coverage
2022-09-28 10:58:04 +02:00
epenet
62022a2657
Increase code coverage for migrated utilities ( #78990 )
...
Increase code coverage for migrated utilites
2022-09-23 17:32:59 +02:00
epenet
4200778eaf
Move distance and speed util to unit_conversion ( #78967 )
2022-09-23 08:23:59 -04:00
epenet
ddf56baf7a
Move temperature utility to unit_conversion ( #78960 )
2022-09-22 18:31:50 +02:00
epenet
c8491c4404
Move volume utility to unit_conversion ( #78955 )
...
* Move volume utility to unit_conversion
* Split tests
2022-09-22 17:49:45 +02:00
epenet
523d8d246b
Move pressure utility to unit_conversion ( #78953 )
2022-09-22 16:44:09 +02:00
epenet
0767cdd935
Move energy and power utilites to unit_conversion ( #78950 )
...
* Move energy and power utilites to unit_conversion
* Move tests
2022-09-22 15:39:49 +02:00
epenet
ca78b1a77d
Add new energy utility ( #78883 )
...
* Add new energy utility
* Adjust STATISTIC_UNIT_TO_VALID_UNITS
2022-09-21 19:40:40 +02:00
epenet
d7382aadfe
Add new power utility ( #78867 )
...
* Add power utility
* Fix tests
2022-09-21 14:48:38 +02:00
Artem Draft
29be6d17b0
Add is_host_valid util ( #76589 )
2022-09-11 11:12:04 -05:00
epenet
9490771a87
Refactor distance, speed and volume utils ( #77952 )
...
* Refactor distance util
* Fix bmw connected drive tests
* Adjust here travel time tests
* Adjust waze travel time tests
* Adjust test_distance
* Adjust rounding values
* Adjust more tests
* Adjust volume conversions
* Add tests
2022-09-07 16:18:00 +02:00
Paulus Schoutsen
481205535c
Add PrusaLink integration ( #77429 )
...
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-08-29 20:45:27 -04:00
J. Nick Koston
48e82ff62f
Fix failure to raise on bad YAML syntax from include files ( #75510 )
...
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
2022-07-20 19:25:17 +02:00
Franck Nijhof
7adb0f0ef5
Custom component -> Custom integration ( #75404 )
2022-07-18 22:10:22 +02:00
J. Nick Koston
9a27f1437d
Use default encoder when saving storage ( #75319 )
2022-07-17 14:25:19 +02:00
henryptung
7d27dad190
Remove pip --prefix workaround ( #74922 )
...
Remove --prefix workaround
See discussion in https://github.com/home-assistant/core/issues/74405 .
This workaround is no longer needed on pip >= 21.0 and actively causes problems for pip >= 21.3.
2022-07-11 11:33:28 +02:00
J. Nick Koston
8d0e54d776
Use the orjson equivalent default encoder when save_json is passed the default encoder ( #74377 )
2022-07-04 08:41:23 -05:00
Erik Montnemery
d3f4108a91
Support knots and ft/s in weather wind speed ( #74175 )
2022-06-29 16:34:41 +02:00
Erik Montnemery
c186a73e57
Tweak speed util ( #74160 )
2022-06-29 12:01:09 +02:00
[pʲɵs]
91a119917d
List more private and link-local IP networks ( #74064 )
...
List more private and link-local IP networks
The IPv6 link-local network is especially important as without it
local accounts don't work on IPv6-capable networks with no IPv6 DHCP
server.
2022-06-27 22:00:44 -07:00
J. Nick Koston
1866a1e925
Handle non-str keys when storing json data ( #73958 )
2022-06-24 09:59:01 -05:00
J. Nick Koston
fd9fdc6283
Fix error reporting with unserializable json ( #73908 )
2022-06-23 20:32:45 +02:00
J. Nick Koston
034c0c0593
Improve YAML Dump times with C Dumper ( #73424 )
2022-06-13 13:14:30 -07:00
J. Nick Koston
dca4d3cd61
Significantly improve yaml load times when the C loader is available ( #73337 )
2022-06-13 08:44:46 -10:00
Kevin Stillhammer
90e5d69184
Add template as_timedelta ( #71801 )
2022-05-23 19:32:22 +02:00
J. Nick Koston
4e9bc9eaff
Small cleanups to find_next_time_expression and addition of tests ( #71845 )
2022-05-14 12:13:32 -07:00
J. Nick Koston
ebce5660e3
Sync event timed_fired and the context ulid time ( #71854 )
2022-05-14 12:12:08 -07:00
J. Nick Koston
2a9f043039
Use ULID short format for context ids ( #71119 )
2022-05-01 21:44:54 -07:00
J. Nick Koston
d03760d0bb
Switch to using ULIDs for context_ids ( #70246 )
2022-04-18 22:45:41 -07:00
Marc Mueller
c9cc2eb7c8
Fix flaky datetime test ( #68524 )
2022-03-23 09:30:01 +01:00
Paulus Schoutsen
929df2bc29
Improve error handling process_play_media_url ( #68322 )
2022-03-20 20:25:15 -07:00
Joakim Sørensen
9a6f5bbc04
Update whoami URL ( #67793 )
2022-03-07 11:11:25 +01:00
J. Nick Koston
ffcac67d99
Add is_ipv4_address and is_ipv6_address utils ( #66472 )
2022-02-13 15:23:11 -06:00
Tobias Sauerwein
8b38fa58aa
Bump pytest to 7.0.0 ( #65981 )
2022-02-08 10:03:27 +01:00
J. Nick Koston
676edb610f
Add coverage for color_rgbww_to_rgb, fix divzero case ( #65721 )
2022-02-05 10:59:32 -06:00
Franck Nijhof
fa09cf663e
Update black to 22.1.0 ( #65788 )
2022-02-05 14:19:37 +01:00
Paulus Schoutsen
5da923c341
Protect state.as_dict from mutation ( #65693 )
2022-02-04 14:45:25 -08:00
J. Nick Koston
26ff6d2aa0
Fix warm/cold reversal in rgbww_to_color_temperature ( #65677 )
2022-02-04 11:36:30 -08:00
Erik Montnemery
63680f0b36
Make util.async_.protect_loop name names ( #65493 )
2022-02-03 14:06:40 +01:00
Erik Montnemery
5a34feb7de
Don't warn on time.sleep injected by the debugger ( #65420 )
2022-02-02 08:58:14 -08:00
Erik Montnemery
2caad1a474
Add support for converting to and from mmHg ( #64844 )
2022-01-24 22:57:56 +01:00
Erik Montnemery
7c110eeef4
Remove Windows workarounds from tests/utils/test_json.py ( #64311 )
2022-01-17 19:34:46 +01:00
Matthias Alphart
dc58bc375a
Warn on`time.sleep` in event loop ( #63766 )
...
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-01-11 17:55:24 +01:00
Franck Nijhof
20bdcc7fff
Replace hass.helpers: async_get_clientsession() ( #63910 )
2022-01-11 17:33:50 +01:00
Paulus Schoutsen
1ea3a17d89
Allow sending webhooks via WS connection ( #62725 )
2022-01-07 10:41:36 -08:00
J. Nick Koston
d325de7510
Add additional guarding to color_rgb_to_rgbww ( #62220 )
2021-12-19 09:44:53 -06:00
J. Nick Koston
94ae6ac2b2
Handle color temp to RGBWW conversion ( #61473 )
...
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2021-12-16 05:39:33 -06:00
J. Nick Koston
3eabd69666
Fix exception in color_rgb_to_rgbww ( #61466 )
2021-12-10 22:19:54 -08:00
Marvin Wichmann
707fe67c00
Move StrEnum to homeassistant.backports and move Platform to homeassistant.const ( #60880 )
...
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2021-12-03 09:31:17 +01:00
Erik Montnemery
9f4a99fe81
Revert "Add bytes support for bitwise template operations" ( #60854 )
2021-12-03 08:50:29 +01:00
Franck Nijhof
3c66706a49
Clean up deprecated sanitize_filename and sanitize_path ( #60859 )
2021-12-02 15:35:11 -05:00
Erik Montnemery
88068fa97f
Remove unused OrderedEnum ( #60392 )
2021-11-26 11:10:39 +01:00
Jan Bouwhuis
d33457b7bc
Add bytes support for bitwise template operations ( #60211 )
...
* Add bytes support for bitwise template operations
* spelling
* Update bitwise tests
* remove try block for bytes conversion
* do not accept empty `bytes` object
2021-11-24 15:15:27 +01:00
Ville Skyttä
053c456199
Change device entry type to an StrEnum ( #59940 )
...
Co-authored-by: Ville Skyttä <ville.skytta@iki.fi>
Co-authored-by: Franck Nijhof <git@frenck.dev>
2021-11-22 18:14:15 +01:00
rianadon
ecf00a1eae
Add accumulated precipitation to unit system ( #59657 )
...
* Add accumulated precipitation to unit system
* Fix template test
* Fix typo of testing pressure instead of precipitation
* Add extra arguments so unit system test passes
2021-11-19 09:18:44 +01:00
rianadon
7cc7bbb76d
Add speed to units system ( #58437 )
...
* Use speed units in unit system
* Use more obvious conversion factor for unit system speed test
* Use wind_speed instead of speed, use m/s
2021-11-18 16:08:42 +01:00
Erik Montnemery
fa952364cc
Remove test_check_package_version_does_not_match ( #59785 )
2021-11-16 07:54:08 -08:00
J. Nick Koston
96f7b0d910
Use atomicwrites for mission critical core files ( #59606 )
2021-11-15 11:19:31 +01:00
Matthias Alphart
f8f060b72b
Make util.color._match_max_scale public ( #59207 )
2021-11-10 22:29:16 -08:00
J. Nick Koston
ebb25ab0e6
Make yaml file writes safer ( #59384 )
2021-11-10 22:19:56 -08:00
Tim Rightnour
93395f9b68
Add support for PRESSURE_CBAR (centibars) ( #58762 )
...
* Add support for PRESSURE_CBAR (centibars). This is the standard UOM for tensiometers.
While the data could be converted into something like MBAR, and displayed
like that, the correct UOM for this type of sensor is CBAR. Displaying
it as MBAR would be the same as displaying air pressure as feet of Hg, while
technically correct, it's hard to understand when reading.
Adding support for this UOM will fix errors in the UI(statistics) about the unit not
matching a unit of the device_class.
* Add tests for PRESSURE_CBAR
2021-11-10 09:44:05 +01:00
rianadon
a102c425a9
Add speed conversion function & add speed to units system ( #53846 )
...
* Add speed conversion function
* Add test for speed utility functions
* Update unit system tests
* Fix incorrect unit conversions in tests
* Fix some test errors
* Calculate speed units from smaller set of constants
* Fix typo in speed test
* Use pytest.approx for checking floating point values
* Change other instance of speeds needing to be pytest.approx
* Revert changes to unit system
* Fix oopsie in defining in/day and in/hr
* Parametrize test
* Add comments describing calculations & remove duplicate test
2021-11-09 08:12:28 +01:00
Otto Winter
a9c0f89c09
Fix find_next_time_expression_time ( #58894 )
...
* Better tests
* Fix find_next_time_expression_time
* Add tests for Nov 7th 2021, Chicago transtion
* Update event tests
* Update test_event.py
* small performance improvement
Co-authored-by: J. Nick Koston <nick@koston.org>
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2021-11-01 17:45:13 +01:00
Glenn Waters
e4f15c42e0
Add kPa as a pressure unit ( #56885 )
2021-10-01 08:08:04 -07:00
Paulus Schoutsen
19c54b8cbf
Drop unused ruamel ( #55672 )
2021-09-03 22:17:10 -07:00
Bram Kragten
e23750b2a4
Add device class `gas` and enable statistics for it ( #54110 )
...
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2021-08-11 09:58:19 -07:00
Marc Mueller
553521a76b
Add mixin classes for required keys in EntityDescription ( #53610 )
2021-07-28 11:50:13 +02:00
Joakim Sørensen
85c1614204
Add currency to location data ( #53575 )
2021-07-27 21:05:16 -07:00
Ville Skyttä
470f2dd73f
Upgrade pyupgrade to 2.21.2, apply its changes ( #52987 )
2021-07-19 10:46:09 +02:00
J. Nick Koston
1ba5c1c9fb
Fix deadlock at shutdown with python 3.9 ( #52613 )
2021-07-07 09:23:24 +02:00
Erik Montnemery
0476c7f9ee
Normalize temperature statistics to °C ( #52297 )
...
* Normalize temperature statistics to °C
* Fix tests
* Support temperature conversion to and from K, improve tests
* Fix test
* Add tests, pylint
2021-06-30 14:17:58 +02:00
Joakim Sørensen
7ff14b47a8
Use whoami for location lookup ( #50934 )
2021-05-22 20:34:48 -07:00