Commit Graph

24 Commits

Author SHA1 Message Date
Erik Montnemery b0d4b73874
Add unitless unit converter (#85694)
* Add unitless unit converter

* Adjust type hints

* Adjust tests

* Rename to UnitlessRatioConverter
2023-01-12 09:20:00 +01:00
Franck Nijhof d4f69a3652
String formatting and max line length - Part 7 (#84532)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-12-27 11:18:56 +01:00
epenet d6fc2d9452
Prevent use of deprecated units (#83384)
* Prevent use of deprecated units

* Adjust obsolete util

* More units

* Add FREQUENCY

* Adjust pylint ignore

* Add ELECTRIC (current/potential)

* Add TIME

* Adjust units
2022-12-21 15:24:11 +01:00
G Johansson 4cf0f9b197
Fix incorrect deprecation year for conversion utils (#80195)
Fix incorrect depr year
2022-10-13 00:06:23 +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 dc82ae4f69
Make VALID_UNITS a set (#79104)
* Make VALID_UNITS a set

* Also adjust weather
2022-09-27 07:16:03 +01:00
epenet 523d8d246b
Move pressure utility to unit_conversion (#78953) 2022-09-22 16:44:09 +02:00
epenet 713fb874a8
Add NORMALISED_UNIT to UnitConverter (#78920)
* Add NORMALISED_UNIT to UnitConverter

* Adjust statistics

* Rename
2022-09-22 08:50:08 +02:00
epenet 39315b7fe3
Introduce UnitConverter protocol (#78888)
* Introduce ConversionUtility

* Use ConversionUtility in number

* Use ConversionUtility in sensor

* Use ConversionUtility in sensor recorder

* Add normalise to ConversionUtility

* Revert changes to recorder.py

* Reduce size of PR

* Adjust recorder statistics

* Rename variable

* Rename

* Apply suggestion

Co-authored-by: Erik Montnemery <erik@montnemery.com>

* Apply suggestion

Co-authored-by: Erik Montnemery <erik@montnemery.com>

* Apply suggestion

Co-authored-by: Erik Montnemery <erik@montnemery.com>

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2022-09-22 07:18:00 +02:00
Erik Montnemery 2caad1a474
Add support for converting to and from mmHg (#64844) 2022-01-24 22:57:56 +01: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
Glenn Waters e4f15c42e0
Add kPa as a pressure unit (#56885) 2021-10-01 08:08:04 -07:00
Daniel Hjelseth Høyer 49a69d5ba0
Add missing PRESSURE_BAR conversion (#54497)
* Add missing PRESSURE_BAR

* style

Signed-off-by: Daniel Hjelseth Høyer <github@dahoiv.net>

* valid units

Signed-off-by: Daniel Hjelseth Høyer <github@dahoiv.net>
2021-08-12 07:30:35 +02:00
Marc Mueller a56485a8c5
Revert new unit types (#53226) 2021-07-20 14:13:51 +02:00
Marc Mueller 71a8ae3016
Add new unit types for better type checking (#53124)
* Add new unit types
* Update helper functions
* Update components
* Update lcn climate
2021-07-18 14:43:47 +02:00
Erik Montnemery cca5964ac0
Normalize pressure statistics to Pa (#52298) 2021-06-29 23:30:13 +02:00
Philip Allgaier dde6305549
Cleanup unused loggers (components N-Z + tests) (#41982) 2020-10-16 21:24:08 -05:00
Ville Skyttä 221d5205e4
Upgrade mypy to 0.770, tighten config a bit (#32715)
* Upgrade mypy to 0.770, related cleanups

https://mypy-lang.blogspot.com/2020/03/mypy-0770-released.html

* Clean up config and make it a notch stricter, address findings
2020-03-12 11:52:20 +01:00
Bas Nijholt 67c56c860d Sort imports according to PEP8 for 'homeassistant' folder (#29789)
Components are already done
2019-12-09 16:42:10 +01:00
Franck Nijhof decf13b948 Use literal string interpolation in core (f-strings) (#26166) 2019-08-23 09:53:33 -07:00
Paulus Schoutsen 4de97abc3a Black 2019-07-31 12:25:30 -07:00
Ville Skyttä 56841da2d3 Upgrade mypy to 0.720, turn on unreachability warnings (#25157)
* Upgrade mypy to 0.720

* Turn on mypy unreachability warnings, address raised issues
2019-07-16 15:11:38 -07:00
MatthewFlamm ed93c3b2c1 Fix pressure in dark sky and openweathermap and add pressure utility (#21210) 2019-03-24 18:37:31 +01:00