Commit Graph

14 Commits (2f29f38ec6f5620412442dabdf4ce7fdfbf498bc)

Author SHA1 Message Date
Marc Mueller 77ee72cbb9
Import Callable from collections.abc (1) (#56775) 2021-09-29 16:32:11 +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
Marc Mueller fabd73f08b
Update typing 03 (#48015) 2021-03-17 21:46:07 +01:00
springstan 37bcfd1d2f
Simplify distance conversion (#43107) 2020-11-11 20:10:17 +01:00
springstan 67b3552165
Add more units to distance conversion util (#40181)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2020-11-09 11:38:15 +01: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
Teagan M. Glenn 26526ca57a Add unit system support
Add unit symbol constants

Initial unit system object

Import more constants

Pydoc for unit system file

Import constants for configuration validation

Unit system validation method

Typing for constants

Inches are valid lengths too

Typings

Change base class to dict - needed for remote api call serialization

Validation

Use dictionary keys

Defined unit systems

Update location util to use metric instead of us fahrenheit

Update constant imports

Import defined unit systems

Update configuration to use unit system

Update schema to use unit system

Update constants

Add imports to core for unit system and distance

Type for config

Default unit system

Convert distance from HASS instance

Update temperature conversion to use unit system

Update temperature conversion

Set unit system based on configuration

Set info unit system

Return unit system dictionary with config dictionary

Auto discover unit system

Update location test for use metric

Update forecast unit system

Update mold indicator unit system

Update thermostat unit system

Update thermostat demo test

Unit tests around unit system

Update test common hass configuration

Update configuration unit tests

There should always be a unit system!

Update core unit tests

Constants typing

Linting issues

Remove unused import

Update fitbit sensor to use application unit system

Update google travel time to use application unit system

Update configuration example

Update dht sensor

Update DHT temperature conversion to use the utility function

Update swagger config

Update my sensors metric flag

Update hvac component temperature conversion

HVAC conversion for temperature

Pull unit from sensor type map

Pull unit from sensor type map

Update the temper sensor unit

Update yWeather sensor unit

Update hvac demo unit test

Set unit test config unit system to metric

Use hass unit system length for default in proximity

Use the name of the system instead of temperature

Use constants from const

Unused import

Forecasted temperature

Fix calculation in case furthest distance is greater than 1000000 units

Remove unneeded constants

Set default length to km or miles

Use constants

Linting doesn't like importing just for typing

Fix reference

Test is expecting meters - set config to meters

Use constant

Use constant

PyDoc for unit test

Should be not in

Rename to units

Change unit system to be an object - not a dictionary

Return tuple in conversion

Move convert to temperature util

Temperature conversion is now in unit system

Update imports

Rename to units

Units is now an object

Use temperature util conversion

Unit system is now an object

Validate and convert unit system config

Return the scalar value in template distance

Test is expecting meters

Update unit tests around unit system

Distance util returns tuple

Fix location info test

Set units

Update unit tests

Convert distance

DOH

Pull out the scalar from the vector

Linting

I really hate python linting

Linting again

BLARG

Unit test documentation

Unit test around is metric flag

Break ternary statement into if/else blocks

Don't use dictionary - use members

is metric flag

Rename constants

Use is metric flag

Move constants to CONST file

Move to const file

Raise error if unit is not expected

Typing

No need to return unit since only performing conversion if it can work

Use constants

Line wrapping

Raise error if invalid value

Remove subscripts from conversion as they are no longer returned as tuples

No longer tuples

No longer tuples

Check for numeric type

Fix string format to use correct variable

Typing

Assert errors raised

Remove subscript

Only convert temperature if we know the unit

If no unit of measurement set - default to HASS config

Convert only if we know the unit

Remove subscription

Fix not in clause

Linting fixes

Wants a boolean

Clearer if-block

Check if the key is in the config first

Missed a couple expecting tuples

Backwards compatibility

No like-y ternary!

Error handling around state setting

Pretty unit system configuration validation

More tuple crap

Use is metric flag

Error handling around min/max temp

Explode if no unit

Pull unit from config

Celsius has a decimal

Unused import

Check if it's a temperature before we try to convert it to a temperature

Linting says too many statements - combine lat/long in a fairly reasonable manner

Backwards compatibility unit test

Better doc
2016-08-04 22:02:19 -07:00
Teagan Glenn 122581da7f Proximity unit of measure (#2659)
* Allow multiple proximities

* Distance conversion

* Add unit of measurement and conversion to proximity

* Shorten attribute name

* Fix get unit of measurement

* Fix the km <-> m conversion

* Add type check and errors

* first path unit test around distance utility

* Fix numeric type check

* Fix conversion type-os

* Actually set the exception thrown flag

* Test for exact conversion

* More descriptive variable names

* Update method invocation to match change in method name

* Missed a couple variables

* Line continuation

* Fix linting too many return issue

* Break out proximity setup for list of proximity and for single proximity device

* Pass hass to setup function

* Check if setup succeeded for each proximity component

* Change variable name

* Break out branches in convert to avoid too many branches linting error

* Remove disable lint line

* Variables for default properties

* Combine logic

* Test loading multiple proximities for 100% code coverage on proximity component

* Unit test to reach 100%
Fail to configure proximities missing devices

* Fail first before processing

* Combine return statements

* lstrip = bad Teagan

* Utilize string formating instead of concatenation

* Fix variable reference

* Typeo

* Clean up conversion to reduce complexity

* Update unit tests to match code changes on distance util

* Test non numeric value

* Private methods, value type has already been checked.
2016-07-31 10:20:56 -07:00