Commit Graph

53 Commits (d3210ada1dc4b6cf36b1f1f3d79ba4b6028e4a59)

Author SHA1 Message Date
Erik Montnemery d2fd504442
Limit precision when stringifying float states (#48822)
* Limit precision when stringifying float states

* Add test

* Fix typing

* Move StateType

* Update

* Move conversion to entity helper

* Address review comments

* Tweak precision

* Tweak

* Make _stringify_state an instance method
2021-04-27 21:48:24 +02:00
Ville Skyttä a396619251
Use disabled_by constants (#49584)
Co-authored-by: J. Nick Koston <nick@koston.org>
2021-04-23 09:56:42 +02:00
Erik Montnemery 7e4be921a8
Add helper to get an entity's supported features (#48825)
* Add helper to check entity's supported features

* Move get_supported_features to helpers/entity.py, add tests

* Fix error handling and improve tests
2021-04-10 08:19:16 +02:00
Paulus Schoutsen 9e07910ab0
Mark entities as unavailable when they are removed but are still registered (#45528)
* Mark entities as unavailable when they are removed but are still registered

* Add sync_entity_lifecycle to collection helper

* Remove debug print

* Lint

* Fix tests

* Fix tests

* Update zha

* Update zone

* Fix tests

* Update hyperion

* Update rfxtrx

* Fix tests

* Pass force_remove=True from integrations

Co-authored-by: Erik <erik@montnemery.com>
2021-02-08 10:45:46 +01:00
Franck Nijhof 65cf2fcb6f
Drop asynctest (#44746) 2021-01-01 22:31:56 +01:00
J. Nick Koston f50976a0b3
Switch to asyncio.wait for slow update warning implementation (#41184) 2020-10-05 15:28:15 +02:00
springstan a2c3c33b22
Use core GitHub URL in all files (#41089) 2020-10-03 00:04:11 +02:00
Paulus Schoutsen 3dc79aa60a
Track entity sources (#37258)
Co-authored-by: David Mulcahey <david.mulcahey@me.com>
2020-08-19 14:57:38 +02:00
J. Nick Koston 152a80abed
Complete deprecation of hidden attribute (ATTR_HIDDEN) (#37041) 2020-06-23 17:05:32 -05:00
Paulus Schoutsen 2af984917e
Use asynctest-mock in most places (#35109)
* Use asynctest-mock in most places

* Fix broken patch in pilight
2020-05-03 11:27:19 -07:00
Franck Nijhof 60bc517d01
Collection of core tests improvements (#33757)
* Collection of core tests improvements

* Added some more

* Fix aiohttp client response release
2020-04-07 09:33:23 -07:00
Paulus Schoutsen 5a0f21cbe3
Adjust entity slow warning for custom component (#31711) 2020-02-10 16:32:47 -08:00
Paulus Schoutsen a3b3924e21
Update link when IO in event loop (#31519) 2020-02-06 11:37:35 +01:00
Bas Nijholt f60125b5c9 Sort imports according to PEP8 for 'tests' (#29791) 2019-12-09 16:52:24 +01:00
Paulus Schoutsen 9771826ed6
Add capability-attributes (#29306) 2019-12-02 11:15:50 -08:00
Robbert Müller 7a156059e9 Switch on/off all lights, and wait for the result (#27078)
* Switch on/off all lights, and wait for the result

Reuses the parallel_updates semaphore.
This is a small crutch which serializes platforms which already do tis
for updates. Platforms which can parallelize everything, this makes it
go faster

* Fix broken unittest

With manual validation, with help from @frenck, we found out that the
assertions are wrong and the test should be failing.

The sequence requested is
OFF
ON

without cancelation, this code should result in:
off,off,off,on,on,on

testable, by adding a `await hass.async_block_till_done()` between the
off and on call.

with cancelation. there should be less off call's so
off,on,on,on

* Adding tests for async_request_call

* Process review feedback

* Switch gather with wait

* 👕 running black
2019-10-06 08:23:12 -07:00
SukramJ cf3bb300e6 Fix for 0.98: Don't update disabled entities (Homematic IP Cloud) (#26236)
* Homematic IP Cloud Fix: Don't update disabled entities

* Added enabled to entity.py

* Update test for enabled

* Update entity.py
2019-08-28 13:38:20 -07:00
Paulus Schoutsen f704a8e90e Reload config entry when entity enabled in entity registry, remove entity if disabled. (#26120)
* Reload config entry when disabled_by updated in entity registry

* Add types

* Remove entities that get disabled

* Remove unnecessary domain checks.

* Attach handler in async_setup

* Remove unused var

* Type

* Fix test

* Fix tests
2019-08-22 19:32:43 -05:00
Paulus Schoutsen aa56b4dd30
Log warning if disabled entities receive updates. (#26143)
* Log warning if disabled entities receive updates.

* Fix test

* Always set entity ID on disabled entities
2019-08-22 14:12:24 -07:00
Paulus Schoutsen 4de97abc3a Black 2019-07-31 12:25:30 -07:00
Jason Hu e85b089eff
Set default parallel_update value should base on async_update (#22149)
* Set default parallel_update value should base on async_update

* Set default parallel_update value should base on async_update

* Delay the parallel_update_semaphore creation

* Remove outdated comment
2019-03-25 23:53:36 -07:00
Pascal Vizeli 2bf36bb1db
Use unicode slugify (#19192)
* Update __init__.py

* Update setup.py

* Update requirements_all.txt

* Update __init__.py

* Update __init__.py

* Update __init__.py

* Update __init__.py

* Update __init__.py

* remove `-`

* fix packages

* Update package_constraints.txt

* Update __init__.py

* Update package_constraints.txt

* Update requirements_all.txt

* Update setup.py

* Fix tests

* Fix line issue

* fix all test

* fix type

* Fix lint
2018-12-17 07:51:13 +01:00
Paulus Schoutsen 1be61df9c0
Add recent context (#15989)
* Add recent context

* Add async_set_context to components not using new services
2018-08-20 17:39:53 +02:00
Ville Skyttä dbd0763f83 Grammar and spelling fixes (#16065) 2018-08-19 22:29:08 +02:00
Paulus Schoutsen d9cf8fcfe8
Allow changing entity ID (#15637)
* Allow changing entity ID

* Add support to websocket command

* Address comments

* Error handling
2018-07-24 14:12:53 +02:00
Ville Skyttä 2f7b79764a More pylint 2 fixes (#15565)
## Description:

More fixes flagged by pylint 2 that don't hurt to have before the actual pylint 2 upgrade (which I'll submit soon).

## Checklist:
  - [ ] The code change is tested and works locally.
  - [x] Local tests pass with `tox`. **Your PR cannot be merged unless tests pass**
2018-07-20 11:45:20 +03:00
Otto Winter 8dcfd35b8b Spelling fixes (#12041)
* Spelling fixes

*Lots* of them.

* Spelling breaking changes

* Fix lint errors
2018-01-29 23:37:19 +01:00
Paulus Schoutsen 183e0543b4
Clean up entity component (#11691)
* Clean up entity component

* Lint

* List -> Tuple

* Add Entity.async_remove back

* Unflake setting up group test
2018-01-22 22:54:41 -08:00
Paulus Schoutsen 9384e2c963
Pr/11430 (#11587)
* Fix error when name is non-latin script

When the name is non-latin script (e.g. Japanese), slugify returns empty string and causes failure in a later stage. This commit fixes the issue by using default name.

* Add test
2018-01-11 15:26:48 -08:00
Paulus Schoutsen 4e8e04fe66 Clean up core (#10305)
* Clean up core

* Lint

* Fix tests

* Address comment

* Update entity.py

* romve test for forward update to async_update

* fix lint
2017-11-03 14:19:36 +01:00
Pascal Vizeli 56cbfb5f2a Fix device update / entity_id with names (#10029)
* Fix device update

* Add tests

* add test for disabled warning
2017-10-22 08:40:00 -07:00
Pascal Vizeli c1b197419d Fix async probs (#9924)
* Update entity.py

* Update entity_component.py

* Update entity_component.py

* Update __init__.py

* Update entity_component.py

* Update entity_component.py

* Update entity.py

* cleanup entity

* Update entity_component.py

* Update entity_component.py

* Fix names & comments / fix tests

* Revert deadlock protection

* Add tests for entity

* Add test fix name

* Update other code

* Fix lint

* Remove restore state from template entities

* Lint
2017-10-19 10:56:25 +02:00
Pascal Vizeli 90f9a6bc0a Cleanup and simplitfy the async state update (#9390)
* Cleanup and simplitfy the async state update

* Update test_entity.py
2017-09-12 10:01:03 +02:00
Paulus Schoutsen f43db3c615 Replace executor with async_add_job (#7658)
* Remove executor

* Lint

* Lint

* Fix tests
2017-05-26 08:28:07 -07:00
Pascal Vizeli 5529d77c62 Prevent entities running multiple updates simultaneously (#6511)
* Protect entity for multible updates on same time.

* Address all comments / make update more robust

* fix unittest

* fix lint

* address comments
2017-03-14 09:26:55 -07:00
Pascal Vizeli 8232f1ef65 Cleanup async handling (#6388)
* Cleanups unneeded blocks

* Cleanup bootstrap

* dedicated update_ha_state

* Fix imap_email_content

* fx tests

* Fix lint & spell
2017-03-04 15:10:36 -08:00
Paulus Schoutsen 235d0057b1 Simplify customize (#6007)
* Simplify customize

* Maintain glob order

* Have glob overrule domain
2017-02-15 19:47:30 -08:00
Adam Mills e877d572f5 binary_sensor sensor_class to entity device_class (#5860)
* binary_sensor sensor_class to entity device_class

* Linter fixes

* Should be it
2017-02-10 20:46:15 -08:00
andrey-git 1fb372ffdb Apply new customize format to Zwave (#5603) 2017-01-28 22:29:51 +02:00
andrey-git addc2c4340 Allow easier customization of whole domain, entity lists, globs. (#5215) 2017-01-22 21:19:50 +02:00
Fabian Affolter be272ac64a Disable too-many-* (#4107)
* Disable too-many-* and too-few-public-methods

* Remove globally disabled pylint warnings
2016-10-30 22:18:53 +01:00
Paulus Schoutsen 4198c42736 Have template platforms never leave the event loop 2016-10-01 14:11:16 -07:00
Paulus Schoutsen b650b2b0db Spread async love (#3575)
* Convert Entity.update_ha_state to be async

* Make Service.call async

* Update entity.py

* Add Entity.async_update

* Make automation zone trigger async

* Fix linting

* Reduce flakiness in hass.block_till_done

* Make automation.numeric_state async

* Make mqtt.subscribe async

* Make automation.mqtt async

* Make automation.time async

* Make automation.sun async

* Add async_track_point_in_utc_time

* Make helpers.track_sunrise/set async

* Add async_track_state_change

* Make automation.state async

* Clean up helpers/entity.py tests

* Lint

* Lint

* Core.is_state and Core.is_state_attr are async friendly

* Lint

* Lint
2016-09-30 12:57:24 -07:00
Paulus Schoutsen 640a8b5a7f Limit dependencies of HA core (#2762) 2016-08-08 20:21:40 -07:00
Paulus Schoutsen a70f922a71 ps - add reload core config service (#2350) 2016-06-22 09:13:18 -07:00
Fabian Affolter f22a40c3e8 Fix PEP257 issues 2016-03-09 11:15:04 +01:00
Fabian Affolter 9838697d2b Fix PEP257 issues 2016-03-09 10:25:50 +01:00
Paulus Schoutsen 09ab3e95c0 Tests should all use test HA 2016-02-14 15:08:23 -08:00
Fabian Affolter 00afaac54c Update for file header, docstrings, and PEP8/PEP257 2016-02-13 14:19:11 +01:00
Paulus Schoutsen bc19ef66bf Move split_entity_id to helpers 2016-01-23 22:49:49 -08:00