Compare commits

...

482 Commits

Author SHA1 Message Date
Franck Nijhof
d520a02b8c Merge pull request #32932 from home-assistant/rc
0.107.0
2020-03-18 15:35:44 +01:00
SukramJ
1e469b39ad Fix flaky tests for HMIPC (#32806) 2020-03-18 14:44:29 +01:00
Franck Nijhof
c2f615839d Bumped version to 0.107.0 2020-03-18 13:31:02 +01:00
Bram Kragten
657bf33e32 Updated frontend to 20200318.0 (#32931) 2020-03-18 13:27:21 +01:00
Paulus Schoutsen
0ca87007fd Bumped version to 0.107.0b8 2020-03-17 17:56:18 -07:00
Paulus Schoutsen
d0d9d853f2 Fix hassio panel load (#32922)
* Fix loading hassio panel

* Remove blacklist
2020-03-17 17:55:57 -07:00
Hans Oischinger
8348878e7e Introduce safe scan_interval for vicare (#32915) 2020-03-17 17:55:56 -07:00
Paulus Schoutsen
b70be5f2f2 Blacklist auto_backup (#32912)
* Blacklist auto_backup

* Mock with a set
2020-03-17 17:55:55 -07:00
Bram Kragten
fddb565e4c Fix input text reload (#32911)
* Fix input text reload

* FIx schema instead
2020-03-17 17:55:54 -07:00
Rami Mosleh
f3e6820042 Fix setting up options due to config data freeze (#32872) 2020-03-17 17:55:54 -07:00
Paulus Schoutsen
ae98f13181 Bumped version to 0.107.0b7 2020-03-17 10:36:59 -07:00
Paulus Schoutsen
ab38e7d98a Bump cast to 4.2.0 (#32906) 2020-03-17 10:35:39 -07:00
brubaked
9797b09d44 Changed Sensor icons to be more emotionally sensitive (#32904)
The existing sensor icons, while descriptive - dead = dead - are perhaps too matter of fact and don't accurately convey the tragedy. I changed emoticon-dead-outline to emoticon-cry-outline, as I think it better conveys the reality of the situation along with the emotions tied to the statistic.
2020-03-17 10:35:39 -07:00
Quentame
4908d4358c Bump iCloud to 0.9.5 (#32901) 2020-03-17 10:35:38 -07:00
Paulus Schoutsen
67d728fc50 Make zone dependency of device tracker an after dep (#32880)
* Make zone dependency of device tracker an after dep

* Fix test
2020-03-17 10:34:34 -07:00
Jason Lachowsky
912409ed0c Corrected minor misspellings (#32857) 2020-03-17 10:32:01 -07:00
Paolo Tuninetto
ac8c889b0f Add default port to samsung tv (#32820)
* Default port for websocket tv

* Update config entry

* move bridge creation

* fix indent

* remove loop
2020-03-17 10:32:00 -07:00
Quentame
67a721d39b Fix iCloud init while pending (#32750)
* Fix iCloud init while pending

Continue if device is pending while setup
Create devices and fetch 15s if pending, otherwise determine interval to fetch.

* Add retried_fetch guard
2020-03-17 10:32:00 -07:00
Paulus Schoutsen
d196fd136d Bumped version to 0.107.0b6 2020-03-16 14:53:13 -07:00
Bram Kragten
4f78674a4c Updated frontend to 20200316.1 (#32878) 2020-03-16 14:53:05 -07:00
Bram Kragten
a7aca10668 Lovelace: storage key based on id instead of url_path (#32873)
* Fix storage key based on url_path

* Fix test
2020-03-16 14:53:04 -07:00
Paulus Schoutsen
03b1c6ddee Remove group as a dependency from entity integrations (#32870)
* remove group dependency

* Update device sun light trigger

* Add zone dep back to device tracker
2020-03-16 14:53:03 -07:00
David F. Mulcahey
661f1b69f2 Bump ZHA quirks to 0.0.37 (#32867) 2020-03-16 14:53:03 -07:00
Bram Kragten
ccb34083fe Add lovelace reload service for yaml resources (#32865)
* Lovelace add reload service for yaml resources

* Clean up imports

* Comments
2020-03-16 14:53:02 -07:00
Bram Kragten
7f6b3c1130 Bumped version to 0.107.0b5 2020-03-16 13:59:27 +01:00
Bram Kragten
f2c3f76b8e Updated frontend to 20200316.0 (#32866) 2020-03-16 13:49:50 +01:00
Pascal Vizeli
b6a3bcf87f Update pyozw 0.1.9 (#32864) 2020-03-16 13:49:49 +01:00
Tom Harris
65423bb62b Bump insteonplm to 0.16.8 (#32847) 2020-03-16 13:49:48 +01:00
Kit Klein
104665d849 Ignore the ignored konnected config entries (#32845)
* ignore the ignored konnected config entries

* key off data instead of source
2020-03-16 13:49:47 +01:00
Alan Tse
fb1ba86b08 Bump teslajsonpy to 0.5.1 (#32827) 2020-03-16 13:49:47 +01:00
David Bonnes
cee72724b6 Ensure unique_ids for all evohome thermostats (#32604)
* initial commit

* small tweak
2020-03-16 13:49:46 +01:00
Paulus Schoutsen
a3d74651a8 Bumped version to 0.107.0b4 2020-03-15 11:56:56 -07:00
Paulus Schoutsen
d88275d6d2 Make sure panel_custom won't crash on invalid data (#32835)
* Make sure panel_custom won't crash on invalid data

* Add a test
2020-03-15 11:52:54 -07:00
SukramJ
42998f898b Add SF transition to HmIP-BSL and remove obsolete code in HMIPC (#32833) 2020-03-15 11:52:53 -07:00
Daniel Høyer Iversen
875671cc2b Add Netatmo Home Coach as model (#32829) 2020-03-15 11:52:53 -07:00
Bram Kragten
3b84b6e6d5 Require a hyphen in lovelace dashboard url (#32816)
* Require a hyphen in lovelace dashboard url

* Keep storage dashboards working

* register during startup again

* Update homeassistant/components/lovelace/dashboard.py

Co-Authored-By: Paulus Schoutsen <balloob@gmail.com>

* Comments

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2020-03-15 11:52:52 -07:00
Chris Talkington
3b1fb2f416 Remove extra logging from directv init. (#32809) 2020-03-15 11:52:51 -07:00
Chris Talkington
226a0bcaad Fix directv location of unknown error string (#32807)
* Update strings.json

* Update en.json
2020-03-15 11:52:50 -07:00
Greg
57dd45318d Bump eagle_reader API version to v0.2.4 (#32789) 2020-03-15 11:52:50 -07:00
Franck Nijhof
e666485ea9 Fix brightness_pct in light device turn_on action (#32787) 2020-03-15 11:52:49 -07:00
Aidan Timson
b5c8b5b91f Fix onvif error with non ptz cameras (#32783) 2020-03-15 11:52:48 -07:00
David F. Mulcahey
706607f1d2 Fix handling of attribute reports in ZHA sensors and binary sensors (#32776)
* Update sensor tests.

* Update light tests.

* Update binary_sensor tests.

* Update cover tests.

* Update device tracker tests.

* Update fan tests.

* Update lock tests.

* Update switch tests.

* add sensor attr to sensors

* add sensor attr to binary sensors

* cleanup extra var

Co-authored-by: Alexei Chetroi <alexei.chetroi@outlook.com>
2020-03-15 11:52:47 -07:00
Steven Looman
0788bbd629 Add log message on timeout and update less often for upnp devices (#32740)
* Catch asyncio.TimeoutError, show a proper message instead

* Throttle updates to max once per 30s

* Change code owner

* Fix CODEOWNERS + linting

* Warn on connection timeout
2020-03-15 11:52:46 -07:00
Chris Talkington
1b622925a1 Optimize directv client initialization (#32706)
* Optimize directv client initialization.

* Update config_flow.py

* Update media_player.py

* Update media_player.py

* Update __init__.py

* Update __init__.py

* Update __init__.py

* Update __init__.py

* Update test_media_player.py

* Update __init__.py

* Update media_player.py

* Update test_media_player.py

* Update media_player.py

* Update test_media_player.py

* Update config_flow.py

* Update test_config_flow.py

* Update test_config_flow.py

* Update test_config_flow.py

* Update test_config_flow.py

* Update test_config_flow.py

* Update test_config_flow.py

* Update __init__.py

* Update test_config_flow.py

* Update test_config_flow.py

* Update test_media_player.py

* Update test_media_player.py

* Update __init__.py

* Update __init__.py

* Update __init__.py
2020-03-15 11:52:45 -07:00
Slava
86c4fa0fc5 Add brightness state to emulated hue when devices support only color temp and brightness (#31834) 2020-03-15 11:52:45 -07:00
Jc2k
e365dc398b Fix homekit_controller beta connectivity issues (#32810) 2020-03-14 15:43:09 -04:00
Bram Kragten
dfd29e6d73 Bumped version to 0.107.0b3 2020-03-13 22:23:34 +01:00
Bram Kragten
6780bded7e Updated frontend to 20200313.0 (#32777) 2020-03-13 22:19:22 +01:00
Paulus Schoutsen
56686dd14c Bumped version to 0.107.0b2 2020-03-13 12:16:55 -07:00
Bram Kragten
7268bcd9be Check if panel url used and delay dashboard reg till start (#32771)
* Check if panel url used and delay dashboard reg till start

* move storage_dashboard_changed

* fix tests
2020-03-13 12:16:49 -07:00
J. Nick Koston
4f78e04315 Bump py-august to 0.25.0 (#32769)
Fixes a bug in the conversion to async where code validation failed.
2020-03-13 12:16:49 -07:00
Austin Mroczek
7bdac8ef2e Bump total-connect-client to 0.54.1 #32758) 2020-03-13 12:16:48 -07:00
Paulus Schoutsen
a66f4ca4ec Bumped version to 0.107.0b1 2020-03-12 17:02:38 -07:00
Bram Kragten
3345d85dca Updated frontend to 20200312.0 (#32741) 2020-03-12 17:02:29 -07:00
Raman Gupta
9ad776e55d Set self._current_app to None when vizio device is off (#32725) 2020-03-12 17:02:29 -07:00
escoand
2f2a908573 Fix legacy Samsung TV (#32719)
* Update bridge.py

* Update test_init.py
2020-03-12 17:02:28 -07:00
J. Nick Koston
9f76a8c12d Resolve Home Assistant fails to start when Sense integration i… (#32716)
* Bump sense_energy 0.7.1 which also fixes throwing ConfigEntryNotReady
2020-03-12 17:02:27 -07:00
Raman Gupta
fe6ca522e8 Update Vizio source property to only return current app if i… (#32713)
* only return current app for source if current app is set

* check for None specifically

* make sure current app isn't called for speaker
2020-03-12 17:02:26 -07:00
Paulus Schoutsen
c46d0e4a49 Sonos idle (#32712)
* Sonos idle

* F-string

* Add to properties

* Fixes
2020-03-12 17:02:26 -07:00
Aaron Bach
8db426e5da Broaden exception handling for IQVIA (#32708) 2020-03-12 17:02:25 -07:00
Franck Nijhof
bfacd9a1c3 Remove deprecated hide_if_away from device trackers (#32705) 2020-03-12 17:02:24 -07:00
Barry Williams
943c7ee11a If device has volume disabled, the volume will be None. However in these (#32702)
instances whenever the volume was requested a division calculation was made
resulting in a TypeError. The volume adjustment from `0-100` to `0-1` is now
calculated during the `update()` method.
2020-03-12 17:02:23 -07:00
Franck Nijhof
71155f548f Bumped version to 0.107.0b0 2020-03-11 20:54:27 +01:00
Chris Talkington
180bcad477 Add codeowner for roku. (#32695) 2020-03-11 12:52:27 -07:00
Quentame
01dc81d8fb Fetch iCloud family devices only when wanted (#32644)
* Fetch iCloud family devices only when wanted

* Review: form data_schema as init schema
2020-03-11 20:43:37 +01:00
Chris Talkington
cea5cac6e2 Update directpy==0.7 for directv. (#32694) 2020-03-11 20:33:02 +01:00
Chris Talkington
bb666b9ac6 Add config flow to directv (#32162)
* initial work on config flow.

* more work on config flow.

* work on config flow and add tests. other cleanup.

* cleanup tests.

* fix test.

* isort

* Update .coveragerc

* Update test_init.py

* Update test_init.py

* Update test_init.py

* Update test_config_flow.py

* Update test_config_flow.py

* Update test_config_flow.py

* correct upnp serial format.

* improve config flow coverage.

* review tweaks.

* further review tweaks

* simplify dtv data gathering job

* lint

* black

* Update test_init.py

* Update test_init.py

* Simplify exception handling.

* Simplify exception handling.

* Update media_player.py

* Update test_media_player.py

* Update test_media_player.py

* Update test_media_player.py

* Update test_media_player.py

* Update test_media_player.py

* fix failing test.

* restore change made during debug.

* isort.

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-03-11 12:28:38 -07:00
Bram Kragten
c9a9bd16fe Updated frontend to 20200311.1 (#32691) 2020-03-11 12:18:11 -07:00
chiefdragon
3e8728ad5f Fix issue #23758 - Restore Canary sensors and ensure alarm con… (#32627)
* Fixed missing Canary sensors and Canary alarm control panel that was not updating correctly

* Resolved pylinting warnings in original tests
2020-03-11 11:58:42 -07:00
Paulus Schoutsen
d28d1ff657 Add JSON benchmark (#32690)
* Add JSON benchmark

* Fix logbook benchmarks

* Move logbook import back
2020-03-11 11:50:16 -07:00
jjlawren
44c7743351 Rewrite and add Plex tests (#32633)
* Rewrite and add Plex tests

* Remove unnecessary mocks

* Explicitly import constants for readability
2020-03-11 09:37:02 -07:00
Erik Montnemery
f7ddbc7e1e Remove duplicated config from MQTT tests (#32689) 2020-03-11 09:34:19 -07:00
Florian Werner
5216dc0ae1 Fix rate of change calculation of statistics sensor (#32597)
* Fix rate of change of statistics sensor

* Fix test
2020-03-11 09:33:00 -07:00
Alexei Chetroi
440c837eb6 Allow sw_version update of a device registry entry. (#32630) 2020-03-11 09:31:02 -07:00
Jc2k
ffe8b94d75 Simplfy homekit_controller characteristic writes (#32683) 2020-03-11 09:27:20 -07:00
Penny Wood
c56530a712 Connect to more recent versions of IZone (#32552)
* Update to new version of python-izone

* Improve disconnection handling.

* Update requirements-all

* Lint fix
2020-03-11 09:26:16 -07:00
cgtobi
50c32d57f5 Remove Netatmo binary sensor (#32673)
* Clean up for access scope review

* Remove deleted from coverage omit list
2020-03-11 09:25:19 -07:00
Robert Svensson
015e779d56 UniFi - Client tracker schedules update on disconnect event (#32655) 2020-03-11 09:24:52 -07:00
Franck Nijhof
01d0e70f44 Merge branch 'master' into dev 2020-03-11 17:03:36 +01:00
Bram Kragten
4c4e5f3fa9 Fix demos (#32086)
* Fixes for demos

* Update vacuum.py

* Comment

* Fix tests
2020-03-11 08:16:22 -07:00
David F. Mulcahey
7127492767 Additional ZHA cleanup (#32678)
* fix double device loading in tests

* change imports

* None is default
2020-03-11 13:37:28 +01:00
Jc2k
365578d053 Update homekit_controller to use CharacteristicPermissions constants (#32679) 2020-03-11 12:34:19 +00:00
Jc2k
647d137daa Refactor homekit_controller entity update to work more like update coordinator (#32670)
* Clean up use of get_characteristic_types

* Get rid of get_hk_char_value helper

* Get rid of _update_fn callbacks

* Call async_write_has_state directly as async_state_changed doesnt do anything any more
2020-03-11 07:40:47 -04:00
David F. Mulcahey
4248893007 Clean up custom polling in ZHA device and light (#32653)
* cleanup timer handle when device is removed

* separate unavailable times for mains vs battery

* better name

* remove light refresh handle when removing light

* remove unused parallel updates

* don't steal HA const for different purpose

* don't flood network every hour for lights

* update test to test both intervals

* add test for light refresh interval

* fix tests

* update test

* put parallel updates back for now...

* fix async_schedule_update_ha_state usage

* review comment

* review comment

* update test - review conversation

* review comments

* await count not call count

* flip some state
2020-03-11 07:17:53 -04:00
Bram Kragten
99109d162b Updated frontend to 20200311.0 (#32675) 2020-03-11 12:10:00 +01:00
Diogo Gomes
16336bf902 Add entity_service calibrate_meter to utility_meter (#32658)
* add calibrate service
2020-03-11 09:42:22 +01:00
Chris Talkington
69b19d54e8 Add codeowner for directv. (#32661) 2020-03-11 07:43:44 +01:00
Paul Madden
61acf944c0 Use bomradarloop v0.1.4 (#32660) 2020-03-11 07:27:07 +01:00
jjlawren
836b077bcc Bump python-ecobee-api to 0.2.2 (#32667) 2020-03-11 07:26:50 +01:00
Jc2k
1b5c9e922d Bump aiohomekit for more reconnect fixes (#32657) 2020-03-10 20:38:06 -04:00
J. Nick Koston
048f9e7daa Throw ConfigEntryNotReady when august servers are offline or u… (#32635)
* Throw ConfigEntryNotReady when august servers are offline

* august has tests now and its nearing 100%

* Adjust per review

* define in init
2020-03-10 17:10:00 -07:00
J. Nick Koston
ae147fd9c7 Lock operation sensors for August (#32593)
* adkj

* reduce

* Convert august to async

Async io was added to py-august 0.24

* Fix lint

* Lock operation sensors for august

* Tracking lock operation method allows user presence detection at the lock

* revert lock changes

* fix activity count merge conflict reversion

* Fix revert that come back with the conflict
2020-03-10 17:09:49 -07:00
cgtobi
b9a9a92145 Refactor netatmo webhooks (#32195)
* Start webhook implementation

* Add webhook implementation

* Bump pyatmo 3.2.5

* Fire event after data evaluation

* Setup webhooks after components

* Fix logging

* Wrap non async call

* Wrap non async call

* Add smoke detector and door tag webhook support

* Catch when webhook registration fails

* Log to debug

* Fix persons lookup

* Add dependency

* Remove false requirements

* Fix requirements

* Replace netatmo events by a single one

* Slim down code

* Clean up code

* Address review vomments

* Undo attribute removal

* Bump pyatmo to v3.3.0

* Only create webhook id once and reuse

* Store and reuse cloudhook url

* Wait for hass core to be up and running

* Register webhook once HA is ready

* Delay webhook registration
2020-03-10 17:08:59 -07:00
springstan
ba0aaeeddb Use f-strings in integrations starting with "M" (#32271)
* Use f-strings in integrations starting with "M"

* Format mqtt light init with black

* Fix lint error

* Fix pylint error

* Restore constants

* Update homeassistant/components/mqtt/discovery.py

* Update homeassistant/components/mqtt/discovery.py

* Update homeassistant/components/mqtt/discovery.py

* Update homeassistant/components/mqtt/discovery.py

* Format with Black
2020-03-10 23:34:54 +01:00
Bram Kragten
bbe0f75336 input_datetime guard for unexpected state on restore (#32652)
* input_datetime guard for unexpected state

If state is a time and has_date = true, or the other way around, restore state would error

* Update __init__.py

* Add test
2020-03-10 15:15:11 -07:00
Gerard
765882fc4d Fix bmw connected drive door_lock_state attribute error (#32074)
* Fix for door_lock_state attribute error

* Updates based on review comments

* Remove update_time

* Remove update time in lock

* Remove update time in sensor

* Remove unused variable

* Change return for device_state_attributes
2020-03-10 23:05:35 +01:00
J. Nick Koston
908ae23738 Add griddy integration (#32591)
* Add griddy integration

* Griddy is a wholesale power provider in Texas

* Supports all four load zones in Texas

* Provides real time power price which is useful for automations to handle demand response

* Update homeassistant/components/griddy/sensor.py

Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>

* Update homeassistant/components/griddy/config_flow.py

Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>

* Add ability request updated via entity update service.

* Improve error message about already configured

* Remove DEVICE_CLASS_POWER since we do not have a device class for cost

* remove setdefault that was left from previous refactor

* More detail on data naming

* Bump translation for testing

* git add the config flow tests

* s/PlatformNotReady/ConfigEntryNotReady/

* Review items

* git add the other missing file

* Patch griddypower

* reduce

* adjust target

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-03-10 23:00:30 +01:00
Aaron Bach
21cff003f8 Add options flow for AirVisual (#32634)
* Add options flow for AirVisual

* Code review

Co-Authored-By: Robert Svensson <Kane610@users.noreply.github.com>

Co-authored-by: Robert Svensson <Kane610@users.noreply.github.com>
2020-03-10 14:16:25 -06:00
Paulus Schoutsen
2c1da182e2 Merge pull request #32650 from home-assistant/rc
0.106.6
2020-03-10 13:01:35 -07:00
Paulus Schoutsen
39bdb562d3 Bumped version to 0.106.6 2020-03-10 11:50:54 -07:00
Paulus Schoutsen
1d1f8df509 Upgrade to coronavirus 1.1.0 (#32648) 2020-03-10 11:49:26 -07:00
Maikel Punie
ccb8b6b9c8 Update python-velbus to fix a missing data file (#32580) 2020-03-10 11:49:25 -07:00
Paulus Schoutsen
c0dcd9c674 Send messages conforming new facebook policy (#32516) 2020-03-10 11:49:24 -07:00
Quentame
6062854666 Get pending iCloud devices when available + request again when needs an update (#32400)
* Fetch iCloud devices again if the status is pending

* Remove "No iCloud device found" double check

* fix default api_devices value

* Remove useless unitialisation declarations
2020-03-10 11:49:11 -07:00
Paulus Schoutsen
a3c55b5e96 Upgrade to coronavirus 1.1.0 (#32648) 2020-03-10 11:47:07 -07:00
Paulus Schoutsen
89fc430eec Check against Switch attr not being None (#32647) 2020-03-10 11:28:11 -07:00
Vilppu Vuorinen
b2bb9cf134 Add support for MELCloud Air-to-Water devices (#32078)
* Add support for melcloud Air-to-Water devices

* Add water_heater entity for the water heater component.

* Add individual climate entities for 0-2 supported radiator zones.

* Add sensors for zone room temperatures, outdoor temperature and tank
temperature.

* Update .coveragerc

* Use device_state_attributes

Co-Authored-By: Martin Hjelmare <marhje52@gmail.com>

* Apply suggestions from code review

Co-Authored-By: Martin Hjelmare <marhje52@gmail.com>

* Complete state_attributes -> device_state_attributes migration

* Move constants to top of file

* Remove async_turn_on/off

* Drop mac from ATW unique_ids

* Add MAC to device_info connections

* Remove redundant ABC inheritance

* Update homeassistant/components/melcloud/water_heater.py

Co-Authored-By: Martin Hjelmare <marhje52@gmail.com>

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2020-03-10 11:00:07 -07:00
Robert Svensson
16d7f84be7 UniFi - Fix block functionality (#32625)
* Fix block functionality

* Remove unrelated changes

* Bump dependency to v15

* Run requirement script
2020-03-10 18:27:25 +01:00
Paulus Schoutsen
0a25e86fab Use callback instead of async methods in Timer (#32638) 2020-03-10 08:01:52 -04:00
Jc2k
c11a462f51 Clean up homekit_controller entity setup (#32628) 2020-03-10 12:06:44 +01:00
Paolo Tuninetto
a8758ed3a1 Add support for newer SamsungTV models (#31537)
* Added support for newer SamsungTV models

* Fixed legacy port

* store token in HA config directory

* Change token name

* rebasing and exception handling

* implement update

* fix error creating mediaplayer

* Debug logging

* Increase timeout

* Restore update timeout

* Store token_file path in config_entry

* Introduction of samsung bridge class

* Added bridge class functions

* Code cleanup

* more fixes

* Begin testing

* samsungtvws 1.2.0

* Config flow tests 0.1

* Fixed some mediaplayer tests

* Fixed fixture in media player

* use of constants and turn off

* more media player tests

* samsungtvws 1.3.1 and other fixes

* WS tv update rewritten

* more tests

* test_init

* fixed tests

* removed reset mock

* tests reset mock

* close_remote and tests

* deprecate port config

* deprecate port config 2

* deprecate port config 3

* save token only if needed

* cleanup

* better websocket protocol detection

* config removal
2020-03-10 11:48:09 +01:00
Quentame
2e802c88f8 Add devices check to iCloud config flow (#31950)
* Add devices check to iCloud config flow

* Some test rename

* Bump pyicloud to catch KeyError
2020-03-10 11:42:04 +01:00
Michaël Arnauts
8c52e2c923 Revert "Breakout tado zone code into a single place (#32564)" (#32639)
This reverts commit c2b03332a0.
2020-03-10 09:32:56 +01:00
Paul Enright
ac9c9377c2 Add tests for workday sensor (#31832)
* Workday Fix

* fix pylint errors

* Update binary_sensor.py

* Update test_binary_sensor.py

Added tests to match the document new configuration examples
2020-03-10 08:53:06 +01:00
Robert Chmielowiec
11eee43fc7 Remove facebook broadcast api (#32517)
* Remove facebook broadcast api

* Update notify.py

* Revert API Version change
2020-03-10 08:21:04 +01:00
Georgi Gardev
aed15761de Sonos: Return URI as media_content_id (#32626) 2020-03-10 08:17:07 +01:00
Erik Montnemery
324dfe07b4 Clear discovery topic for MQTT device triggers (#32617) 2020-03-09 21:59:38 -07:00
Thomas Hollstegge
f3c07a5653 Alexa: Add support for starting and cancelling timers (#32616) 2020-03-09 21:59:06 -07:00
Aaron Bach
f4561891ae Ensure AirVisual import config flow checks API key correctness (#32624)
* Add small improvements to AirVisual config flow tests

* Code review comments

* Code review comments
2020-03-09 21:39:42 -06:00
J. Nick Koston
c2b03332a0 Breakout tado zone code into a single place (#32564)
* Breakout tado zone code into a single place

* Resolve various incorrect states and add tests for known tado zone states

* Fix home and away presets

* Upgrade to PyTado 0.4.0 which improves http performance and fixes setting fan speed.

* Write state instead of calling for an update

* adjust codeowners

* Add tests for michael's tado and fix heatingPower.value

* Guards are much cleaner

* Adjust per review

* Remove hass passing
2020-03-09 17:44:34 -07:00
J. Nick Koston
3a680bf7b7 Add a commit interval setting to recorder (#32596)
* Add a commit interval setting to recorder

* Make the default every 1s instead of immediate

* See attached py-spy flamegraphs for why 1s

* This avoids disk thrashing during event storms

* Make Home Assistant significantly more responsive on busy systems

* remove debug

* Add commit forces for tests that expect commits to be immediate

* Add commit forces for tests that expect commits to be immediate

* make sure _trigger_db_commit is in the right place (all effective "wait_recording_done" calls)

* De-duplicate wait_recording_done code
2020-03-09 17:43:26 -07:00
Paulus Schoutsen
8a46d93be4 Upgrade hass_nabucasa to 0.32.2 (#32522)
* Upgrade hass_nabucasa to 32.1

* Fix tests

* Update hass-nabucasa to 0.32.2

Co-authored-by: Pascal Vizeli <pvizeli@syshack.ch>
2020-03-09 17:42:26 -07:00
Alexei Chetroi
87b770be08 Add PollControl cluster support to ZHA (#32618)
* Poll control channel

Set check-in interval to 55min.
Set long-poll interval to 6s.

* Update tests.

* Don't use magic numbers.
2020-03-09 19:55:25 -04:00
Aaron Bach
9a3c58213b Validate WWLLN window size in config schema (#32621)
* Validate WWLLN window size in config schema

* Cleanup

* Clean up imports

* Fix tests
2020-03-09 17:18:39 -06:00
Paulus Schoutsen
d4615fd432 Freeze config entry data (#32615)
* Freeze config entry data

* Fix mutating entry.data

* Fix config entry options tests
2020-03-09 14:07:50 -07:00
J. Nick Koston
3318e65948 Convert august to async (#32586)
* Convert august to async

Async io was added to py-august 0.24

* Fix lint
2020-03-09 13:54:05 -07:00
marengaz
09512e9f8b Reflect new repo name (#32611) 2020-03-09 12:46:52 -07:00
Maciej Bieniek
96a0aa3d2b Add new sensors to Brother integration (#32466)
* Add new sensors

* Suggested change
2020-03-09 11:54:43 -07:00
Erik Montnemery
4bb9f1800d Deduplicate MQTT mixin tests (#32563)
* Deduplicate MQTT mixin tests

* Remove test of not yet merged function
2020-03-09 09:40:00 -07:00
Alexei Chetroi
743833e5f3 Bump up ZHA dependencies. (#32609)
* Bump up ZHA dependencies.

* Update tests to match library changes.
2020-03-09 12:39:41 -04:00
David Nielsen
988b400a9c Fix TypeError Exception in AlexaSpeaker (#32318)
* alexa/capabilities.py: Fix TypeError Exception

    - Remove division by zero try/catch -- there is no division
    - Handle TypeError exception when current_volume = None
    - Simplify math and return logic

* Add test for Alexa.Speaker's valid volume range
2020-03-09 09:38:31 -07:00
Jc2k
19faf06ce7 homekit_controller fixes from testing with an LG TV: (#32610)
* Bump aiohomekit to get better reconnection handling and cleaner shutdowns.
 * Read the ACTIVE characteristic and set ok/problem state

Also gets test coverage to 100%.
2020-03-09 12:19:17 -04:00
Thomas Hollstegge
22b5690607 Alexa: Support vacuums without turn_on/turn_off feature (#32570)
* Alexa: Support vacuums without turn_on/turn_off feature
2020-03-09 11:58:47 -04:00
lewei50
e1d6964589 Add IamMeter integration (#30465)
* Update .coveragerc

* Update requirements_all.txt

* Create manifest.json

* Add files via upload

* add codeowner

* add codeowner.

* Update sensor.py

* Update sensor.py

* remove unused import.

* Update manifest.json

* Update sensor.py

* modify requirements_all.txt.

* order imports.

* Update sensor.py

* Use DataUpdateCoordinator rewrite code

* set should_poll to False

* remove unused code 'serial'.

* add available prop

* Update homeassistant/components/iammeter/sensor.py

Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com>

* Update homeassistant/components/iammeter/sensor.py

Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com>

* Update homeassistant/components/iammeter/sensor.py

Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com>

* Update homeassistant/components/iammeter/sensor.py

Co-Authored-By: Martin Hjelmare <marhje52@gmail.com>

* Update homeassistant/components/iammeter/sensor.py

Co-Authored-By: Martin Hjelmare <marhje52@gmail.com>

* Update homeassistant/components/iammeter/sensor.py

Co-Authored-By: Martin Hjelmare <marhje52@gmail.com>

* Update sensor.py

* Update sensor.py

Co-authored-by: springstan <46536646+springstan@users.noreply.github.com>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2020-03-09 08:39:39 -07:00
ochlocracy
fa4f27f78e Remove AlexaPowerController from device_class garage covers in… (#32607) 2020-03-09 08:25:33 -07:00
Franck Nijhof
c0c5c33b20 Fix Withings timezone test (#32602) 2020-03-09 13:45:39 +01:00
Mans Matulewicz
a6e0ab2b3a Add thinkingcleaner optional host param (#32542)
* adding support for optional host param

as thinkingcleaner backend was having issues (again)
-> https://www.thinkingsync.com/

* Update switch.py

* Update sensor.py

* Update switch.py

* Update sensor.py

* Update switch.py

* Update switch.py

* Update sensor.py
2020-03-09 12:56:26 +01:00
Kris Bennett
f7f6c47973 Add Steam game ID and screenshot paths as attributes (#32005)
* Update Steam intergration to list screenshot paths and Steam game ID

* Steam entity_picture now changed to game art when in-game

* Steam - changing API endpoints to constants

* Steam - formatting code for lint

* Update sensor.py

*Removing entity_picture image switching based on current playing game

* Steam - tidying up code

* Update homeassistant/components/steam_online/sensor.py

Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com>

Co-authored-by: springstan <46536646+springstan@users.noreply.github.com>
2020-03-09 11:38:24 +01:00
Dave T
df86668dfc Correct grammatical error in CUSTOM_WARNING (#32569) 2020-03-09 09:40:08 +01:00
jey burrows
5ace7de171 Bump rflink to 0.0.52 (#32588) 2020-03-09 09:35:54 +01:00
seanvictory
0dd0b2fa03 Add support for Ubee Router DVW32CB (#32406)
* Update PyUbee to 0.9

Adds support for Ubee Router DVW32CB

* Add support for Ubee Router DVW32CB

* Update pyubee to 0.9

Adds support for router DVW32CB
2020-03-09 09:04:53 +01:00
Oliver
963b5db763 Bump denonavr to 0.8.0 (#32578) 2020-03-08 23:43:12 +01:00
Josef Schlehofer
f54c50fae3 Upgrade youtube_dl to version 2020.03.08 (#32581) 2020-03-08 23:37:58 +01:00
Quentame
8a878bbe72 Bump pyicloud to 0.9.3 (#32582) 2020-03-08 23:32:14 +01:00
Maikel Punie
4fbc404c47 Update python-velbus to fix a missing data file (#32580) 2020-03-08 19:10:05 +01:00
Daniel Høyer Iversen
b5118c41a6 Add Tibber retry (#32554)
* Add retry setup to Tibber

* tibber lib

* update comment

* update comment

* increase delay for every try

* Update homeassistant/components/tibber/__init__.py

Co-Authored-By: Martin Hjelmare <marhje52@gmail.com>

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2020-03-08 12:20:33 +01:00
Anders Melchiorsen
17215709e1 Simplify logbook duplicate handling (#32572) 2020-03-07 20:27:51 -08:00
J. Nick Koston
a0787cd9be Bump zeroconf to 0.24.5 (#32573)
* Bump zeroconf to 0.24.5

* Empty commit to force ci re-run
2020-03-08 08:52:27 +05:30
Alexei Chetroi
7e781946fa Refactor ZHA device keep alive checker (#32561)
* Refactor zha core device _check_available().
Make it async, so we don't run it in a sync worker.

* Use random keep alive interval for zha device pings.
* Update tests.
2020-03-07 13:52:45 -05:00
David F. Mulcahey
732457745f Add guard to ZHA device triggers (#32559) 2020-03-07 12:59:18 -05:00
Ivan Belokobylskiy
1f510389b8 Fix Yandex transport after API change (#32500)
* Update Yandex transport after API change (home-assistant#32431)

* Update mocked response for test (home-assistant#32431)

* Codestyle fixes (home-assistant#32431)
2020-03-07 18:26:35 +01:00
shred86
ae2e6f9d2a Fix unnecessary method call (#32549) 2020-03-07 16:13:39 +01:00
David F. Mulcahey
e52542c4d7 Allow multiple attribute reads in ZHA (#32498)
* multi attribute reads for lights

* catch specific exceptions

* get attributes

* fix mains powered update

* add guards and use get_attributes

* use debug for read failures

* cleanup

* update return value for read_attributes

* fix on with timed off
2020-03-07 07:33:59 -05:00
Alexei Chetroi
dd91b51435 Make ZHA Scene channel an eventable channel. (#32546) 2020-03-06 17:32:26 -05:00
Raman Gupta
28a5fca7f4 fix step name in strings.json for vizio (#32536) 2020-03-06 10:56:15 -08:00
Tom Schneider
8f2567f30d Add config_flow to shopping_list (#32388)
* Add config_flow to shopping_list

* Fix pylint unused import error

* Use _abort_if_unique_id_configured

* Remove SHOPPING_LIST const

* Use const.py for DOMAIN and CONF_TYPE

* Fix tests

* Remove unchanged variable _errors

* Revert CONF_TYPE (wrong usage)

* Use consts in test

* Remove import check

* Remove data={}

* Remove parameters and default values

* Re-add data={}, because it's needed

* Unique ID checks and reverts for default parameters

* remove pylint comment

* Remove block till done

* Address change requests

* Update homeassistant/components/shopping_list/strings.json

Co-Authored-By: Quentame <polletquentin74@me.com>

* Update homeassistant/components/shopping_list/strings.json

Co-Authored-By: Quentame <polletquentin74@me.com>

* Update tests/components/shopping_list/test_config_flow.py

Co-Authored-By: Quentame <polletquentin74@me.com>

* Update tests/components/shopping_list/test_config_flow.py

Co-Authored-By: Quentame <polletquentin74@me.com>

* Update tests/components/shopping_list/test_config_flow.py

Co-Authored-By: Quentame <polletquentin74@me.com>

* Update tests/components/shopping_list/test_config_flow.py

Co-Authored-By: Quentame <polletquentin74@me.com>

* Only test config_flow

* Generate translations

* Move data to end

* @asyncio.coroutine --> async def, yield from --> await

* @asyncio.coroutine --> async def, yield from --> await (tests)

* Remove init in config flow

* remove if not hass.config_entries.async_entries(DOMAIN)

* Add DOMAIN not in config

* Fix tests

* Update homeassistant/components/shopping_list/config_flow.py

Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>

* Fix tests

* Update homeassistant/components/shopping_list/__init__.py

Co-Authored-By: Martin Hjelmare <marhje52@gmail.com>

Co-authored-by: Quentame <polletquentin74@me.com>
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2020-03-06 10:17:30 -08:00
Rami Mosleh
e1cc2acdf9 Specify rtsp_transport for Onvif Camera (#31918)
* specify rtsp_transport for onvif camera

* remove used variable

* Update homeassistant/components/stream/__init__.py

Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>

* change options to stream_options

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-03-06 09:59:57 -08:00
Bram Kragten
ac945242dc Updated frontend to 20200306.0 (#32532) 2020-03-06 17:42:19 +01:00
Jc2k
2879081772 Implement source switching for homekit_controller televisions (#32526) 2020-03-06 15:47:40 +00:00
olijouve
0d667c1bd9 Add more onvif PTZ move modes (#30152)
* Adding support for PTZ move modes

Adding support for other PTZ move modes.
Onvif intergration used to only support RelativeMove where it should also supports AbsoluteMove, ContinuousMove and Stop.
For exemple Goke GK7102 based IP camera only support ContinuousMove mode.

This commit add those new modes with avaibility to select mode and params in service call.

* Adding support for PTZ move modes

Adding support for other PTZ move modes.
Onvif intergration used to only support RelativeMove where it should also supports AbsoluteMove, ContinuousMove and Stop.
For exemple Goke GK7102 based IP camera only support ContinuousMove mode.

Update service helper for new avaibility to select mode and params in service call.

* RelativeMode as default move_mode to avoid breakchange

RelativeMode as default move_mode to avoid breakchange

* add missing attribute

add missing continuous_duration attribute

* change service attribute label for continuous_duration

* update description

fix wrong assertion for move_mode attr description

* Update services.yaml

* Update services.yaml

fix wrong wording for move_mode

* Update camera.py

Using defined constants instead of  raw strings in conditions

* Update camera.py

Replace integer to floating point in logger debug PTZ values

* Update services.yaml

* Update services.yaml

* Update camera.py

* Update camera.py

* use dict[key] for required schema keys and keys with default schema values

* remove async for setup_ptz method

* lint error

* remove unecessary PTZ_NONE = "NONE"

changed request by @MartinHjelmare

* addressing @ MartinHjelmare comments

- Remove None in defaluts and dicts
- Replace long if blocks

* remove NONE

* lint issue

* Update camera.py

* Fix lint error - typo

* rename onvif_ptz service to just ptz

* rename onvif_ptz service to just ptz

* use dict[key] when default values are set

use service.data[key] instead of service.data.get[key] when default value is set in service schema

* adresse comment: use dict[key] for pan tilt zoom

* Apply suggestions from code review

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2020-03-06 15:14:01 +01:00
Chris Talkington
3b75fdccfd Add availability to roku media player entities (#32484)
* track if roku is available based on update errors.

* Update media_player.py

* Update media_player.py
2020-03-06 13:55:32 +01:00
Josef Schlehofer
5f6158f656 Upgrade youtube_dl to version 2020.03.06 (#32521) 2020-03-06 07:30:04 +01:00
Paulus Schoutsen
e02042b33e Send messages conforming new facebook policy (#32516) 2020-03-05 17:19:30 -08:00
Paulus Schoutsen
19254eee30 Upgrade hass-nabucasa to 0.32 (#32508) 2020-03-05 13:34:24 -08:00
Paulus Schoutsen
a579fcf248 Add app support for TVs to Vizio integration (#32432)
* add app support

* code cleanup, add additional test, add CONF_APPS storage logic for import

* simplify schema defaults logic

* remove unnecessary lower() and fix docstring

* remove default return for popping CONF_APPS during import update because we know entry data has CONF_APPS due to if statement

* further simplification

* even more simplification

* fix type hints

* move app configuration to separate step, fix tests, and only make app updates if device_type == tv

* remove errors variable from tv_apps and move tv_apps schema out of ConfigFlow for consistency

* slight refactor

* remove unused error from strings.json

* set unique id as early as possible

* correct which dictionary to use to set unique id in pair_tv step
2020-03-05 13:34:12 -08:00
Paulus Schoutsen
873bf887a5 Add OwnTracks Friends via person integration (#27303)
* Returns an unencrypted location of all persons with device trackers

* Handle encrypted messages and exclude the poster's location

* Friends is by default False. Reformats with Black

* Updates the context init to account for the Friends option

* Fix Linter error

* Remove  as a config option

* No longer imports encyrption-related functions in encrypt_message

* Fix initialization in test

* Test the friends functionality

* Bugfix for persons not having a location

* Better way to return the timestamp

* Update homeassistant/components/owntracks/__init__.py

Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>

* Linting and tid generation

* Fix test

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-03-05 12:55:48 -08:00
David F. Mulcahey
b5022f5bcb guard against invalid trigger and action scenarios (#32512) 2020-03-05 15:52:09 -05:00
David Bonnes
ae0ea0f088 Bugfix evohome converting non-UTC timezones (#32120)
* bugfix: correctly handle non-UTC TZs
* bugfix: system mode is always permanent
* bugfix: handle where until is none
* tweak: improve logging to support above fixes
2020-03-05 20:42:52 +00:00
Paulus Schoutsen
4717d072c9 Remove discovery and legacy config file loading for Plex (#32510) 2020-03-05 12:36:18 -08:00
Paulus Schoutsen
8aea538662 Allow teaching logbook about events (#32444)
* Allow teaching logbook about events

* Use async_add_executor_job

* Fix tests
2020-03-05 11:55:50 -08:00
Paulus Schoutsen
7c51318861 Require title, separate show sidebar option (#32479)
* Require title, separate show sidebar option

* Fix list command not updating

* Some more test checks
2020-03-05 11:52:12 -08:00
Paulus Schoutsen
d885853b35 Make it possible to fetch proxy media player album art (#32471) 2020-03-05 11:45:36 -08:00
Paulus Schoutsen
6a21afa2a8 Improve script validation (#32461) 2020-03-05 11:44:42 -08:00
Ville Skyttä
da7c5518f3 Add Huawei LTE operator and network related sensors (#32485)
* Add Huawei LTE operator and network related sensors

Adds "Operator search mode", "Operator name", "Operator code", and "Preferred mode" sensors

* Blackify

* Blackify "Add Huawei LTE operator and network related sensors"
2020-03-05 21:29:53 +02:00
Jc2k
007d934214 Initial support for HomeKit enabled televisions (#32404)
* Initial support for HomeKit enabled televisions

* Fix nit from review
2020-03-05 13:49:56 +00:00
Quentame
85ba4692a9 Get pending iCloud devices when available + request again when needs an update (#32400)
* Fetch iCloud devices again if the status is pending

* Remove "No iCloud device found" double check

* fix default api_devices value

* Remove useless unitialisation declarations
2020-03-05 08:50:39 +01:00
Paulus Schoutsen
521cc7247d Add Dynalite switch platform (#32389)
* added presets for switch devices

* added channel type to __init and const

* ran pylint on library so needed a few changes in names

* removed callback

* bool -> cv.boolean
2020-03-04 22:05:39 -08:00
Paulus Schoutsen
d216c1f2ac UniFi - Add block network access control to config option (#32004)
* Add block network access control to config option

* Clean up
2020-03-04 21:55:56 -08:00
Paulus Schoutsen
1615a5ee81 Use unique_id in Plex config entries (#32489) 2020-03-04 21:42:48 -08:00
Paulus Schoutsen
81f99efda1 Mock all invocations of coronavirus.get_cases (#32487) 2020-03-04 21:42:07 -08:00
Paulus Schoutsen
81810dd920 Modernize WWLLN config flow (#32194)
* Modernize WWLLN config flow

* Code review

* Update tests
2020-03-04 18:23:00 -08:00
Paulus Schoutsen
56cf4e54a9 Add github sensor latest tag attribute (#32360)
* Add attribute 

latest release tag

* add attrs = 

and only create attr Tag if exists
made requested changes

* change condition for _latest_release_tag

to use self._github_data.latest_release_url

* Correct changes

* Update sensor.py

* blackify
2020-03-04 18:14:45 -08:00
Paulus Schoutsen
9a4aad1777 Add async_setup_entry/async_unload_entry for remote platform (#31974)
* add async_setup_entry for remote platform

* add async_unload_entry for remote platform

* Update __init__.py

* Update __init__.py

* Update __init__.py

* Update __init__.py

* Update __init__.py

* Update __init__.py

* Update __init__.py

* Type

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-03-04 18:09:17 -08:00
Paulus Schoutsen
daff87fe5d Emoncms API now provides a Unit of Measurement (#32042)
* Emoncms API provides a Unit

The EmonCMS API has been amended to include a 'unit' as part of it's payload.  By using this information, all the sensors can be created without the need for individual sensors to be setup by type.

The change is backward compatible so if a unit type has been specified in the configuration, this will be used by default.

If no unit is pecified either by the Home Assistant configuration, or the Emoncms API, then the default of W will be used as before.

* Update sensor.py

Check the 'unit' key is in the API call. Older systems may not have that key in the payload.

* Modified approach with new configuration item

* Removed new config item

Removed the configuration item. The integration attempts to get the unit from the API.

If this fails *or* the unit key of the API is blank, either the specified unit, or the default will be used.

If approved, documentation will be updated.

* Update homeassistant/components/emoncms/sensor.py

Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com>

* Update homeassistant/components/emoncms/sensor.py

Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com>

* Apply suggestions from code review

* Apply suggestions from code review v2

* Update homeassistant/components/emoncms/sensor.py

Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com>

* Update sensor.py

Update `config_unit`

Co-authored-by: springstan <46536646+springstan@users.noreply.github.com>
2020-03-04 18:03:51 -08:00
Paulus Schoutsen
bfe1e8fef3 fix double tab and match events. (#32108)
this propose makes some logic to the device triggers, matching the events for the aqara cube.
this also fixes the double tap function on side 2
2020-03-04 17:54:00 -08:00
Paulus Schoutsen
b848c97211 Add soundtouch attributes exposing multiroom zone info (#28298)
* [soundtouch] workaround for API bug when removing multiple slaves from a zone at once

* [soundtouch] added additional attributes exposing multiroom zone info

* Fix update with slave entities

* Add zone attributes test

* Fix and clean up tests

* Fix typo

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2020-03-04 17:53:15 -08:00
Paulus Schoutsen
2316f7ace4 Add edl21 component for SML-based smart meters (#27962)
* Add edl21 component for SML-based smart meters

* edl21: Remove unused variable

* [edl21] Add 1 minute throttle to the sensor

* Update homeassistant/components/edl21/manifest.json

Fix documentation URL

Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>

* edl21: Move imports to top

* edl21: Remove special case for STATE_UNKNOWN, which replicated default behavior

* edl21: Implement blacklist for and warn about unhandled OBIS values

* edl21: Make blacklist global

* edl21: Add filter to issues URL

Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>

* edl21: Rename device to entity

* edl21: Don't schedule async_add_entities

* edl21: Use dispatcher, implement own throttling mechanism

* edl21: Simplify keeping track of known obis

* edl21: Use whitelist for state attributes

* edl21: Remove dispatcher on shutdown

* edl21: Convert state attributes to snakecase

* edl21: Annotate handle_telegram with @callback

* edl21: Call async_write_ha_state instead of schedule_update_ha_state

Co-authored-by: David Straub <straub@protonmail.com>
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-03-04 17:43:12 -08:00
Paulus Schoutsen
c4ed2ecb61 Add node_def_id for ISY994i wrapped X10 modules (#31815) 2020-03-04 17:42:18 -08:00
Paulus Schoutsen
eac1f029e5 Allow string values on zwave.set_node_value (#31061)
* Allow string values on zwave.set_node_value

This allows for:

* Accessing longer value_ids. In some cases, value ids in z-wave nodes are very large (17 digits in my case). Passing them as int does not seem to work well (python probably truncates the number), but passing them as string works fine
* Changing color values, which are represented as hex string

reformat test

* update services.yaml with string set_node_value
2020-03-04 17:40:58 -08:00
Paulus Schoutsen
1d3647e6a1 Make gen_requirements_all.py case insensitive for ignored pack… (#30885) 2020-03-04 17:39:59 -08:00
Paulus Schoutsen
2d3b117cb8 Use SCAN_INTERVAL instead of Throttle for google travel time (#31420)
The documentation for google_travel_time was at odds with the
implementation. The documentation stated a default scan time of
5 minutes, but the implementation was using Throttle which resulted
in the sensor updating at a maximum rate of one API call every
5 minutes. This was especially at odds with a given example at
the end of the documentation, which showed updating the sensor
every 2 minutes during commute times.

This change brings the implementation in line with the docs by
adopting the `SCAN_INTERVAL` constant set to the stated default
of 5 minutes and removing the Throttle.
2020-03-04 17:39:28 -08:00
Paulus Schoutsen
7b5b909f0a ZHA Dependencies bump (#32483)
* ZHA Dependencies bump.

* Bump up ZHA dependencies.
2020-03-04 17:35:07 -08:00
Paulus Schoutsen
3ca97a0517 Add sighthound timestamped file (#32202)
* Update image_processing.py

Adds save timestamp file and adds last_detection attribute

* Update test_image_processing.py

Adds test

* Adds assert pil_img.save.call_args

* Test timestamp filename

* Add test bad data

* Update test_image_processing.py

* Fix bad image data test

* Update homeassistant/components/sighthound/image_processing.py

Co-Authored-By: Martin Hjelmare <marhje52@gmail.com>

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2020-03-04 17:31:54 -08:00
Alexei Chetroi
e416f17e4d ZHA: Successful pairing feedback (#32456) 2020-03-04 19:27:37 -05:00
Paulus Schoutsen
76fec90fec Reduce log level for initial error and bump library version (#32381)
* Reduce log level for initial error and bump library version

  * Use new buienradar library version which reduces the log level
    for some types of warnings.
  * Initially logs at a lower level and only logs at WARN for repeated
    errors.

This should serve to reduce confusion with users such as in
issue #32301.

* Fix linter error with new linter settings.

* Fix linter warning

* Update homeassistant/components/buienradar/util.py

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-03-04 15:32:44 -08:00
Quentame
15a5cebd5f Add icons to Coronavirus (#32480)
* Add icons to Coronavirus

* Update homeassistant/components/coronavirus/sensor.py

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-03-05 00:02:22 +01:00
Paulus Schoutsen
9a8017aadd Add more Huawei LTE sensors (#32123)
* Add Huawei LTE WiFi client count and DNS server sensors

* Add Huawei LTE current month statistics sensors
2020-03-04 14:56:37 -08:00
Paulus Schoutsen
d1beb92c5d Add abode support for CUE automations (#32296)
* Add support for CUE automations

* Update requirements

* Minor update to string name
2020-03-04 14:54:28 -08:00
Paulus Schoutsen
2abdfc9da6 GeoNet NZ Quakes code improvements (#32338)
* code quality improvements

* code quality improvements and fixed tests

* explicitly set unique ids

* improve unique id creation

* remove entities from entity registry

* added test for removing entities from entity registry

* revert entity registry handling from sensor and test code

* check for entity registry removal in geolocation test case

* make import absolute; isort

* change quality scale
2020-03-04 14:52:16 -08:00
Paulus Schoutsen
dd7d8d4792 Remove 'show all controls' option for Plex (#32391) 2020-03-04 14:42:50 -08:00
Paulus Schoutsen
0e436ac80e add const file for roku (#32470) 2020-03-04 14:24:59 -08:00
springstan
c7d983fd44 Catch an extra error for Ring (#32477) 2020-03-04 23:09:54 +01:00
Daniel Høyer Iversen
0c0d4c460f Upgrade Tibber library to 0.13.2 (#32478) 2020-03-04 22:48:00 +01:00
Pascal Vizeli
9aaab41985 Deprecate camera WS API (#32473) 2020-03-04 21:58:07 +01:00
Paulus Schoutsen
0763dc6089 Fix filter sensor processing states that aren't numbers (#32453)
* lint

* only_numbers flag
2020-03-04 12:47:53 -08:00
Martin Hjelmare
e9978e77bd Upgrade huawei-lte-api to 1.4.10 (#32472)
https://github.com/Salamek/huawei-lte-api/releases/tag/1.4.8
https://github.com/Salamek/huawei-lte-api/releases/tag/1.4.9
https://github.com/Salamek/huawei-lte-api/releases/tag/1.4.10
2020-03-04 20:51:56 +01:00
HomeAssistant Azure
104350265d [ci skip] Translation update 2020-03-04 18:13:24 +00:00
Alexei Chetroi
20333703c5 Remove ZHA attribute listening channel (#32468)
* remove AttributeListeningChannel
* pull sleeps
* update signature to fix pylint
2020-03-04 13:11:53 -05:00
J. Nick Koston
7f91501a36 Use a requests Session for rest sensors (#32463)
This avoids the ssl setup overhead for each request
2020-03-04 08:32:38 -08:00
Paulus Schoutsen
b27c46750c Update error handling in update coordinator (#32452) 2020-03-04 08:05:46 -08:00
z0p
f62322cfb4 Add set_speed to smarty fan (#32255) 2020-03-04 10:09:33 +01:00
Raman Gupta
4f619691df Add is_volume_muted property to vizio integration (#32332)
* add is_muted property and update tests

* black

* manually set is_muted on async_mute_volume calls to set state early

* combine two lines into one

* set is_muted to None when device is not on
2020-03-04 10:04:52 +01:00
Alan Tse
6a6bf517fe Add energy added attribute to Tesla charging rate sensor (#32368)
* Add charge_energy_added attribute

* Bump teslajsonpy
2020-03-04 10:00:34 +01:00
Paulus Schoutsen
7678d66464 Fix device tracker TrackerEntity defaults (#32459) 2020-03-04 09:43:52 +01:00
Philipp Schmitt
af76a336af Update roombapy to 1.4.3 (#32462) 2020-03-04 09:41:34 +01:00
Austin Mroczek
d666b15689 Bump total-connect-client to 0.53 (#32460) 2020-03-04 08:08:31 +01:00
Paulus Schoutsen
4be9766498 Merge pull request #32457 from home-assistant/rc
0.106.5
2020-03-03 20:19:14 -08:00
Paulus Schoutsen
4080d6a822 Bumped version to 0.106.5 2020-03-03 18:26:19 -08:00
Robert Svensson
6d06844318 UniFi - Fix websocket bug (#32449) 2020-03-03 18:26:11 -08:00
Paulus Schoutsen
a150d6dcf3 Remove hassfest blacklisted rest (#32441)
* Remove blacklisted deps from hassfest deps

* Whitelist all internal integrations
2020-03-03 18:26:10 -08:00
Achilleas Pipinellis
a0390783bb Fix pushover's ATTR_RETRY env variable typo (#32440) 2020-03-03 18:26:10 -08:00
J. Nick Koston
91b10e875f Properly define dependency for pvoutput integration on rest in… (#32435) 2020-03-03 18:26:09 -08:00
Paulus Schoutsen
f04969cf30 Filter out duplicate logbook states (#32427) 2020-03-03 18:26:08 -08:00
Alan Tse
cdde5a37cd Fix too many device tracker updates in log for Tesla (#32426)
* Fix Tesla too many device tracker updates in log

* Empty commit to re-trigger build

Co-authored-by: Franck Nijhof <frenck@frenck.nl>
2020-03-03 18:26:07 -08:00
Alan Tse
f0c7a7c1bf Fix too many device tracker updates in log for Tesla (#32426)
* Fix Tesla too many device tracker updates in log

* Empty commit to re-trigger build

Co-authored-by: Franck Nijhof <frenck@frenck.nl>
2020-03-03 18:25:32 -08:00
Achilleas Pipinellis
7e3e4c1668 Fix pushover's ATTR_RETRY env variable typo (#32440) 2020-03-03 17:36:28 -08:00
Robert Svensson
02c8cd07f3 UniFi - Fix websocket bug (#32449) 2020-03-03 17:32:13 -08:00
Paulus Schoutsen
4cf86262af Numeric state trigger: validate that above is not above below (#32421)
* Numeric state trigger: validate that above is not above below

* Lint
2020-03-03 17:26:44 -08:00
Paulus Schoutsen
db7d0eb9b9 Remove hassfest blacklisted rest (#32441)
* Remove blacklisted deps from hassfest deps

* Whitelist all internal integrations
2020-03-03 13:57:09 -08:00
Paulus Schoutsen
fed23030d6 Filter out duplicate logbook states (#32427) 2020-03-03 13:56:32 -08:00
Paulus Schoutsen
8f6651af3d Update system log grouping (#32367) 2020-03-03 13:55:15 -08:00
Alexei Chetroi
896df9267a Fix ZHA device healthcheck pings (#32425) 2020-03-03 13:37:17 -05:00
J. Nick Koston
cfa61a6b74 Properly define dependency for pvoutput integration on rest in… (#32435) 2020-03-03 09:25:50 -08:00
J. Nick Koston
1119da7e8a Flume Cleanups (unique id, fix missing timeout, http session,… (#32384)
* Flume Cleanups

* Sensors now show the name

* include_devices and exclude_devices are now available in the config.

* Address review items

* bump as 0.3.0 is published
2020-03-03 09:22:26 -08:00
Jeff Irion
59b4e42f8b Remove SUPPORT_PLAY_MEDIA from Roku (#32378) 2020-03-03 16:59:32 +01:00
Maciej Bieniek
2f8381b1bf Bump brother library (#32436) 2020-03-03 16:59:02 +01:00
Pascal Vizeli
5bbbe60635 Disable codecov because it stop working after renaming.
Come back with GitHub action migration
2020-03-03 16:06:17 +01:00
Bram Kragten
558da56d75 Update config.yml 2020-03-03 11:11:38 +01:00
Paulus Schoutsen
a0403a8864 Merge pull request #32424 from home-assistant/rc
0.106.4
2020-03-02 19:41:01 -08:00
Paulus Schoutsen
bfaad97318 Add unique ID to coronavirus (#32423) 2020-03-02 18:10:51 -08:00
Paulus Schoutsen
c62961f40c Add unique ID to coronavirus (#32423) 2020-03-02 18:10:38 -08:00
Paulus Schoutsen
d6c15d2f45 Bumped version to 0.106.4 2020-03-02 18:04:07 -08:00
Paulus Schoutsen
815502044e Coronavirus updates (#32417)
* Sort countries alphabetically

* Update sensor name

* Add migration to stable unique IDs

* Update sensor.py
2020-03-02 18:04:01 -08:00
mezz64
08f5b49dc4 Catch Eight Sleep API errors, don't round None type (#32410)
* Catch API errors, don't round None type

* Specify error type
2020-03-02 18:04:00 -08:00
mezz64
fab55b0ea2 Bump pyeight to 0.1.4 (#32363) 2020-03-02 18:03:59 -08:00
elmurato
649ec2fc8e Fixed TypeError with old server versions (#32329) 2020-03-02 18:03:59 -08:00
mezz64
aacdc1bc2d Catch Eight Sleep API errors, don't round None type (#32410)
* Catch API errors, don't round None type

* Specify error type
2020-03-02 18:01:39 -08:00
Paulus Schoutsen
fcbea47c74 Coronavirus updates (#32417)
* Sort countries alphabetically

* Update sensor name

* Add migration to stable unique IDs

* Update sensor.py
2020-03-02 17:59:32 -08:00
Matt Snyder
ee7ce47860 Add QVR Pro integration (#31173)
* Initial working commit

* Create const file.  Load camera from component.

* Handle failed authentication.  Bump library version.

* Remove line break

* Camera attributes and recording services

* Add services, manifest, constant update, and exclude_channels.  Prefix channel name.  Update service argument.

* Update codeowners

* Update coveragerc

* Remove codeowners line

* Update codeowners again from python3 -m script.hassfest

* Update homeassistant/components/qvrpro/__init__.py

Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com>

* Requested changes

* Fix typo

* Update to use exception. Bump library version.

* Support stream component

* Update module header

* Missing property wrapper

* Partial requested changes

* Update coveragerc and codeowners

* Move constants to const file.  Add SHORT_NAME

* Add conf variable

* Use camera domain

* More requested changes

* Requested changes

* Requested changes

* Update prefix

* Handle error condition when camera is not configured to support live streaming

* Move method to camera setup.  Disable stream component support.

* Move auth string to library to prevent private member access

Co-authored-by: springstan <46536646+springstan@users.noreply.github.com>
2020-03-03 01:10:02 +01:00
Paulus Schoutsen
a25b94cd2d Update azure-pipelines-wheels.yml 2020-03-02 14:01:40 -08:00
Bram Kragten
21e0df42ac Update azure-pipelines-release.yml for Azure Pipelines 2020-03-02 13:59:21 -08:00
Bram Kragten
66d70195c9 Update azure-pipelines-release.yml for Azure Pipelines 2020-03-02 22:55:57 +01:00
Paulus Schoutsen
f7f9126610 Merge pull request #32414 from home-assistant/rc
0.106.3
2020-03-02 13:43:02 -08:00
Paulus Schoutsen
52809396d4 Bumped version to 0.106.3 2020-03-02 13:40:57 -08:00
Paulus Schoutsen
121d967732 Add coronavirus integration (#32413)
* Add coronavirus integration

* Update homeassistant/components/coronavirus/manifest.json

Co-Authored-By: Franck Nijhof <git@frenck.dev>

Co-authored-by: Franck Nijhof <frenck@frenck.nl>
2020-03-02 13:40:51 -08:00
Paulus Schoutsen
1603f7ac21 Add coronavirus integration (#32413)
* Add coronavirus integration

* Update homeassistant/components/coronavirus/manifest.json

Co-Authored-By: Franck Nijhof <git@frenck.dev>

Co-authored-by: Franck Nijhof <frenck@frenck.nl>
2020-03-02 13:40:11 -08:00
David F. Mulcahey
2ba514253c Bump ZHA Quirks to 0.0.34 (#32401)
* bump zha quirks version

* add required parts to support alt opple remote
2020-03-02 11:26:37 -05:00
Pascal Vizeli
87abd193ee Update azure-pipelines-ci.yml for Azure Pipelines 2020-03-02 16:33:39 +01:00
Pascal Vizeli
049897365c Update azure-pipelines-ci.yml for Azure Pipelines 2020-03-02 16:33:11 +01:00
jjlawren
df3f7687d4 Refactor Certificate Expiry Sensor (#32066)
* Cert Expiry refactor

* Unused parameter

* Reduce delay

* Deprecate 'name' config

* Use config entry unique_id

* Fix logic bugs found with tests

* Rewrite tests to use config flow core interfaces, validate created sensors

* Update strings

* Minor consistency fix

* Review fixes, complete test coverage

* Move error handling to helper

* Subclass exceptions

* Better tests

* Use first object reference

* Fix docstring
2020-03-02 07:44:24 -06:00
kuchel77
eb90cefd84 Keeping adding in Github repositories after error (#32393) 2020-03-02 13:59:11 +01:00
J. Nick Koston
7ca4665711 Move keypad battery implementation details into py-august (#32349)
* Move keypad battery implementation details into py-august

* Upgrade to py-august 0.22.0 which also adds gen2 doorbell battery data

* remove cruft from previous refactor
2020-03-01 23:22:28 -08:00
J. Nick Koston
924c313c8a Add application/xml as an XML to JSON auto converted mime type… (#32289)
* Resolves issue #32280
2020-03-01 23:22:01 -08:00
HomeAssistant Azure
da959c8f7b [ci skip] Translation update 2020-03-02 00:31:47 +00:00
Daniel Høyer Iversen
c361358c6d Upgrade Tibber library to 0.13.0 (#32369) 2020-03-01 22:56:31 +01:00
Ziv
e13d5bdc10 Refactor dynalite integration for multi-platform (#32335)
* refactoring for multi platform

* adopted test_bridge to refactoring

* refactoring tests for multi-platform
additional coverage in config and init

* comment for clarity

* more specific imports from lib

* library version bump

* removed async_update

* changed parameter order to start with hass

* removed pylint disable

* unsubscribe from signal dispatcher
inherit from Entity

* use device.unique_id

* changed hass_obj to hass

* added test for remove entity
bug fix from the test

* removed the polling try_connect. hate polling... it is now part of the async_setup()
significantly makes the code clearer and simplifies the tests

* removed leftover debug logs in the library

* changed tests to get the entry_id from hass

* changed place to assign hass.data only after success

* fixes for test_init

* removed assert

* removed device_info

* removed bridge internal from common

* modified test_bridge to work without the bridge directly

* removed bridge from test_existing_update

* changed update to not use bridge internals

* dyn_bridge fixture no longer used - removed
2020-03-01 22:44:24 +01:00
David Nielsen
fc98faa425 Add Media Stop Support to BraviaTV Mediaplayer (#32220)
* Add media_stop to braviatv mediaplayer

* Fix typo in media_stop()

Co-authored-by: springstan <46536646+springstan@users.noreply.github.com>
2020-03-01 22:07:44 +01:00
AJ Schmidt
9da5bc9dce Fix AlarmDecoder Integration to use Instant Mode for alarm_arm_night (#32292) 2020-03-01 20:25:16 +01:00
guillempages
f53c94ed2a Add Tankerkoenig integration (#28661)
* Initial version

Parse configuration, but return a fixed value

* Add basic functionality

Request real data from the server
Currently the prices are not getting updated, but the petrol station
data is real

* Update values regularly

The tankerkoenig values get updated regularly with real data.

* Move base functionality for the sensor to a base class

And move that to an own file, so that it can be inherited

* Reduce calls to tankerkoenig api

Use a master/slave concept for sensors; one master gets the data and
updates it into the slaves.

* Update requirements files

* Update all gas stations at once

* Remove tests directory

Currently there are no tests for the integration; will be added in
a future commit.

* Fix slaves not being updated

Let the base class regularly poll, so that slaves are also updated

* Refactor entity creation

Create an auxiliary method to add a station to the entity list,
in preparation to allowing extra stations.

* Add possibility to manually add stations

Add a new configuration option "stations" to manually add extra stations

* Fix style issues

Make the code more pythonic

* Remove redundant code

Implement suggestions from the code review

* Change to platform component

Remove the master/slave concept, in favor of a platform with dummy sensors.
The platform takes care of contacting the server and fetching updates
atomically, and updating the data on the sensors.

* Rename ATTR_STATE

Rename the attribute to "IS_OPEN", to avoid confusion with the sensor state.

* Minor updates

Combine two consecutive error logs into a single one.
Update the sensor's icon

* Separate address into different fields

* Style updates

Use "[]" syntax instead of ".get()" for required parameters
Use warning log level for not available fuel types

* Implement review comments

Fix style issues
Improve error messages
Remove redundant options

* Refactor using DataUpdateCoordinator

Use the new DataUpdateCoordinator to fetch the global data from
the API, instead of implementing an own method.
Also fix comments from the PR

* Implement PR comments

Implement suggestions to improve code readability and keep the Home Assistant style.
Also separate fetching data to an async thread
2020-03-01 16:49:07 +01:00
Colin Robbins
0431b983d2 Add optimistic mode for somfy covers that do not support position (#31407)
* Add a shadow for covers that do not support postion

* Rename shadow as optimistic

* Set optimisic default mode

* fix black error

* Remove redundant check

* optimisitc variable name consistency with config
2020-03-01 16:42:26 +01:00
Josef Schlehofer
a9a523b05c Upgrade youtube_dl to version 2020.03.01 (#32376) 2020-03-01 15:13:56 +01:00
Sébastien RAMAGE
7a7fdc5de6 Add sms support to pushbullet notification (#32347)
* add sms support

* fix formating

* fix formating

* fix whitespace

* fix format
2020-03-01 15:07:14 +01:00
mezz64
e9206b26ad Bump pyeight to 0.1.4 (#32363) 2020-03-01 15:05:37 +01:00
Tim van Cann
f0b5e132af Bump avri api version (#32373)
* Bump avri api version

* Trigger CI
2020-03-01 15:04:18 +01:00
Paulus Schoutsen
c6e85cac0b Require IFTTT to send data as dictionary (#32317)
* Require IFTTT to send data as dictionary

* Update logging
2020-02-29 20:37:06 -08:00
Robert Chmielowiec
8e3492d4f5 ZHA: Support light flashing (#32234) 2020-02-29 18:37:06 -05:00
Marius
3ab04118f6 Fix github sensor short SHA (#32316) 2020-02-29 14:35:28 +01:00
Erik Montnemery
c4ac3155e4 Add brightness to light device turn_on action (#32219)
* Add support for setting brightness

* Remove default brightness
2020-02-29 13:33:20 +01:00
J. Nick Koston
be14b94705 Restore august lock changed_by state on restart (#32340)
* Various code review items from previous PRs

* Add a test for fetching the doorbell camera image

* Switch to using UNIT_PERCENTAGE for battery charge unit

* Add tests for changed_by
2020-02-29 12:12:50 +01:00
Aaron Bach
e9a7b66df6 Add config entry for AirVisual (#32072)
* Add config entry for AirVisual

* Update coverage

* Catch invalid API key from config schema

* Rename geographies to stations

* Revert "Rename geographies to stations"

This reverts commit 5477f89c24cb3f58965351985b1021fc5fc794a5.

* Update strings

* Update CONNECTION_CLASS

* Remove options (subsequent PR)

* Handle import step separately

* Code review comments and simplification

* Move default geography logic to config flow

* Register domain in config flow init

* Add tests

* Update strings

* Bump requirements

* Update homeassistant/components/airvisual/config_flow.py

* Update homeassistant/components/airvisual/config_flow.py

* Make schemas stricter

* Linting

* Linting

* Code review comments

* Put config flow unique ID logic into a method

* Fix tests

* Streamline

* Linting

* show_on_map in options with default value

* Code review comments

* Default options

* Update tests

* Test update

* Move config entry into data object (in prep for options flow)

* Empty commit to re-trigger build
2020-02-28 20:14:17 -07:00
Diogo Gomes
bf33144c2b Bump pyipma to 2.0.5 (#32337)
* bump pyipma version to 2.0.5

* bump pyipma version to 2.0.5
2020-02-28 17:37:34 -08:00
Bram Kragten
3ea29635a0 Updated frontend to 20200228.0 (#32334) 2020-02-29 01:55:27 +01:00
HomeAssistant Azure
2d4ee01c1a [ci skip] Translation update 2020-02-29 00:31:43 +00:00
Alexei Chetroi
5fbaaf41dc Bump up ZHA depdendency (#32336) 2020-02-28 19:13:49 -05:00
Alexei Chetroi
0670b4f457 Use collection helpers for counter integration (#32295)
* Refactor counter to use config dict.

* Use collection helpers for counter integration.

* Update tests.

* Use callbacks were applicable.
2020-02-28 14:06:39 -08:00
elmurato
4a95eee40f Fixed TypeError with old server versions (#32329) 2020-02-28 13:39:46 -08:00
Paulus Schoutsen
deda2f86e7 Allow managing Lovelace storage dashboards (#32241)
* Allow managing Lovelace storage dashboards

* Make sure we do not allow duplicate url paths

* Allow setting sidebar to None

* Fix tests

* Delete storage file on delete

* List all dashboards
2020-02-28 12:43:17 -08:00
Paulus Schoutsen
ede39454a2 Merge remote-tracking branch 'origin/master' into dev 2020-02-28 12:42:02 -08:00
Paulus Schoutsen
3b147bcbf7 Merge pull request #32327 from home-assistant/rc
0.106.2
2020-02-28 12:40:20 -08:00
springstan
f1a0ca7cd3 Add and use percentage constant (#32094)
* Add and use percentage constant

* Fix pylint error and broken test
2020-02-28 11:46:48 -08:00
J. Nick Koston
ca81c6e684 Ensure rest sensors are marked unavailable when http requests… (#32309) 2020-02-28 11:43:00 -08:00
J. Nick Koston
c7f128f286 Ensure rest sensors are marked unavailable when http requests… (#32309) 2020-02-28 11:41:41 -08:00
Paulus Schoutsen
e62ba49979 Bumped version to 0.106.2 2020-02-28 11:38:53 -08:00
Robert Svensson
6ea20090a4 UniFi - Temporary workaround to get device tracker to mark cli… (#32321) 2020-02-28 11:38:37 -08:00
Paulus Schoutsen
c43b7d10d8 revent saving/deleting Lovelace config in safe mode (#32319) 2020-02-28 11:37:57 -08:00
Bram Kragten
430fa24acd Updated frontend to 20200220.5 (#32312) 2020-02-28 11:36:39 -08:00
Paulus Schoutsen
601f2c693d Prevent saving/deleting Lovelace config in safe mode (#32319) 2020-02-28 11:12:16 -08:00
Robert Svensson
f17462b159 UniFi - Temporary workaround to get device tracker to mark cli… (#32321) 2020-02-28 10:28:03 -08:00
Bram Kragten
3dc1ece33c Updated frontend to 20200220.5 (#32312) 2020-02-28 07:56:39 -08:00
Malte Franken
6852ccd8de change log level (#32244) 2020-02-28 12:41:21 +01:00
springstan
157f972d72 Use f-strings in integrations starting with "H" - "L" (#32265)
* Use f-strings in integrations starting with "H"

* Use f-strings in integrations starting with "I"

* Use f-strings in integrations starting with "J"

* Use f-strings in integrations starting with "K"

* Use f-strings in integrations starting with "L"

* Fix lint error

* Use join instead of f-string in homekit_controller

* Use local variables with f-strings

* Fix lint error

* Escape the characters in f-string

* Sort imports with isort in homeworks light

* Fix pylint error

* Fix broken tests

* Fix broken tests v2
2020-02-28 12:39:29 +01:00
Marius
7714160f4c Change github sensor state to short commit sha (#31581)
* change state to latest_release_url

to have a meaningful frontend representation.
self._github_data.latest_commit_sha is still available in the attributes, so no info is lost

* template state to show only the tag

and not the full url to the tag

* add guard to update(self) for state

* add empty line 150

black...

* Update sensor.py

* add SHA if no release url

* Correct sha to 7 digits

* take out fallback on state
2020-02-28 12:34:39 +01:00
Malte Franken
adb3bb3653 Explicitly set unique ids for GDACS integration (#32203)
* explicitly set unique ids

* use config flow's unique id

* use config's unique id
2020-02-28 11:47:49 +01:00
Franck Nijhof
2390a7f365 Pass in aiohttp session for onvif (#32045) 2020-02-28 11:46:06 +01:00
Petro31
2c1c395c28 Set min and max temp only if it is not None (#32262) 2020-02-28 09:49:47 +01:00
Tim van Cann
1d962aeb65 Add Avri waste collection sensor (#31134)
* Add Avri waste collection sensor

* Apply black formatting

* Update manifest

* Add requirements

* Add sensor to coverage

* Update import order

* Bump dependency to include todays pickup

* Bump avri version in requirements_all.txt

* Code review comments

* Reduce scan interval to 4 hours

This makes sure that no matter what happens, in
the morning the correct dates have been pulled
without the old ones lingering for too long.

* Better logging

* Made scan interval a timedelta

* Fix import order

* Update homeassistant/components/avri/sensor.py

Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com>

* Update homeassistant/components/avri/sensor.py

Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com>

* Use filter instead of break statement

* Use positive int for house number extension

* Switch voluptuous types for house number and house number extension

* Update homeassistant/components/avri/sensor.py

Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>

* Implement `available`

* Bump avri api

* Code review comments

* Replace `postcode` with `zip_code`

* Update logic for `available`

* Remove variable for delimiter

Co-authored-by: springstan <46536646+springstan@users.noreply.github.com>
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-02-27 22:12:01 -08:00
Ziv
02c170b961 Dynalite listener for config entry update (#32116)
* added entry listener that reloads the component

* fixed update with existing entry

* fixed import in test

* fixes

* library version

* removed unique_id

* fix

* fixed for no entries in hass.data

* fixed return value on abort

* moved to use async_entries

* removed unused import
2020-02-27 22:05:55 -08:00
Raman Gupta
b9fa32444a Support vizio pairing through config flow (#31520)
* support pairing through config flow

* simplify import failure log messages

* remove unnecessary list comprehension

* bump pyvizio to add passing ClientSession in where it was missed

* show different message if user completes pairing through import

* remove dupe failure message since reasons for failure are the same in both instances

* remove extra constant

* add host reachability check during pairing workflow

* revert redundant connection check since check is implicitly done during pairing process

* fix rebase errors

* fix string

* updates based on review

* update docstring

* missed commit

* update import confirmation message to be less wordy

* use ConfigFlow _abort_if_unique_id_configured

* fix test
2020-02-27 22:04:59 -08:00
Aaron Bach
03d8abe1ba Fix unhandled exception in Ambient PWS_URL (#32238)
* Fix unhandled exception in Ambient PWS_URL

* Comment update

* Be more explicit
2020-02-27 21:40:51 -08:00
J. Nick Koston
0364cd8db5 Add usage sensors for each device sense detects that show powe… (#32206)
* init

* const

* update docs string

* update docs string

* restore binary sensors

* Restore binary sensors

* match name

* pylint

* Fix bug in conf migration

* Fix refactoring error

* Address review items

Imporve performance

* Fix devices never turning back off
2020-02-27 21:23:47 -08:00
Erik Montnemery
3b17e570df Add device actions to cover (#28064)
* Add device actions to cover

* Remove toggle action, improve tests

* lint

* lint

* Simplify actions

* Update homeassistant/components/cover/device_action.py

Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>

* Improve tests

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-02-27 21:05:43 -08:00
J. Nick Koston
223c01d842 Coordinate all august detail and activity updates (#32249)
* Removing polling from august

* Now using subscribers to the detail and activity

* Fix hash to list keys

* continue to the next house if one fails

* Add async_signal_device_id_update

* Fix double initial update

* Handle self.hass not being available until after async_added_to_hass

* Remove not needed await

* Fix regression with device name
2020-02-27 19:44:22 -08:00
Paulus Schoutsen
d51b2ad675 Merge pull request #32282 from home-assistant/rc
0.106.1
2020-02-27 16:37:35 -08:00
HomeAssistant Azure
fefbe02d44 [ci skip] Translation update 2020-02-28 00:31:47 +00:00
Aaron Bach
9329bc4ca0 Remove ability to configure monitored conditions in IQVIA (#32223)
* Remove ability to configure monitored conditions in IQVIA

* Deprecate instead of removing (until 0.108.0)

* Simplify imports

* Update version
2020-02-27 17:24:14 -07:00
Diogo Gomes
b8fbe758d8 Bump pyipma dependency (fixes bug in 0.106) (#32286)
* Bump version

* Bump PyIPMA version
2020-02-27 14:44:22 -08:00
Diogo Gomes
5bdf450f78 Bump pyipma dependency (fixes bug in 0.106) (#32286)
* Bump version

* Bump PyIPMA version
2020-02-27 14:44:02 -08:00
Paulus Schoutsen
61476f4f2c Fix dsmr test 2020-02-27 14:41:35 -08:00
Paulus Schoutsen
cab60bcd0c Bumped version to 0.106.1 2020-02-27 14:03:07 -08:00
Paulus Schoutsen
c0394232f3 Catch more Hue errors (#32275) 2020-02-27 14:03:00 -08:00
Robert Svensson
a5d9e89d08 deCONZ - Race condition on slower systems (#32274)
When battery sensors gets created before other platforms loading deconz sensors gets created first the other platform would not create entities related to those battery sensors
2020-02-27 14:02:59 -08:00
Aaron Bach
f43b26f250 Bump simplisafe-python to 9.0.2 (#32273) 2020-02-27 14:02:59 -08:00
Aaron Bach
58b32bbeff Bump simplisafe-python to 9.0.0 (#32215) 2020-02-27 14:02:58 -08:00
dupondje
6d0a465390 Fix DSMR 5 (#32233)
DSMR 5 was broken because some wrong if.
if dsmr_version in ("5B"):
-> this checks dsmr_version against 5 and B. Not if its 5B.
2020-02-27 14:00:51 -08:00
Jens Nistler
a5d334bbf7 Mark clients away if they have never been seen. (#32222) 2020-02-27 14:00:51 -08:00
Erik Montnemery
a77fd4892e Add missing translations for light actions (#32216) 2020-02-27 14:00:50 -08:00
Balazs Sandor
75e8d49af1 Show kernel version on linux (#32276) 2020-02-27 13:59:30 -08:00
Paulus Schoutsen
5a56d0ec1d Catch more Hue errors (#32275) 2020-02-27 12:53:36 -08:00
Jens Nistler
ecd076c5e4 Mark clients away if they have never been seen. (#32222) 2020-02-27 11:50:34 -08:00
Robert Svensson
e695bb55c8 deCONZ - Race condition on slower systems (#32274)
When battery sensors gets created before other platforms loading deconz sensors gets created first the other platform would not create entities related to those battery sensors
2020-02-27 20:48:01 +01:00
Aaron Bach
aab2fd5ec3 Bump simplisafe-python to 9.0.2 (#32273) 2020-02-27 12:18:26 -07:00
Yuki Ueda
0eb5ca67cd Make heos and transmission config flow tests more robust (#31783)
* async_step_user to async_configure

* fix for lint

* fix for pylint

* fix isort and black

* fix miss-fixed black

* fixing for the python37 coverage

* fix transmission definition

* fix for Black formatting

* fix type to abort

* clean up

* clean up for the test

* fix for the test

* refactor

* split test_flow_works to three tests

* revert the assert

* remove whitespaces for flake8

* apply patch function

* fix for the patch

* fix for the black

* remove mock_coro

* fix for the black

* hue to heos

* try to fix import

* fix for the black

* revert try to fix import

* Add a pytest fixture

* fix for the black
2020-02-27 12:19:54 +01:00
Aaron Bach
df04fe3258 Bump simplisafe-python to 9.0.0 (#32215) 2020-02-26 18:52:07 -08:00
J. Nick Koston
4c5e364d90 Centralize august activity updates (#32197)
* Reduce August doorbell detail updates

* Doorbell images now get updates from the activity feed

* Tests for activity updates

* py-august now provides bridge_is_online for available state

* py-august now provides is_standby for available state

* py-august now provides get_doorbell_image (eliminate requests)

* remove debug

* black after merge conflict

* Centralize august activity updates

* Updates appear significantly more responsive

* Should address the community complaints about "lag"

* Reduce detail updates (device end points) to one hour interval

* Signal entities to update via dispatcher when new activity arrives

* Resolves out of sync state (skipped test is now unskipped)

* pylint

* fix merge conflict

* review comments

* Remove stray

* Address review items that can be done without refactor
2020-02-26 18:48:44 -08:00
Jc2k
d207c37c33 Address homekit_controller feedback on #32212 and #32213 (#32228) 2020-02-26 17:10:05 -08:00
dupondje
f26826d949 Fix DSMR 5 (#32233)
DSMR 5 was broken because some wrong if.
if dsmr_version in ("5B"):
-> this checks dsmr_version against 5 and B. Not if its 5B.
2020-02-26 17:02:42 -08:00
Paulus Schoutsen
483d822272 Lovelace resource mgmt (#32224)
* Add websockets commands for resource management

* Add LL resource management

Co-authored-by: Bram Kragten <mail@bramkragten.nl>
2020-02-26 16:43:34 -08:00
HomeAssistant Azure
92988d60a7 [ci skip] Translation update 2020-02-27 00:31:50 +00:00
Franck Nijhof
16dba3fa85 Merge branch 'master' into dev 2020-02-26 21:01:29 +01:00
Paulus Schoutsen
2a88ae559e Improve debounce cooldown (#32161) 2020-02-26 11:27:37 -08:00
Jc2k
853d6cda25 Make homekit_controller a local push integration (#32213) 2020-02-26 10:35:53 -08:00
Erik Montnemery
c92aa30663 Add missing translations for light actions (#32216) 2020-02-26 10:24:43 -08:00
Jc2k
92a47f14bb homekit_controller test cleanups (#32212) 2020-02-26 09:44:04 -08:00
Franck Nijhof
2d68b37dd5 Merge pull request #32211 from home-assistant/rc
0.106.0
2020-02-26 14:30:57 +01:00
Paulus Schoutsen
4de3871a78 Fix hue test 2020-02-26 12:54:19 +01:00
Franck Nijhof
9c755d8fd4 Remove deprecated Hue options (fixes CI) (#32027) 2020-02-26 12:53:44 +01:00
Franck Nijhof
1e5f0a5136 Bumped version to 0.106.0 2020-02-26 12:34:38 +01:00
Bram Kragten
897433ecba Updated frontend to 20200220.4 (#32205) 2020-02-26 12:31:50 +01:00
Aaron Bach
89625010e5 Fix error where SimpliSafe websocket would disconnect and not reconnect (#32199)
* Fix error where SimpliSafe websocket would disconnect and not reconnect

* Await
2020-02-26 12:31:44 +01:00
Aaron Bach
e435f6eb67 Fix error where SimpliSafe websocket would disconnect and not reconnect (#32199)
* Fix error where SimpliSafe websocket would disconnect and not reconnect

* Await
2020-02-26 12:19:14 +01:00
Bram Kragten
5a67d73a37 Updated frontend to 20200220.4 (#32205) 2020-02-26 11:32:15 +01:00
J. Nick Koston
638a3025df Reduce August doorbell detail updates (#32193)
* Reduce August doorbell detail updates

* Doorbell images now get updates from the activity feed

* Tests for activity updates

* py-august now provides bridge_is_online for available state

* py-august now provides is_standby for available state

* py-august now provides get_doorbell_image (eliminate requests)

* remove debug

* black after merge conflict
2020-02-26 08:43:41 +01:00
Aaron Bach
b5c1afcb84 Make SimpliSafe entities unavailable when wifi is lost (#32154)
* Make SimpliSafe entities unavailable when wifi is lost

* Remove online status from REST API

* Comments

* Mispelling
2020-02-25 20:03:41 -07:00
J. Nick Koston
4c33a9d732 Add model to august device_info (#32187)
* Add model to august device_info

* Address review comments from PR#32125

* Fix test name
2020-02-25 18:34:31 -08:00
springstan
58de7fe9a3 Fix name of emby media player (#32183)
* Fix name of emby media player

* Remove client name from entity_id
2020-02-25 17:30:03 -08:00
HomeAssistant Azure
ed461a0ad8 [ci skip] Translation update 2020-02-26 00:31:47 +00:00
J. Nick Koston
3e702c8ca4 Add Config Flow for sense (#32160)
* Config Flow for sense

* Fix unique ids so they are actually unique (and migrate the old ones)

* Fix missing solar production

* Do not mark sensors available until they have data

* Address review items

* Address review round #2
2020-02-25 16:37:41 -07:00
Paulus Schoutsen
7391aa2d7e Bumped version to 0.106.0b5 2020-02-25 14:17:32 -08:00
Paulus Schoutsen
0e7e0086cd Update translations 2020-02-25 14:17:28 -08:00
Jenny
6f8380b442 Bump socialbladeclient to 0.5 (#32191) 2020-02-25 14:16:52 -08:00
Paulus Schoutsen
e60a6cfa19 Fix Arlo doing I/O in event loop (#32190) 2020-02-25 14:16:52 -08:00
Bram Kragten
ff6d415c67 Updated frontend to 20200220.3 (#32189) 2020-02-25 14:16:51 -08:00
Michaël Arnauts
d3629d9f32 Bump python-tado to 0.3.0 (#32186) 2020-02-25 14:16:50 -08:00
Kit Klein
61e2ce5faf Dedup and clarify imported konnected config flows (#32138)
* dedup config flows

* use default (imported) options until user goes thru options flow

* address pr feedback

* correct key used to distinguish pro model
2020-02-25 14:16:49 -08:00
Bram Kragten
b0fdbebd56 Updated frontend to 20200220.3 (#32189) 2020-02-25 23:15:25 +01:00
Paulus Schoutsen
fc0278c91f Fix Arlo doing I/O in event loop (#32190) 2020-02-25 23:10:43 +01:00
Jenny
1f23361a5d Bump socialbladeclient to 0.5 (#32191) 2020-02-25 23:01:18 +01:00
Jc2k
4a89fba6f9 Add homekit_controller occupancy sensor (#32188) 2020-02-25 22:01:03 +00:00
Jc2k
dd13e99967 Add missing device class attributes to homekit_controller sensors (#32175)
* Add some missing device class attributes to homekit_controller sensors

* Add classes for binary sensors
2020-02-25 21:43:14 +01:00
Michaël Arnauts
24652d82ab Bump python-tado to 0.3.0 (#32186) 2020-02-25 21:29:45 +01:00
Jc2k
1ddc1ebc6b Refactor away deprecated homekit_controller test helpers (#32177) 2020-02-25 21:19:04 +01:00
Paulus Schoutsen
7d8da47309 Revert "Use orjson to parse json faster (#32153)" (#32185)
This reverts commit 2365e2e8cf.
2020-02-25 21:07:16 +01:00
Franck Nijhof
ceb3985a99 Remove hide_entity property from automation integration (#32038)
* Remove hidden property from automation integration

* Allow configuration options untils 0.110
2020-02-25 11:21:05 -08:00
Paulus Schoutsen
536b31305a Support multiple Lovelace dashboards (#32134)
* Support multiple Lovelace dashboards

* Mark collection maintenance as unfinished

* Fix import

* Add websockets commands for resource management

* Revert "Add websockets commands for resource management"

This reverts commit 7d140b2bcc.

Co-authored-by: Bram Kragten <mail@bramkragten.nl>
2020-02-25 11:18:21 -08:00
Erik Montnemery
2d6b80470f Improve error handling (#32182) 2020-02-25 10:44:24 -08:00
Ruslan Sayfutdinov
2365e2e8cf Use orjson to parse json faster (#32153)
* [recorder] Use orjson to parse json faster

* Remove from http manifest

* Bump to orjson 2.5.1

* Empty commit to trigger CI

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-02-25 10:20:51 -08:00
springstan
5c12fa0daa Fix description of fan service set_direction (#32181) 2020-02-25 19:18:44 +01:00
J. Nick Koston
2925e0617c Add Config flow to august (#32133)
* Add battery sensors for August devices

* Additional tests and cleanup in prep for config flow
  and device registry

* pylint

* update name for new style guidelines - https://developers.home-assistant.io/docs/development_guidelines/#use-new-style-string-formatting

* Config Flow for august push

* Update homeassistant/components/august/__init__.py

Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>

* Address review items

* Update tests

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-02-25 10:18:15 -08:00
Paulus Schoutsen
900714a3ee Do not report state when closing down (#32168) 2020-02-25 09:05:36 -08:00
Kit Klein
5488389244 Dedup and clarify imported konnected config flows (#32138)
* dedup config flows

* use default (imported) options until user goes thru options flow

* address pr feedback

* correct key used to distinguish pro model
2020-02-25 13:55:06 +01:00
Jc2k
438c4acf07 Deprecate homekit_controller .homekit folder (#32158)
* homekit_controller: Deprecate .homekit folder

* Tweaks from review

* Delay it a release
2020-02-25 12:09:04 +01:00
Jc2k
c9d78aa78c Refactor homekit_controller config flow tests (#32141)
* Config flow test refactor

* Add a service and characteristic to the accessory so its more realistic

* Feedback from review

* Missing apostrophe
2020-02-25 12:06:35 +01:00
Aaron Bach
ba4cc373c8 Modernize Ambient PWS config flow (#32164)
* Modernize Ambient PWS config flow

* Linting
2020-02-24 21:37:38 -08:00
Aaron Bach
c97b1c60b0 Modernize Notion config flow (#32167)
* Modernize Notion config flow

* Linting
2020-02-24 21:36:58 -08:00
paolog89
0e6a48c688 Add observed entities to bayesian sensor (#27721)
* Add observed entities to bayesian sensor

* Update binary_sensor.py to comply with style guidelines and test_binary_sensor.py to verify the entity_id

* Update binary_sensor.py and test_binary_sensor.py to include an additional attribute for observed entities

* Use of ATTR_ENTITY_ID and numeric key of observed entity

* Update binary_sensor.py

* Update test_binary_sensor.py to verify behavior

* Update to return a list without duplicates in the state attribute

* Update binary_sensor.py: rename of ATTR_ENTITY_ID into ATTR_OBSERVED_ENTITIES

* Rename new attribute into ATTR_OCCURRED_OBSERVATION_ENTITIES and fix test
2020-02-24 21:27:59 -08:00
Paulus Schoutsen
5776b9f17d Fix flaky coverage in UK transport test (#32053) 2020-02-24 21:27:07 -08:00
Paulus Schoutsen
9007d37de1 Bumped version to 0.106.0b4 2020-02-24 21:05:10 -08:00
Aaron Bach
7c2765fbff Remove unused SimpliSafe config flow function (#32166)
* Remove unused SimpliSafe config flow function

* Code review comments from other PR

* Linting
2020-02-24 22:02:20 -07:00
Aaron Bach
75f465bf7e Remove unused RainMachine config flow function (#32165)
* Remove unused RainMachine config flow function

* Remove test we don't need

* Code review comments

* Linting
2020-02-24 22:01:55 -07:00
Erik Montnemery
7e387f93d6 Add MQTT WS command to remove device (#31989)
* Add MQTT WS command to remove device

* Review comments, fix test

* Fix tests
2020-02-24 20:46:02 -08:00
Paulus Schoutsen
9e832aaaa6 Bumped version to 0.106.0b3 2020-02-24 19:36:26 -08:00
Raman Gupta
5dc93aeeb1 Improve Vizio fix to avoid KeyError (#32163)
* dont set default volume_step on import check

* ensure config entry data['volume_step'] is set

* consolidate entry update during entry setup
2020-02-24 19:36:15 -08:00
Raman Gupta
45d63e22d5 Fix vizio bug to use 'get' to get volume_step since it is optional (#32151)
* use get to get volume_step since it is optional

* always set volume_step to default in options and data if its not included
2020-02-24 19:36:14 -08:00
Paulus Schoutsen
6edef444a7 Properly define depenency for Scrape integration on Rest integ… (#32136) 2020-02-24 19:36:14 -08:00
Kit Klein
6f1f9bdd45 0.106 Beta - provide correctly formatted placeholders (#32119) 2020-02-24 19:36:13 -08:00
Tom
1d075a7dd0 Fix Plugwise climate issues for new firmware #32080 (#32109)
* Fix Plugwise climate issue firmare 3.1.11 (#32080)

* Submit checklist actions
2020-02-24 19:36:12 -08:00
Raman Gupta
4236d62b44 Improve Vizio fix to avoid KeyError (#32163)
* dont set default volume_step on import check

* ensure config entry data['volume_step'] is set

* consolidate entry update during entry setup
2020-02-24 19:35:28 -08:00
Mike
71a6ea1c10 Add shopping_list_item_added event_type (#28334)
* Update __init__.py

Added event_type "shopping_list_item_added" with an item tied to it.

* Update __init__.py

* Update __init__.py

Black formatting style

* Modified global event variables

* Typo fix

* Update __init__.py

* Formatting changes

* More formatting changes

* Update __init__.py

* Black formatting

* Update __init__.py

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-02-24 18:43:27 -08:00
SukramJ
e0586df602 Migrate HomematicIP Cloud services to admin services (#32107)
* Migrate HomematicIP Cloud services to admin services

* remove unused dict

* vacation and eco mode are usable by users

* add verify_domain_control, make service user accessible
2020-02-24 18:16:57 -08:00
springstan
88df9c8ab4 Remove friendly_name attribute from twitch sensor (#32067)
* Remove friendly_name attribute twitch sensor

* Use deepcopy to only copy the content

* Update homeassistant/components/twitch/sensor.py

Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>

* Update homeassistant/components/twitch/sensor.py

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-02-25 02:55:31 +01:00
springstan
ad102b3840 Use f-strings in integrations starting with "F"and"G" (#32150)
* Use f-strings in integrations starting with F

* Use f-strings in tests for integrations starting with F

* Use f-strings in integrations starting with G

* Use f-strings in tests for integrations starting with G

* Fix pylint error

* Fix broken test
2020-02-24 17:54:20 -08:00
Ville Skyttä
496bd3dddf Add and use more unit constants (#32122)
* Add and use speed constants

* Add and use meter based volume and area constants

* Add and use more mass unit constants

* Add and use concentration unit constants

* Add and use watts per square meter constant

* Use more time constants

* Use more data constants
2020-02-24 17:52:14 -08:00
Franck Nijhof
c98f50115d Upgrade pre-commit to 2.1.1 (#32159) 2020-02-25 02:16:23 +01:00
Ville Skyttä
9b2544c923 Remove some unneeded pylint suppressions (#32152) 2020-02-24 16:47:15 -08:00
HomeAssistant Azure
a9e061270b [ci skip] Translation update 2020-02-25 00:32:13 +00:00
Chris Talkington
3f49f6c047 Add constants file for directv (#32157) 2020-02-25 01:30:00 +01:00
Phil Bruckner
b2d7bc40dc Add support for simultaneous runs of Script helper (#31937)
* Add tests for legacy Script helper behavior

* Add Script helper if_running and run_mode options

- if_running controls what happens if Script run while previous run
  has not completed. Can be:
  - error: Raise an exception
  - ignore: Return without doing anything (previous run continues as-is)
  - parallel: Start run in new task
  - restart: Stop previous run before starting new run
- run_mode controls when call to async_run will return. Can be:
  - background: Returns immediately
  - legacy: Implements previous behavior, which is to return when done,
            or when suspended by delay or wait_template
  - blocking: Returns when run has completed
- If neither is specified, default is run_mode=legacy (and if_running
  is not used.) Otherwise, defaults are if_running=parallel and
  run_mode=background. If run_mode is set to legacy then if_running must
  be None.
- Caller may supply a logger which will be used throughout instead of
  default module logger.
- Move Script running state into new helper classes, comprised of an
  abstract base class and two concrete clases, one for legacy behavior
  and one for new behavior.
- Remove some non-async methods, as well as call_from_config which has
  only been used in tests.
- Adjust tests accordingly.

* Change per review

- Change run_mode default from background to blocking.
- Make sure change listener is called, even when there's an unexpected
  exception.
- Make _ScriptRun.async_stop more graceful by using an asyncio.Event for
  signaling instead of simply cancelling Task.
- Subclass _ScriptRun for background & blocking behavior.

Also:

- Fix timeouts in _ScriptRun by converting timedeltas to float seconds.
- General cleanup.

* Change per review 2

- Don't propagate exceptions if call from user has already returned
  (i.e., for background runs or legacy runs that have suspended.)
- Allow user to specify if exceptions should be logged. They will still
  be logged regardless if exception is not propagated.
- Rename _start_script_delay and _start_wait_template_delay for
  clarity.
- Remove return value from Script.async_run.
- Fix missing await.
- Change call to self.is_running in Script.async_run to direct test of
  self._runs.

* Change per review 3 and add tests

- Remove Script.set_logger().
- Enhance existing tests to check all run modes.
- Add tests for new features.
- Fix a few minor bugs found by tests.
2020-02-24 14:56:00 -08:00
Raman Gupta
309989be89 Fix vizio bug to use 'get' to get volume_step since it is optional (#32151)
* use get to get volume_step since it is optional

* always set volume_step to default in options and data if its not included
2020-02-24 23:37:54 +01:00
Colin O'Dell
90859b82e2 Upgrade qnapstats to 0.3.0 (#32148) 2020-02-24 22:46:07 +01:00
Aaron Bach
6b0d7c77f0 Clean up RainMachine config entry data (#32132) 2020-02-24 13:07:18 -07:00
Aaron Bach
edf44f4158 Modernize RainMachine config flow (#32131)
* Modernize RainMachine config flow

* Update strings
2020-02-24 13:05:54 -07:00
Aaron Bach
f7e336eaa6 Modernize SimpliSafe config flow (#32130)
* Modernize SimpliSafe config flow

* Fix tests
2020-02-24 13:03:08 -07:00
Aaron Bach
db40b2fc32 Handle unhandled IQVIA data update exception (#32144)
* Handle unhandled IQVIA data update exception

* Cleanup

* Ask for forgiveness, not permission

* Use warning-level logs

* Fix log messages
2020-02-24 13:02:33 -07:00
springstan
9801810552 Use f-strings in integrations starting with "B"-"E" (#32121)
* Use f-strings in integrations starting with B

* Use f-strings in integrations starting with C

* Use f-strings in integrations starting with D

* Use f-strings in integrations starting with E

* Fix pylint errors

* Fix pylint errors v2

* Fix tests

* Fix tests v2
2020-02-24 08:47:52 -08:00
Paulus Schoutsen
07fa844c43 Speed up validate_entity_id (#32137)
* Speed up validate_entity_id

* Add some more invalid entity IDs

* Adjust regular expression

* Extend and sort test cases

* Update regular expression, more cases, faster

* Adjust tests, allow start with number, disallow double underscore

Co-authored-by: Franck Nijhof <frenck@frenck.nl>
2020-02-24 08:35:02 -08:00
Ruslan Sayfutdinov
15b4975681 Use ciso8601 library to parse datetime faster (#32128) 2020-02-24 08:33:10 -08:00
Rocik
d996a4a9a9 Add Supla gate (#31643)
* Add support for Supla gate with sensor

* Fix Supla switch module description and state access

* Add docs to methods of Supla gate

* Add missing comma

* Remove unused import

* Sort imports of Supla cover

* Add returning availability for every Supla device

* Use direct access to dict

* Remove deprecated property "hidden"

* Remove unused constant

* Revert using get function on dict
2020-02-24 15:34:53 +01:00
Jc2k
df9363610c Refactor homekit_controller to be fully asynchronous (#32111)
* Port homekit_controller to aiohomekit

* Remove succeed() test helper

* Remove fail() test helper
2020-02-24 10:55:33 +01:00
Pierre
a1a835cf54 Add platform Ezviz (#30378)
* hookid : isort fix

* New platform: Ezviz

* updated CODEOWNERS for ezviz

* proper test requirements

* resolved conflict

* regenerated requirements

* removed stale comments, only one call to add_entities, removed unnecessary attributes

* setup is sync, not async. Removed stale comments

* Compatible with pyezviz 0.1.4

* pyezviz 0.1.4 is now requiredf

* Added PTZ + switch management

* added services.yaml

* proper requirement

* PTZ working in async mode

* Now updates the entity

* Compatible with pyezviz 0.1.5.1

* Fixed switch ir service registering

* now requires pyezviz 0.1.5.2

* now requires pyezviz 0.1.5.2

* Revert "regenerated requirements"

This reverts commit 848b317cf9.

* Rollbacked to a simpler version

* snake_case names everywhere, logging sanatizing, voluptuous proper check

* pyezviz 0.1.5, reworked the PR so that it's intelligible

* no need for services.yaml for now

* proper voluptuous validation

* Removed stale code, use proper conf variable, describe attributes

* regenerated requirements

* stale

* removed status from attributes, since we use it for available we don't need it here then.

* Fixed log message
2020-02-24 10:39:55 +01:00
Paulus Schoutsen
ca01e9a537 Improve condition validation error msg (#32135) 2020-02-24 09:59:34 +01:00
Paulus Schoutsen
270758417b Properly define depenency for Scrape integration on Rest integ… (#32136) 2020-02-24 00:03:33 -08:00
Aaron Bach
6e6625e1ab Remove no-longer-needed SimpliSafe websocket watchdog (#32129)
* Fix SimpliSafe reconnection issue upon websocket error

* Rename listener cancelation properties

* Remove watchdog
2020-02-23 20:47:19 -07:00
HomeAssistant Azure
5ec7d07283 [ci skip] Translation update 2020-02-24 00:31:49 +00:00
J. Nick Koston
693441e56f Deduplicate code in the august integration (#32101)
* Deduplicate code in the august integration

* Add additional tests for august (more coming)

* Door state is now updated when a lock or unlock call returns
  as the state is contained in the response which avoids
  the confusing out of sync state

* revert

* document known issue with doorsense and lock getting out of sync (pre-existing)

* Address review comments

* Additional review comments
2020-02-23 13:54:34 -08:00
Kit Klein
d2d788631e 0.106 Beta - provide correctly formatted placeholders (#32119) 2020-02-23 13:54:18 -08:00
springstan
524a1a7587 Use f-strings in integrations starting with "A" (#32110)
* Use f-strings in integrations starting with A

* Use f-strings in tests for integrations starting with A

* Fix pylint by renaming variable

* Fix nested for loop in f-string for aprs device_tracker

* Break long lines into multiple short lines

* Break long lines into multiple short lines v2
2020-02-23 13:38:05 -08:00
springstan
a85808e325 Add and use time related constants (#32065)
* Add and use time related constants

* Sort time constants and reuse them in data rate constants

* Fix greeneyemonitor import

* Fix greeneyemonitor import V2

* Fix failing here_travel_time test

* Add TIME_MONTHS and TIME_YEARS

* Use TIME_MINUTES in opentherm_gw and isy994

* Add and use TIME_MILLISECONDS

* Change inconsistent ones

* Add TIME_MICROSECONDS and TIME_WEEKS

* Use constants in apcupsd and travisci

* Fix import error in upnp sensor.py

* Fix isy994 sensor.py using TIME_YEARS

* Fix dyson tests

* Use TIME_SECONDS in more places

* Use TIME_DAYS in google wifi
2020-02-23 22:09:24 +02:00
Chris Talkington
8dd80e0e3c Add unique_id to directv entities (#31838)
* add unique_id to directv entities.

* add addiitional debug and fix tests.

* fix lint error.

* rework unique_id and flow a bit.

* review adjustments.

* review adjustments

* review adjustments

* review adjustments.

* review adjustments

* review adjustments

* review adjustments

* review adjustments

* lint

* use serial number for host unit and mac address for client units

* fix elsif

* update test with realistic client id

* lint
2020-02-23 19:26:34 +01:00
Robert Svensson
1007283da5 UniFi - Add unit of measurement to bandwidth sensors (#32114) 2020-02-23 19:17:26 +01:00
Robin
4cc4f070f5 Add sighthound save image (#32103)
* Adds save_image

* Update test_image_processing.py

* Update test

* Tidy test

* update image_processing with reviewer comments

* Update test_image_processing.py

* Ammend tests

not passing

* Patch convert

* remove join

* Use valid_config_save_file
2020-02-23 19:11:05 +01:00
Martin Long
f6fbecf963 Add boost support for Hive TRVs (#31261)
* Add boost support for TRVs

* Updated pyhiveapi dependency to 0.2.20.1
2020-02-23 17:40:50 +01:00
jezcooke
a533b7a746 Fix volume control for Frontier Silicon media players (#32040)
* Fixed volume control for Frontier Silicon media players.

* Removed unnecessary else which caused pylint test to fail.

* Removed whitespace on empty line.

* Tweaks from on springstan's suggestions and other fixes

* Apply suggestions from code review

Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com>

* Comment to explain why 1 is subtracted from volume_Steps

Also reformatted using black after code review changes.

* Split up the set volume functions into steps rather than all in-line as suggested.

* Renamed _volume_steps to _max_volume.

* Prevent asnyc_update from failing if we can't get the volume steps

Co-authored-by: springstan <46536646+springstan@users.noreply.github.com>
2020-02-23 17:37:31 +01:00
jezcooke
458e47f981 Add name option for Frontier Silicon devices (#32085)
* Added the option to specify the name of the device in confirguration.yaml

* Adding missing default name parameter in auto-discovery FSAPIDevice constructor.

* Fixed Black formatting.

* Removed DEFAULT_NAME constant.

* Apply suggestions from code review

Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com>

Co-authored-by: springstan <46536646+springstan@users.noreply.github.com>
2020-02-23 17:05:24 +01:00
Tom
d22ee7179d Fix Plugwise climate issues for new firmware #32080 (#32109)
* Fix Plugwise climate issue firmare 3.1.11 (#32080)

* Submit checklist actions
2020-02-23 17:02:42 +01:00
Paulus Schoutsen
f975654ae7 Mock setup_entry in oauth2 tests (#32102)
* Mock setup_entry in oauth2 tests

* Fix scaffold constant
2020-02-23 12:23:21 +01:00
jezcooke
a678c6fd0b Fix Frontier Silicon player state (#32082)
The player would report itself as ‘off’ when in certain modes (e.g ‘Music player’ or ‘Spotify’) which meant HA would lose all control (it can’t change input or set volume etc. as it thinks it’s off). Now reports STATE_IDLE in these cases and only STATE_OFF if it is actually off.

This fixes issue #20728.
2020-02-22 20:33:42 -08:00
michaeldavie
bd00453cef Bump env_canada to 0.0.35 to address issue 31924 (#32077)
* Bump env_canada to 0.0.35, remove details from alerts

* Black
2020-02-22 20:32:19 -08:00
HomeAssistant Azure
8257165562 [ci skip] Translation update 2020-02-23 00:31:50 +00:00
Bram Kragten
fcaabb3d33 Change get_entity to return a extended entry, add inputs to de… (#32083)
* Change get_entity to return a extended entry + add inputs to default config

For https://github.com/home-assistant/home-assistant-polymer/pull/4940

* Fix tests, simplify code, update to return extended

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-02-22 15:18:10 -08:00
Franck Nijhof
edfb967b10 Add unique ID to ONVIF camera entities (#32093) 2020-02-22 22:29:49 +01:00
Paulus Schoutsen
ced870c588 Remove YAML config from Ring integration (#32039) 2020-02-21 17:36:19 -08:00
HomeAssistant Azure
dc15b9c28e [ci skip] Translation update 2020-02-22 00:31:49 +00:00
springstan
b41cbe9885 Add www. to all documentation links (#32063)
* Add www. to all documentation links

* Fix broken redirect uri test
2020-02-21 16:10:02 -08:00
Alexei Chetroi
3385893b77 ZHA device channel refactoring (#31971)
* Add ZHA core typing helper.
* Add aux_channels to ZHA rule matching.
* Add match rule claim_channels() method.
* Expose underlying zigpy device.
* Not sure we need this one.
* Move "base" channels.
* Framework for channel discovery.
* Make DEVICE_CLASS and REMOTE_DEVICE_TYPE default dicts.
* Remove attribute reporting configuration registry.
* Refactor channels.
- Refactor zha events
- Use compound IDs and unique_ids
- Refactor signal dispatching on attribute updates

* Use unique id compatible with entities unique ids.
* Refactor ZHA Entity registry.
Let match rule to check for the match.

* Refactor discovery to use new channels.
* Cleanup ZDO channel.
Remove unused zha store call.

* Handle channel configuration and initialization.
* Refactor ZHA Device to use new channels.
* Refactor ZHA Gateway to use new discovery framework.
Use hass.data for entity info intermediate store.

* Don't keep entities in hass.data.
* ZHA gateway new discovery framework.
* Refactor ZHA platform loading.
* Don't update ZHA entities, when restoring from zigpy.
* ZHA entity discover tests.
* Add AnalogInput sensor.
* Remove 0xFC02 based entity from Keen smart vents.
* Clean up IAS channels.
* Refactor entity restoration.
* Fix lumi.router entities name.
* Rename EndpointsChannel to ChannelPool.
* Make Channels.pools a list.
* Fix cover test.
* Fix FakeDevice class.
* Fix device actions.
* Fix channels typing.
* Revert update_before_add=False
* Refactor channel class matching.
* Use a helper function for adding entities.
* Make Pylint happy.
* Rebase cleanup.
* Update coverage for ZHA device type overrides.
* Use cluster_id for single output cluster registry.
* Remove ZHA typing from coverage.
* Fix tests.
* Address comments.
* Address comments.
2020-02-21 18:06:57 -05:00
Ziv
36db302cc8 Enhance Dynalite Integration after review (#31760)
* fixes per Martin Hjelmare

* pylint fix

* final fixes per request

* fixed unit tests for new config flow

* Added unit-tests to increase coverage. at 97% now

* Added unit tests for 100% coverage of component

* removed configured_host function and updated config_flow unit tests

* added a pylint directive since it tells me by mistake DOMAIN is not used

* fixed path (removed __init__)

* Update homeassistant/components/dynalite/light.py

Co-Authored-By: Martin Hjelmare <marhje52@gmail.com>

* Update homeassistant/components/dynalite/light.py

Co-Authored-By: Martin Hjelmare <marhje52@gmail.com>

* fixed the test as we moved from schedule_update_... to async_schedule

* Update homeassistant/components/dynalite/bridge.py

Co-Authored-By: Martin Hjelmare <marhje52@gmail.com>

* removed context from config_flow
changed test_init to use the core methods

* moved test_light to also use the core interfaces

* moved to config_entries.async_unload

* additional fixes for the tests

* pylint fix and removed unnecessary code

* Update tests/components/dynalite/test_light.py

Co-Authored-By: Martin Hjelmare <marhje52@gmail.com>

* Update tests/components/dynalite/test_light.py

Co-Authored-By: Martin Hjelmare <marhje52@gmail.com>

* Update tests/components/dynalite/test_light.py

Co-Authored-By: Martin Hjelmare <marhje52@gmail.com>

* Update tests/components/dynalite/test_light.py

Co-Authored-By: Martin Hjelmare <marhje52@gmail.com>

* Update tests/components/dynalite/test_light.py

Co-Authored-By: Martin Hjelmare <marhje52@gmail.com>

* Update tests/components/dynalite/test_light.py

Co-Authored-By: Martin Hjelmare <marhje52@gmail.com>

* Update tests/components/dynalite/test_light.py

Co-Authored-By: Martin Hjelmare <marhje52@gmail.com>

* Update tests/components/dynalite/test_light.py

Co-Authored-By: Martin Hjelmare <marhje52@gmail.com>

* Update tests/components/dynalite/test_light.py

Co-Authored-By: Martin Hjelmare <marhje52@gmail.com>

* added break in loop

* removed last mock_coro reference
pylint fix

* added coverage for try_connect

* added check for a successful connection before bridge.async_setup succeeds
also added a "nowait" config option (default False) that avoids this check

* changed log level

* fixed accidental chmod I did

* fixed accidental change

* not storing config in bridge

* not patching asyncio

* moved CONFIG_SCHEMA into component

* moved all logs to start capitalized (and revised some of them)

* moved test_config_flow to not patch the DynaliteBridge

* also took DynaliteBridge patching out of test_init

* removed NO_WAIT

* fixes to SCHEMA

* changed _ in multi-word CONF
moved imports to component const.py

* removed tries

* removed redundant tests

* fixed some small change i broke in the library. only version update

* fixed rewuirements

* Update tests/components/dynalite/test_config_flow.py

Co-Authored-By: Martin Hjelmare <marhje52@gmail.com>

* Update tests/components/dynalite/test_light.py

Co-Authored-By: Martin Hjelmare <marhje52@gmail.com>

* Update tests/components/dynalite/test_config_flow.py

Co-Authored-By: Martin Hjelmare <marhje52@gmail.com>

* removed HIDDEN_ENTITY
removed hass in test fixture

* black fixes

* removed final piece of hidden_entity from light
fix in the library
updated config flow so if the entry is already set but with a different config, calls async_update_entry

* removed DATA_CONFIGS - no longer necessary

* pylint fixes

* added coverage

* use abort in config_flow

* test update

* removed logs

* test that update actually updates the entry

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2020-02-21 23:29:59 +01:00
jjlawren
9cc47ca737 Add ConfigEntryNotReady exception to Plex (#32071) 2020-02-21 22:07:26 +01:00
Alok Saboo
2fb66fd866 Add additional logging to rest sensor (#32068) 2020-02-21 21:11:25 +01:00
Patrick Kishino
f32411e394 Add asuswrt interface and dnsmasq location configuration (#29834)
* Added interface and dnsmasq location configuration

* Updated aioasuswrt requirement to latest 1.2.1 release

* Updated to working aioasus library and fixed correct conf formatting
2020-02-21 17:01:57 +01:00
Maciej Bieniek
dd8597cb46 Bump brother to 0.1.6 (#32054) 2020-02-21 10:32:48 +01:00
J. Nick Koston
6e74ee7b64 Fix i/o in august camera async image update (#32044)
* Fix i/o in august camera image update

* Address review comments
2020-02-21 07:39:07 +01:00
J. Nick Koston
d4075fb262 Significantly reduce code in august integration (#32030)
* Significantly reduce code in august integration

* Activity updates can now be processed by py-august
  this allows us to eliminate the activity sync
  code for the door sensors and locks

* Lock and door state can now be consumed from
  the lock detail api which allows us to
  remove the status call apis and reduce
  the number of API calls to august

* Refactor the testing method for locks (part #1)

* Update homeassistant/components/august/binary_sensor.py

Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>

* Switch to asynctest instead of unittest for mock.patch

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-02-20 21:06:24 -08:00
HomeAssistant Azure
a12c4da0ca [ci skip] Translation update 2020-02-21 00:33:51 +00:00
springstan
1ee7c483a7 Update file headers and outdated documentation links (#32022)
* Update documentation links

* Update file headers v2
2020-02-20 15:29:46 -08:00
Paulus Schoutsen
51b5796916 Updated frontend to 20200220.1 (#32046) 2020-02-20 14:51:27 -08:00
Robbie Trencheny
f0d58ab7a7 Change TTS codeowner to @pvizeli (#32041) 2020-02-20 13:36:36 -08:00
Paulus Schoutsen
ce710f1e0b Template platform tweaks (#32037)
* Remove unnecessary boolean return from platform setup

* Fix template cover validation
2020-02-20 12:14:31 -08:00
Franck Nijhof
2e35190aff Fix extra arguments of group integration (#32032) 2020-02-20 20:15:45 +01:00
Paulus Schoutsen
20e3c91ebd Updated frontend to 20200220.0 (#32033) 2020-02-20 11:01:20 -08:00
Franck Nijhof
bf1092ec80 Add minimal version contrain to urllib3 (#32031) 2020-02-20 19:19:09 +01:00
Franck Nijhof
b2f2afaf0c Prevent committing to dev/master/rc directly (#32029)
* Prevent committing to dev/master/rc directly

* Skip pre-commit on version bump
2020-02-20 09:34:30 -08:00
Franck Nijhof
1c81e8ad68 Remove history_graph integration (#32028)
* Remove history_graph integration

* Update codeowners file
2020-02-20 09:01:29 -08:00
Paulus Schoutsen
1c2bce9292 Fix recursion bug (#32009)
* Fix recursion bug

* Remove shield
2020-02-20 08:51:00 -08:00
Franck Nijhof
5c5f839119 Remove weblink integration (#32024) 2020-02-20 08:50:40 -08:00
Robin
a7d5e898ba Add convert_to_pil_image to pil util (#31825)
* Update pil.py

* Update doods and tensorflow to use convert_to_pil_image

* Update pil.py

* Add log messages on bad data

* Drop convert_to_pil_image

Just perform conversion in the integrations without seperate convert_to_pil_image()
2020-02-20 17:50:28 +01:00
Raman Gupta
7a6b13cb0d Update vizio dependency and integration name (#31975)
* bump pyvizio version and clean up code

* fix requirements

* update parameter to optional per review in docs PR
2020-02-20 08:43:29 -08:00
Paulus Schoutsen
51b2d0b4f8 Add entity ID to input_number warning (#32012)
* Add entity ID to warning

* Input Number flexibility
2020-02-20 08:30:24 -08:00
Franck Nijhof
2ad1f7fd02 Remove states UI options in group integration (#32021) 2020-02-20 08:26:41 -08:00
cgtobi
7e3841e172 Bump pyatmo to 3.2.4 (#32018)
* Bump pyatmo to 3.2.3

* Bump pyatmo version to 3.2.4

* Update requirements_test_all.txt
2020-02-20 08:25:49 -08:00
Franck Nijhof
2ec0a504da Remove deprecated Hue options (fixes CI) (#32027) 2020-02-20 17:18:50 +01:00
Paulus Schoutsen
e71c7e1f5e Fix hue test 2020-02-20 08:11:27 -08:00
MatthewFlamm
6c9d4a6d15 Add missing name to logging in DataUpdateCoordinator (#32023) 2020-02-20 16:51:15 +01:00
Franck Nijhof
d6c185fdf4 Deprecate Xfinity Gateway integration (ADR-0004) (#32017) 2020-02-20 16:01:03 +01:00
Franck Nijhof
aae64dba62 Bumped version to 0.107.0dev0 2020-02-20 11:44:00 +01:00
Franck Nijhof
febd7e551b Upgrade requests to 2.23.0 (#32013) 2020-02-20 11:41:13 +01:00
jjlawren
047111b00f Fix Plex sensor title handling (#31973)
* Fix Plex sensor title parsing

* Revert episode year for now
2020-02-19 22:33:38 -08:00
Daniel Perna
136ed12ec5 Update pyhomematic to 0.1.65 (#32006) 2020-02-19 22:27:50 -08:00
Tsvi Mostovicz
b6d60c36a5 Don't return coroutine in DLNA/DMR service handler (#32011)
Fixes #32010
2020-02-19 22:21:09 -08:00
Mark Coombes
832337f26c Fix bug in ecobee integration (#32008)
* Bump python-ecobee-api to 0.2.1

* Update log messages for clarity

* Update requirements_all
2020-02-19 21:05:22 -08:00
HomeAssistant Azure
5839df39b5 [ci skip] Translation update 2020-02-20 00:31:46 +00:00
Pascal Vizeli
6f8f23238a Nuki: add support for unique id (#31824)
* Nuki support unique id and the battery level attribute

* Fix isort

* Address comments

* Cache attribute

* Cleanup

* Restore false

* Fix isort
2020-02-19 08:16:02 -08:00
Paulus Schoutsen
4e765398cc Only check frontend for safe mode if frontend wanted to be loa… (#31969)
* Only check frontend for safe mode if frontend wanted to be loaded

* Update test
2020-02-19 15:56:46 +01:00
David F. Mulcahey
8255bdf3d5 Bump ZHA quirks and add skip configuration support (#31982)
* add skip configuration
* Bump quirks
* add skip configuration to FakeDevice
2020-02-19 09:19:26 -05:00
1433 changed files with 38596 additions and 19322 deletions

View File

@@ -29,6 +29,7 @@ omit =
homeassistant/components/airly/air_quality.py
homeassistant/components/airly/sensor.py
homeassistant/components/airly/const.py
homeassistant/components/airvisual/__init__.py
homeassistant/components/airvisual/sensor.py
homeassistant/components/aladdin_connect/cover.py
homeassistant/components/alarmdecoder/*
@@ -58,14 +59,13 @@ omit =
homeassistant/components/arwn/sensor.py
homeassistant/components/asterisk_cdr/mailbox.py
homeassistant/components/asterisk_mbox/*
homeassistant/components/asuswrt/device_tracker.py
homeassistant/components/aten_pe/*
homeassistant/components/atome/*
homeassistant/components/august/*
homeassistant/components/aurora_abb_powerone/sensor.py
homeassistant/components/automatic/device_tracker.py
homeassistant/components/avea/light.py
homeassistant/components/avion/light.py
homeassistant/components/avri/sensor.py
homeassistant/components/azure_event_hub/*
homeassistant/components/azure_service_bus/*
homeassistant/components/baidu/tts.py
@@ -108,7 +108,6 @@ omit =
homeassistant/components/canary/alarm_control_panel.py
homeassistant/components/canary/camera.py
homeassistant/components/cast/*
homeassistant/components/cert_expiry/sensor.py
homeassistant/components/cert_expiry/helper.py
homeassistant/components/channels/*
homeassistant/components/cisco_ios/device_tracker.py
@@ -150,7 +149,6 @@ omit =
homeassistant/components/dht/sensor.py
homeassistant/components/digital_ocean/*
homeassistant/components/digitalloggers/switch.py
homeassistant/components/directv/media_player.py
homeassistant/components/discogs/sensor.py
homeassistant/components/discord/notify.py
homeassistant/components/dlib_face_detect/image_processing.py
@@ -180,6 +178,7 @@ omit =
homeassistant/components/ecobee/weather.py
homeassistant/components/econet/*
homeassistant/components/ecovacs/*
homeassistant/components/edl21/*
homeassistant/components/eddystone_temperature/sensor.py
homeassistant/components/edimax/switch.py
homeassistant/components/egardia/*
@@ -218,6 +217,7 @@ omit =
homeassistant/components/eufy/*
homeassistant/components/everlights/light.py
homeassistant/components/evohome/*
homeassistant/components/ezviz/*
homeassistant/components/familyhub/camera.py
homeassistant/components/fastdotcom/*
homeassistant/components/ffmpeg/camera.py
@@ -314,6 +314,7 @@ omit =
homeassistant/components/hydrawise/*
homeassistant/components/hyperion/light.py
homeassistant/components/ialarm/alarm_control_panel.py
homeassistant/components/iammeter/sensor.py
homeassistant/components/iaqualink/binary_sensor.py
homeassistant/components/iaqualink/climate.py
homeassistant/components/iaqualink/light.py
@@ -411,7 +412,9 @@ omit =
homeassistant/components/mediaroom/media_player.py
homeassistant/components/melcloud/__init__.py
homeassistant/components/melcloud/climate.py
homeassistant/components/melcloud/const.py
homeassistant/components/melcloud/sensor.py
homeassistant/components/melcloud/water_heater.py
homeassistant/components/message_bird/notify.py
homeassistant/components/met/weather.py
homeassistant/components/meteo_france/__init__.py
@@ -463,7 +466,6 @@ omit =
homeassistant/components/nello/lock.py
homeassistant/components/nest/*
homeassistant/components/netatmo/__init__.py
homeassistant/components/netatmo/binary_sensor.py
homeassistant/components/netatmo/api.py
homeassistant/components/netatmo/camera.py
homeassistant/components/netatmo/climate.py
@@ -480,6 +482,7 @@ omit =
homeassistant/components/nissan_leaf/*
homeassistant/components/nmap_tracker/device_tracker.py
homeassistant/components/nmbs/sensor.py
homeassistant/components/notion/__init__.py
homeassistant/components/notion/binary_sensor.py
homeassistant/components/notion/sensor.py
homeassistant/components/noaa_tides/sensor.py
@@ -538,10 +541,8 @@ omit =
homeassistant/components/pioneer/media_player.py
homeassistant/components/pjlink/media_player.py
homeassistant/components/plaato/*
homeassistant/components/plex/__init__.py
homeassistant/components/plex/media_player.py
homeassistant/components/plex/sensor.py
homeassistant/components/plex/server.py
homeassistant/components/plugwise/*
homeassistant/components/plum_lightpad/*
homeassistant/components/pocketcasts/sensor.py
@@ -565,6 +566,7 @@ omit =
homeassistant/components/qnap/sensor.py
homeassistant/components/qrcode/image_processing.py
homeassistant/components/quantum_gateway/device_tracker.py
homeassistant/components/qvr_pro/*
homeassistant/components/qwikswitch/*
homeassistant/components/rachio/*
homeassistant/components/radarr/sensor.py
@@ -698,6 +700,7 @@ omit =
homeassistant/components/tado/device_tracker.py
homeassistant/components/tahoma/*
homeassistant/components/tank_utility/sensor.py
homeassistant/components/tankerkoenig/*
homeassistant/components/tapsaff/binary_sensor.py
homeassistant/components/tautulli/sensor.py
homeassistant/components/ted5000/sensor.py
@@ -842,6 +845,7 @@ omit =
homeassistant/components/zha/core/helpers.py
homeassistant/components/zha/core/patches.py
homeassistant/components/zha/core/registries.py
homeassistant/components/zha/core/typing.py
homeassistant/components/zha/entity.py
homeassistant/components/zha/light.py
homeassistant/components/zha/sensor.py

View File

@@ -1,7 +1,7 @@
blank_issues_enabled: false
contact_links:
- name: Report a bug with the UI, Frontend or Lovelace
url: https://github.com/home-assistant/home-assistant-polymer/issues
url: https://github.com/home-assistant/frontend/issues
about: This is the issue tracker for our backend. Please report issues with the UI in the frontend repository.
- name: Report incorrect or missing information on our website
url: https://github.com/home-assistant/home-assistant.io/issues

View File

@@ -1,53 +1,58 @@
repos:
- repo: https://github.com/psf/black
- repo: https://github.com/psf/black
rev: 19.10b0
hooks:
- id: black
- id: black
args:
- --safe
- --quiet
files: ^((homeassistant|script|tests)/.+)?[^/]+\.py$
- repo: https://github.com/codespell-project/codespell
- repo: https://github.com/codespell-project/codespell
rev: v1.16.0
hooks:
- id: codespell
- id: codespell
args:
- --ignore-words-list=hass,alot,datas,dof,dur,farenheit,hist,iff,ines,ist,lightsensor,mut,nd,pres,referer,ser,serie,te,technik,ue,uint,visability,wan,wanna,withing
- --skip="./.*,*.json"
- --quiet-level=2
exclude_types: [json]
- repo: https://gitlab.com/pycqa/flake8
- repo: https://gitlab.com/pycqa/flake8
rev: 3.7.9
hooks:
- id: flake8
- id: flake8
additional_dependencies:
- flake8-docstrings==1.5.0
- pydocstyle==5.0.2
files: ^(homeassistant|script|tests)/.+\.py$
- repo: https://github.com/PyCQA/bandit
- repo: https://github.com/PyCQA/bandit
rev: 1.6.2
hooks:
- id: bandit
- id: bandit
args:
- --quiet
- --format=custom
- --configfile=tests/bandit.yaml
files: ^(homeassistant|script|tests)/.+\.py$
- repo: https://github.com/pre-commit/mirrors-isort
- repo: https://github.com/pre-commit/mirrors-isort
rev: v4.3.21
hooks:
- id: isort
- repo: https://github.com/pre-commit/pre-commit-hooks
- id: isort
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.4.0
hooks:
- id: check-json
- repo: local
- id: check-json
- id: no-commit-to-branch
args:
- --branch=dev
- --branch=master
- --branch=rc
- repo: local
hooks:
# Run mypy through our wrapper script in order to get the possible
# pyenv and/or virtualenv activated; it may not have been e.g. if
# committing from a GUI tool that was not launched from an activated
# shell.
- id: mypy
# Run mypy through our wrapper script in order to get the possible
# pyenv and/or virtualenv activated; it may not have been e.g. if
# committing from a GUI tool that was not launched from an activated
# shell.
- id: mypy
name: mypy
entry: script/run-in-env.sh mypy
language: script

View File

@@ -41,6 +41,7 @@ homeassistant/components/auth/* @home-assistant/core
homeassistant/components/automatic/* @armills
homeassistant/components/automation/* @home-assistant/core
homeassistant/components/avea/* @pattyland
homeassistant/components/avri/* @timvancann
homeassistant/components/awair/* @danielsjf
homeassistant/components/aws/* @awarecan @robbiet480
homeassistant/components/axis/* @kane610
@@ -51,6 +52,7 @@ homeassistant/components/bitcoin/* @fabaff
homeassistant/components/bizkaibus/* @UgaitzEtxebarria
homeassistant/components/blink/* @fronzbot
homeassistant/components/bmw_connected_drive/* @gerard33
homeassistant/components/bom/* @maddenp
homeassistant/components/braviatv/* @robbiet480
homeassistant/components/broadlink/* @danielhiversen @felipediel
homeassistant/components/brother/* @bieniu
@@ -68,6 +70,7 @@ homeassistant/components/config/* @home-assistant/core
homeassistant/components/configurator/* @home-assistant/core
homeassistant/components/conversation/* @home-assistant/core
homeassistant/components/coolmaster/* @OnFreund
homeassistant/components/coronavirus/* @home_assistant/core
homeassistant/components/counter/* @fabaff
homeassistant/components/cover/* @home-assistant/core
homeassistant/components/cpuspeed/* @fabaff
@@ -80,6 +83,7 @@ homeassistant/components/demo/* @home-assistant/core
homeassistant/components/derivative/* @afaucogney
homeassistant/components/device_automation/* @home-assistant/core
homeassistant/components/digital_ocean/* @fabaff
homeassistant/components/directv/* @ctalkington
homeassistant/components/discogs/* @thibmaek
homeassistant/components/doorbird/* @oblogic7
homeassistant/components/dsmr_reader/* @depl0y
@@ -88,11 +92,13 @@ homeassistant/components/dynalite/* @ziv1234
homeassistant/components/dyson/* @etheralm
homeassistant/components/ecobee/* @marthoc
homeassistant/components/ecovacs/* @OverloadUT
homeassistant/components/edl21/* @mtdcr
homeassistant/components/egardia/* @jeroenterheerdt
homeassistant/components/eight_sleep/* @mezz64
homeassistant/components/elgato/* @frenck
homeassistant/components/elv/* @majuss
homeassistant/components/emby/* @mezz64
homeassistant/components/emoncms/* @borpin
homeassistant/components/enigma2/* @fbradyirl
homeassistant/components/enocean/* @bdurrer
homeassistant/components/entur_public_transport/* @hfurubotten
@@ -103,6 +109,7 @@ homeassistant/components/eq3btsmart/* @rytilahti
homeassistant/components/esphome/* @OttoWinter
homeassistant/components/essent/* @TheLastProject
homeassistant/components/evohome/* @zxdavb
homeassistant/components/ezviz/* @baqs
homeassistant/components/fastdotcom/* @rohankapoorcom
homeassistant/components/file/* @fabaff
homeassistant/components/filter/* @dgomes
@@ -135,6 +142,7 @@ homeassistant/components/google_translate/* @awarecan
homeassistant/components/google_travel_time/* @robbiet480
homeassistant/components/gpsd/* @fabaff
homeassistant/components/greeneye_monitor/* @jkeljo
homeassistant/components/griddy/* @bdraco
homeassistant/components/group/* @home-assistant/core
homeassistant/components/growatt_server/* @indykoning
homeassistant/components/gtfs/* @robbiet480
@@ -147,7 +155,6 @@ homeassistant/components/hikvision/* @mezz64
homeassistant/components/hikvisioncam/* @fbradyirl
homeassistant/components/hisense_aehw4a1/* @bannhead
homeassistant/components/history/* @home-assistant/core
homeassistant/components/history_graph/* @andrey-git
homeassistant/components/hive/* @Rendili @KJonline
homeassistant/components/homeassistant/* @home-assistant/core
homeassistant/components/homekit_controller/* @Jc2k
@@ -159,6 +166,7 @@ homeassistant/components/http/* @home-assistant/core
homeassistant/components/huawei_lte/* @scop
homeassistant/components/huawei_router/* @abmantis
homeassistant/components/hue/* @balloob
homeassistant/components/iammeter/* @lewei50
homeassistant/components/iaqualink/* @flz
homeassistant/components/icloud/* @Quentame
homeassistant/components/ign_sismologia/* @exxamalte
@@ -276,6 +284,7 @@ homeassistant/components/pvoutput/* @fabaff
homeassistant/components/qld_bushfire/* @exxamalte
homeassistant/components/qnap/* @colinodell
homeassistant/components/quantum_gateway/* @cisasteelersfan
homeassistant/components/qvr_pro/* @oblogic7
homeassistant/components/qwikswitch/* @kellerza
homeassistant/components/rainbird/* @konikvranik
homeassistant/components/raincloud/* @vanstinator
@@ -286,6 +295,7 @@ homeassistant/components/repetier/* @MTrab
homeassistant/components/rfxtrx/* @danielhiversen
homeassistant/components/ring/* @balloob
homeassistant/components/rmvtransport/* @cgtobi
homeassistant/components/roku/* @ctalkington
homeassistant/components/roomba/* @pschmitt
homeassistant/components/safe_mode/* @home-assistant/core
homeassistant/components/saj/* @fredericvl
@@ -346,6 +356,7 @@ homeassistant/components/synology_srm/* @aerialls
homeassistant/components/syslog/* @fabaff
homeassistant/components/tado/* @michaelarnauts
homeassistant/components/tahoma/* @philklei
homeassistant/components/tankerkoenig/* @guillempages
homeassistant/components/tautulli/* @ludeeus
homeassistant/components/tellduslive/* @fredrike
homeassistant/components/template/* @PhracturedBlue @tetienne
@@ -365,7 +376,7 @@ homeassistant/components/traccar/* @ludeeus
homeassistant/components/tradfri/* @ggravlingen
homeassistant/components/trafikverket_train/* @endor-force
homeassistant/components/transmission/* @engrbm87 @JPHutchins
homeassistant/components/tts/* @robbiet480
homeassistant/components/tts/* @pvizeli
homeassistant/components/twentemilieu/* @frenck
homeassistant/components/twilio_call/* @robbiet480
homeassistant/components/twilio_sms/* @robbiet480
@@ -375,7 +386,7 @@ homeassistant/components/unifiled/* @florisvdk
homeassistant/components/upc_connect/* @pvizeli
homeassistant/components/upcloud/* @scop
homeassistant/components/updater/* @home-assistant/core
homeassistant/components/upnp/* @robbiet480
homeassistant/components/upnp/* @StevenLooman
homeassistant/components/uptimerobot/* @ludeeus
homeassistant/components/usgs_earthquakes_feed/* @exxamalte
homeassistant/components/utility_meter/* @dgomes
@@ -392,7 +403,6 @@ homeassistant/components/vlc_telnet/* @rodripf
homeassistant/components/waqi/* @andrey-git
homeassistant/components/watson_tts/* @rutkai
homeassistant/components/weather/* @fabaff
homeassistant/components/weblink/* @home-assistant/core
homeassistant/components/webostv/* @bendavid
homeassistant/components/websocket_api/* @home-assistant/core
homeassistant/components/wemo/* @sqldiablo

View File

@@ -148,7 +148,7 @@ stages:
. venv/bin/activate
pytest --timeout=9 --durations=10 -n auto --dist=loadfile --cov homeassistant --cov-report html -qq -o console_output_style=count -p no:sugar tests
codecov --token $(codecovToken)
#codecov --token $(codecovToken)
script/check_dirty
displayName: 'Run pytest for python $(python.container) / coverage'
condition: and(succeeded(), eq(variables['python.container'], variables['PythonMain']))

View File

@@ -41,7 +41,7 @@ stages:
jq curl
release="$(Build.SourceBranchName)"
created_by="$(curl -s https://api.github.com/repos/home-assistant/home-assistant/releases/tags/${release} | jq --raw-output '.author.login')"
created_by="$(curl -s https://api.github.com/repos/home-assistant/core/releases/tags/${release} | jq --raw-output '.author.login')"
if [[ "${created_by}" =~ ^(balloob|pvizeli|fabaff|robbiet480|bramkragten|frenck)$ ]]; then
exit 0

View File

@@ -40,7 +40,7 @@ jobs:
if [[ "$(Build.Reason)" =~ (Schedule|Manual) ]]; then
touch requirements_diff.txt
else
curl -s -o requirements_diff.txt https://raw.githubusercontent.com/home-assistant/home-assistant/master/requirements_all.txt
curl -s -o requirements_diff.txt https://raw.githubusercontent.com/home-assistant/core/master/requirements_all.txt
fi
requirement_files="requirements_wheels.txt requirements_diff.txt"

View File

@@ -0,0 +1,12 @@
{
"config": {
"step": {
"user": {
"data": {
"password": "Parole",
"username": "E-pasta adrese"
}
}
}
}
}

View File

@@ -2,7 +2,6 @@
from asyncio import gather
from copy import deepcopy
from functools import partial
import logging
from abodepy import Abode
from abodepy.exceptions import AbodeException
@@ -24,21 +23,13 @@ from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.dispatcher import dispatcher_send
from homeassistant.helpers.entity import Entity
from .const import (
ATTRIBUTION,
DEFAULT_CACHEDB,
DOMAIN,
SIGNAL_CAPTURE_IMAGE,
SIGNAL_TRIGGER_QUICK_ACTION,
)
_LOGGER = logging.getLogger(__name__)
from .const import ATTRIBUTION, DEFAULT_CACHEDB, DOMAIN, LOGGER
CONF_POLLING = "polling"
SERVICE_SETTINGS = "change_setting"
SERVICE_CAPTURE_IMAGE = "capture_image"
SERVICE_TRIGGER = "trigger_quick_action"
SERVICE_TRIGGER_AUTOMATION = "trigger_automation"
ATTR_DEVICE_ID = "device_id"
ATTR_DEVICE_NAME = "device_name"
@@ -53,8 +44,6 @@ ATTR_APP_TYPE = "app_type"
ATTR_EVENT_BY = "event_by"
ATTR_VALUE = "value"
ABODE_DEVICE_ID_LIST_SCHEMA = vol.Schema([str])
CONFIG_SCHEMA = vol.Schema(
{
DOMAIN: vol.Schema(
@@ -74,7 +63,7 @@ CHANGE_SETTING_SCHEMA = vol.Schema(
CAPTURE_IMAGE_SCHEMA = vol.Schema({ATTR_ENTITY_ID: cv.entity_ids})
TRIGGER_SCHEMA = vol.Schema({ATTR_ENTITY_ID: cv.entity_ids})
AUTOMATION_SCHEMA = vol.Schema({ATTR_ENTITY_ID: cv.entity_ids})
ABODE_PLATFORMS = [
"alarm_control_panel",
@@ -93,7 +82,6 @@ class AbodeSystem:
def __init__(self, abode, polling):
"""Initialize the system."""
self.abode = abode
self.polling = polling
self.entity_ids = set()
@@ -130,7 +118,7 @@ async def async_setup_entry(hass, config_entry):
hass.data[DOMAIN] = AbodeSystem(abode, polling)
except (AbodeException, ConnectTimeout, HTTPError) as ex:
_LOGGER.error("Unable to connect to Abode: %s", str(ex))
LOGGER.error("Unable to connect to Abode: %s", str(ex))
return False
for platform in ABODE_PLATFORMS:
@@ -149,7 +137,7 @@ async def async_unload_entry(hass, config_entry):
"""Unload a config entry."""
hass.services.async_remove(DOMAIN, SERVICE_SETTINGS)
hass.services.async_remove(DOMAIN, SERVICE_CAPTURE_IMAGE)
hass.services.async_remove(DOMAIN, SERVICE_TRIGGER)
hass.services.async_remove(DOMAIN, SERVICE_TRIGGER_AUTOMATION)
tasks = []
@@ -180,7 +168,7 @@ def setup_hass_services(hass):
try:
hass.data[DOMAIN].abode.set_setting(setting, value)
except AbodeException as ex:
_LOGGER.warning(ex)
LOGGER.warning(ex)
def capture_image(call):
"""Capture a new image."""
@@ -193,11 +181,11 @@ def setup_hass_services(hass):
]
for entity_id in target_entities:
signal = SIGNAL_CAPTURE_IMAGE.format(entity_id)
signal = f"abode_camera_capture_{entity_id}"
dispatcher_send(hass, signal)
def trigger_quick_action(call):
"""Trigger a quick action."""
def trigger_automation(call):
"""Trigger an Abode automation."""
entity_ids = call.data.get(ATTR_ENTITY_ID, None)
target_entities = [
@@ -207,7 +195,7 @@ def setup_hass_services(hass):
]
for entity_id in target_entities:
signal = SIGNAL_TRIGGER_QUICK_ACTION.format(entity_id)
signal = f"abode_trigger_automation_{entity_id}"
dispatcher_send(hass, signal)
hass.services.register(
@@ -219,7 +207,7 @@ def setup_hass_services(hass):
)
hass.services.register(
DOMAIN, SERVICE_TRIGGER, trigger_quick_action, schema=TRIGGER_SCHEMA
DOMAIN, SERVICE_TRIGGER_AUTOMATION, trigger_automation, schema=AUTOMATION_SCHEMA
)
@@ -232,7 +220,7 @@ async def setup_hass_events(hass):
hass.data[DOMAIN].abode.events.stop()
hass.data[DOMAIN].abode.logout()
_LOGGER.info("Logged out of Abode")
LOGGER.info("Logged out of Abode")
if not hass.data[DOMAIN].polling:
await hass.async_add_executor_job(hass.data[DOMAIN].abode.events.start)
@@ -390,11 +378,14 @@ class AbodeAutomation(Entity):
"""Return the state attributes."""
return {
ATTR_ATTRIBUTION: ATTRIBUTION,
"automation_id": self._automation.automation_id,
"type": self._automation.type,
"sub_type": self._automation.sub_type,
"type": "CUE automation",
}
@property
def unique_id(self):
"""Return a unique ID to use for this automation."""
return self._automation.automation_id
def _update_callback(self, device):
"""Update the automation state."""
self._automation.refresh()

View File

@@ -1,6 +1,4 @@
"""Support for Abode Security System alarm control panels."""
import logging
import homeassistant.components.alarm_control_panel as alarm
from homeassistant.components.alarm_control_panel.const import (
SUPPORT_ALARM_ARM_AWAY,
@@ -16,8 +14,6 @@ from homeassistant.const import (
from . import AbodeDevice
from .const import ATTRIBUTION, DOMAIN
_LOGGER = logging.getLogger(__name__)
ICON = "mdi:security"
@@ -50,6 +46,11 @@ class AbodeAlarm(AbodeDevice, alarm.AlarmControlPanel):
state = None
return state
@property
def code_arm_required(self):
"""Whether the code is required for arm actions."""
return False
@property
def supported_features(self) -> int:
"""Return the list of supported features."""

View File

@@ -1,16 +1,10 @@
"""Support for Abode Security System binary sensors."""
import logging
import abodepy.helpers.constants as CONST
import abodepy.helpers.timeline as TIMELINE
from homeassistant.components.binary_sensor import BinarySensorDevice
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from . import AbodeAutomation, AbodeDevice
from .const import DOMAIN, SIGNAL_TRIGGER_QUICK_ACTION
_LOGGER = logging.getLogger(__name__)
from . import AbodeDevice
from .const import DOMAIN
async def async_setup_entry(hass, config_entry, async_add_entities):
@@ -30,13 +24,6 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
for device in data.abode.get_devices(generic_type=device_types):
entities.append(AbodeBinarySensor(data, device))
for automation in data.abode.get_automations(generic_type=CONST.TYPE_QUICK_ACTION):
entities.append(
AbodeQuickActionBinarySensor(
data, automation, TIMELINE.AUTOMATION_EDIT_GROUP
)
)
async_add_entities(entities)
@@ -52,22 +39,3 @@ class AbodeBinarySensor(AbodeDevice, BinarySensorDevice):
def device_class(self):
"""Return the class of the binary sensor."""
return self._device.generic_type
class AbodeQuickActionBinarySensor(AbodeAutomation, BinarySensorDevice):
"""A binary sensor implementation for Abode quick action automations."""
async def async_added_to_hass(self):
"""Subscribe Abode events."""
await super().async_added_to_hass()
signal = SIGNAL_TRIGGER_QUICK_ACTION.format(self.entity_id)
async_dispatcher_connect(self.hass, signal, self.trigger)
def trigger(self):
"""Trigger a quick automation."""
self._automation.trigger()
@property
def is_on(self):
"""Return True if the binary sensor is on."""
return self._automation.is_active

View File

@@ -1,6 +1,5 @@
"""Support for Abode Security System cameras."""
from datetime import timedelta
import logging
import abodepy.helpers.constants as CONST
import abodepy.helpers.timeline as TIMELINE
@@ -11,12 +10,10 @@ from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.util import Throttle
from . import AbodeDevice
from .const import DOMAIN, SIGNAL_CAPTURE_IMAGE
from .const import DOMAIN, LOGGER
MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=90)
_LOGGER = logging.getLogger(__name__)
async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up Abode camera devices."""
@@ -50,7 +47,7 @@ class AbodeCamera(AbodeDevice, Camera):
self._capture_callback,
)
signal = SIGNAL_CAPTURE_IMAGE.format(self.entity_id)
signal = f"abode_camera_capture_{self.entity_id}"
async_dispatcher_connect(self.hass, signal, self.capture)
def capture(self):
@@ -71,7 +68,7 @@ class AbodeCamera(AbodeDevice, Camera):
self._response.raise_for_status()
except requests.HTTPError as err:
_LOGGER.warning("Failed to get camera image: %s", err)
LOGGER.warning("Failed to get camera image: %s", err)
self._response = None
else:
self._response = None

View File

@@ -1,6 +1,4 @@
"""Config flow for the Abode Security System component."""
import logging
from abodepy import Abode
from abodepy.exceptions import AbodeException
from requests.exceptions import ConnectTimeout, HTTPError
@@ -10,12 +8,10 @@ from homeassistant import config_entries
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
from homeassistant.core import callback
from .const import DEFAULT_CACHEDB, DOMAIN # pylint: disable=unused-import
from .const import DEFAULT_CACHEDB, DOMAIN, LOGGER # pylint: disable=unused-import
CONF_POLLING = "polling"
_LOGGER = logging.getLogger(__name__)
class AbodeFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
"""Config flow for Abode."""
@@ -32,7 +28,6 @@ class AbodeFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
async def async_step_user(self, user_input=None):
"""Handle a flow initialized by the user."""
if self._async_current_entries():
return self.async_abort(reason="single_instance_allowed")
@@ -50,7 +45,7 @@ class AbodeFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
)
except (AbodeException, ConnectTimeout, HTTPError) as ex:
_LOGGER.error("Unable to connect to Abode: %s", str(ex))
LOGGER.error("Unable to connect to Abode: %s", str(ex))
if ex.errcode == 400:
return self._show_form({"base": "invalid_credentials"})
return self._show_form({"base": "connection_error"})
@@ -76,7 +71,7 @@ class AbodeFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
async def async_step_import(self, import_config):
"""Import a config entry from configuration.yaml."""
if self._async_current_entries():
_LOGGER.warning("Only one configuration of abode is allowed.")
LOGGER.warning("Only one configuration of abode is allowed.")
return self.async_abort(reason="single_instance_allowed")
return await self.async_step_user(import_config)

View File

@@ -1,8 +1,9 @@
"""Constants for the Abode Security System component."""
import logging
LOGGER = logging.getLogger(__package__)
DOMAIN = "abode"
ATTRIBUTION = "Data provided by goabode.com"
DEFAULT_CACHEDB = "abodepy_cache.pickle"
SIGNAL_CAPTURE_IMAGE = "abode_camera_capture_{}"
SIGNAL_TRIGGER_QUICK_ACTION = "abode_trigger_quick_action_{}"

View File

@@ -1,6 +1,4 @@
"""Support for Abode Security System covers."""
import logging
import abodepy.helpers.constants as CONST
from homeassistant.components.cover import CoverDevice
@@ -8,8 +6,6 @@ from homeassistant.components.cover import CoverDevice
from . import AbodeDevice
from .const import DOMAIN
_LOGGER = logging.getLogger(__name__)
async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up Abode cover devices."""

View File

@@ -1,5 +1,4 @@
"""Support for Abode Security System lights."""
import logging
from math import ceil
import abodepy.helpers.constants as CONST
@@ -21,8 +20,6 @@ from homeassistant.util.color import (
from . import AbodeDevice
from .const import DOMAIN
_LOGGER = logging.getLogger(__name__)
async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up Abode light devices."""
@@ -45,16 +42,19 @@ class AbodeLight(AbodeDevice, Light):
self._device.set_color_temp(
int(color_temperature_mired_to_kelvin(kwargs[ATTR_COLOR_TEMP]))
)
return
if ATTR_HS_COLOR in kwargs and self._device.is_color_capable:
self._device.set_color(kwargs[ATTR_HS_COLOR])
return
if ATTR_BRIGHTNESS in kwargs and self._device.is_dimmable:
# Convert Home Assistant brightness (0-255) to Abode brightness (0-99)
# If 100 is sent to Abode, response is 99 causing an error
self._device.set_level(ceil(kwargs[ATTR_BRIGHTNESS] * 99 / 255.0))
else:
self._device.switch_on()
return
self._device.switch_on()
def turn_off(self, **kwargs):
"""Turn off the light."""

View File

@@ -1,6 +1,4 @@
"""Support for the Abode Security System locks."""
import logging
import abodepy.helpers.constants as CONST
from homeassistant.components.lock import LockDevice
@@ -8,8 +6,6 @@ from homeassistant.components.lock import LockDevice
from . import AbodeDevice
from .const import DOMAIN
_LOGGER = logging.getLogger(__name__)
async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up Abode lock devices."""

View File

@@ -3,7 +3,7 @@
"name": "Abode",
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/abode",
"requirements": ["abodepy==0.17.0"],
"requirements": ["abodepy==0.18.1"],
"dependencies": [],
"codeowners": ["@shred86"]
}

View File

@@ -1,6 +1,4 @@
"""Support for Abode Security System sensors."""
import logging
import abodepy.helpers.constants as CONST
from homeassistant.const import (
@@ -12,8 +10,6 @@ from homeassistant.const import (
from . import AbodeDevice
from .const import DOMAIN
_LOGGER = logging.getLogger(__name__)
# Sensor types: Name, icon
SENSOR_TYPES = {
CONST.TEMP_STATUS_KEY: ["Temperature", DEVICE_CLASS_TEMPERATURE],
@@ -44,9 +40,7 @@ class AbodeSensor(AbodeDevice):
"""Initialize a sensor for an Abode device."""
super().__init__(data, device)
self._sensor_type = sensor_type
self._name = "{0} {1}".format(
self._device.name, SENSOR_TYPES[self._sensor_type][0]
)
self._name = f"{self._device.name} {SENSOR_TYPES[self._sensor_type][0]}"
self._device_class = SENSOR_TYPES[self._sensor_type][1]
@property

View File

@@ -7,7 +7,7 @@ change_setting:
fields:
setting: {description: Setting to change., example: beeper_mute}
value: {description: Value of the setting., example: '1'}
trigger_quick_action:
description: Trigger an Abode quick action.
trigger_automation:
description: Trigger an Abode automation.
fields:
entity_id: {description: Entity id of the quick action to trigger., example: binary_sensor.home_quick_action}
entity_id: {description: Entity id of the automation to trigger., example: switch.my_automation}

View File

@@ -1,18 +1,17 @@
"""Support for Abode Security System switches."""
import logging
import abodepy.helpers.constants as CONST
import abodepy.helpers.timeline as TIMELINE
from homeassistant.components.switch import SwitchDevice
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from . import AbodeAutomation, AbodeDevice
from .const import DOMAIN
_LOGGER = logging.getLogger(__name__)
DEVICE_TYPES = [CONST.TYPE_SWITCH, CONST.TYPE_VALVE]
ICON = "mdi:robot"
async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up Abode switch devices."""
@@ -24,7 +23,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
for device in data.abode.get_devices(generic_type=device_type):
entities.append(AbodeSwitch(data, device))
for automation in data.abode.get_automations(generic_type=CONST.TYPE_AUTOMATION):
for automation in data.abode.get_automations():
entities.append(
AbodeAutomationSwitch(data, automation, TIMELINE.AUTOMATION_EDIT_GROUP)
)
@@ -52,15 +51,33 @@ class AbodeSwitch(AbodeDevice, SwitchDevice):
class AbodeAutomationSwitch(AbodeAutomation, SwitchDevice):
"""A switch implementation for Abode automations."""
async def async_added_to_hass(self):
"""Subscribe Abode events."""
await super().async_added_to_hass()
signal = f"abode_trigger_automation_{self.entity_id}"
async_dispatcher_connect(self.hass, signal, self.trigger)
def turn_on(self, **kwargs):
"""Turn on the device."""
self._automation.set_active(True)
"""Enable the automation."""
if self._automation.enable(True):
self.schedule_update_ha_state()
def turn_off(self, **kwargs):
"""Turn off the device."""
self._automation.set_active(False)
"""Disable the automation."""
if self._automation.enable(False):
self.schedule_update_ha_state()
def trigger(self):
"""Trigger the automation."""
self._automation.trigger()
@property
def is_on(self):
"""Return True if the binary sensor is on."""
return self._automation.is_active
"""Return True if the automation is enabled."""
return self._automation.is_enabled
@property
def icon(self):
"""Return the robot icon to match Home Assistant automations."""
return ICON

View File

@@ -11,6 +11,7 @@ from homeassistant.components.adguard.const import (
DOMAIN,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import TIME_MILLISECONDS, UNIT_PERCENTAGE
from homeassistant.exceptions import PlatformNotReady
from homeassistant.helpers.typing import HomeAssistantType
@@ -133,7 +134,7 @@ class AdGuardHomePercentageBlockedSensor(AdGuardHomeSensor):
"AdGuard DNS Queries Blocked Ratio",
"mdi:magnify-close",
"blocked_percentage",
"%",
UNIT_PERCENTAGE,
)
async def _adguard_update(self) -> None:
@@ -206,7 +207,7 @@ class AdGuardHomeAverageProcessingTimeSensor(AdGuardHomeSensor):
"AdGuard Average Processing Speed",
"mdi:speedometer",
"average_speed",
"ms",
TIME_MILLISECONDS,
)
async def _adguard_update(self) -> None:

View File

@@ -2,12 +2,14 @@
from homeassistant.const import (
ATTR_ATTRIBUTION,
ATTR_DEVICE_CLASS,
CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
CONF_NAME,
DEVICE_CLASS_HUMIDITY,
DEVICE_CLASS_PRESSURE,
DEVICE_CLASS_TEMPERATURE,
PRESSURE_HPA,
TEMP_CELSIUS,
UNIT_PERCENTAGE,
)
from homeassistant.helpers.entity import Entity
@@ -26,21 +28,18 @@ ATTR_ICON = "icon"
ATTR_LABEL = "label"
ATTR_UNIT = "unit"
HUMI_PERCENT = "%"
VOLUME_MICROGRAMS_PER_CUBIC_METER = "µg/m³"
SENSOR_TYPES = {
ATTR_API_PM1: {
ATTR_DEVICE_CLASS: None,
ATTR_ICON: "mdi:blur",
ATTR_LABEL: ATTR_API_PM1,
ATTR_UNIT: VOLUME_MICROGRAMS_PER_CUBIC_METER,
ATTR_UNIT: CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
},
ATTR_API_HUMIDITY: {
ATTR_DEVICE_CLASS: DEVICE_CLASS_HUMIDITY,
ATTR_ICON: None,
ATTR_LABEL: ATTR_API_HUMIDITY.capitalize(),
ATTR_UNIT: HUMI_PERCENT,
ATTR_UNIT: UNIT_PERCENTAGE,
},
ATTR_API_PRESSURE: {
ATTR_DEVICE_CLASS: DEVICE_CLASS_PRESSURE,

View File

@@ -0,0 +1,23 @@
{
"config": {
"abort": {
"already_configured": "Aquesta clau API ja est\u00e0 sent utilitzada."
},
"error": {
"invalid_api_key": "Clau API inv\u00e0lida"
},
"step": {
"user": {
"data": {
"api_key": "Clau API",
"latitude": "Latitud",
"longitude": "Longitud",
"show_on_map": "Mostra al mapa l'\u00e0rea geogr\u00e0fica monitoritzada"
},
"description": "Monitoritzaci\u00f3 de la qualitat de l'aire per ubicaci\u00f3 geogr\u00e0fica.",
"title": "Configura AirVisual"
}
},
"title": "AirVisual"
}
}

View File

@@ -0,0 +1,21 @@
{
"config": {
"abort": {
"already_configured": "Dieser API-Schl\u00fcssel wird bereits verwendet."
},
"error": {
"invalid_api_key": "Ung\u00fcltiger API-Schl\u00fcssel"
},
"step": {
"user": {
"data": {
"api_key": "API-Schl\u00fcssel",
"latitude": "Breitengrad",
"longitude": "L\u00e4ngengrad"
},
"title": "Konfigurieren Sie AirVisual"
}
},
"title": "AirVisual"
}
}

View File

@@ -0,0 +1,33 @@
{
"config": {
"abort": {
"already_configured": "This API key is already in use."
},
"error": {
"invalid_api_key": "Invalid API key"
},
"step": {
"user": {
"data": {
"api_key": "API Key",
"latitude": "Latitude",
"longitude": "Longitude"
},
"description": "Monitor air quality in a geographical location.",
"title": "Configure AirVisual"
}
},
"title": "AirVisual"
},
"options": {
"step": {
"init": {
"data": {
"show_on_map": "Show monitored geography on the map"
},
"description": "Set various options for the AirVisual integration.",
"title": "Configure AirVisual"
}
}
}
}

View File

@@ -0,0 +1,23 @@
{
"config": {
"abort": {
"already_configured": "Esta clave API ya est\u00e1 en uso."
},
"error": {
"invalid_api_key": "Clave API inv\u00e1lida"
},
"step": {
"user": {
"data": {
"api_key": "Clave API",
"latitude": "Latitud",
"longitude": "Longitud",
"show_on_map": "Mostrar geograf\u00eda monitorizada en el mapa"
},
"description": "Monitorizar la calidad del aire en una ubicaci\u00f3n geogr\u00e1fica.",
"title": "Configurar AirVisual"
}
},
"title": "AirVisual"
}
}

View File

@@ -0,0 +1,23 @@
{
"config": {
"abort": {
"already_configured": "Questa chiave API \u00e8 gi\u00e0 in uso."
},
"error": {
"invalid_api_key": "Chiave API non valida"
},
"step": {
"user": {
"data": {
"api_key": "Chiave API",
"latitude": "Latitudine",
"longitude": "Logitudine",
"show_on_map": "Mostra l'area geografica monitorata sulla mappa"
},
"description": "Monitorare la qualit\u00e0 dell'aria in una posizione geografica.",
"title": "Configura AirVisual"
}
},
"title": "AirVisual"
}
}

View File

@@ -0,0 +1,21 @@
{
"config": {
"abort": {
"already_configured": "D\u00ebsen App Schl\u00ebssel g\u00ebtt scho benotzt"
},
"error": {
"invalid_api_key": "Ong\u00ebltegen API Schl\u00ebssel"
},
"step": {
"user": {
"data": {
"api_key": "API Schl\u00ebssel",
"latitude": "Breedegrad",
"longitude": "L\u00e4ngegrad"
},
"title": "AirVisual konfigur\u00e9ieren"
}
},
"title": "AirVisual"
}
}

View File

@@ -0,0 +1,23 @@
{
"config": {
"abort": {
"already_configured": "Denne API-n\u00f8kkelen er allerede i bruk."
},
"error": {
"invalid_api_key": "Ugyldig API-n\u00f8kkel"
},
"step": {
"user": {
"data": {
"api_key": "API-n\u00f8kkel",
"latitude": "Breddegrad",
"longitude": "Lengdegrad",
"show_on_map": "Vis overv\u00e5ket geografi p\u00e5 kartet"
},
"description": "Overv\u00e5k luftkvaliteten p\u00e5 et geografisk sted.",
"title": "Konfigurer AirVisual"
}
},
"title": "AirVisual"
}
}

View File

@@ -0,0 +1,23 @@
{
"config": {
"abort": {
"already_configured": "\u042d\u0442\u043e\u0442 \u043a\u043b\u044e\u0447 API \u0443\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f."
},
"error": {
"invalid_api_key": "\u041d\u0435\u0432\u0435\u0440\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 API."
},
"step": {
"user": {
"data": {
"api_key": "\u041a\u043b\u044e\u0447 API",
"latitude": "\u0428\u0438\u0440\u043e\u0442\u0430",
"longitude": "\u0414\u043e\u043b\u0433\u043e\u0442\u0430",
"show_on_map": "\u041f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0435\u043c\u0443\u044e \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u043d\u0430 \u043a\u0430\u0440\u0442\u0435"
},
"description": "\u041a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u0443\u0439\u0442\u0435 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u043e\u0437\u0434\u0443\u0445\u0430 \u0432 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0438.",
"title": "AirVisual"
}
},
"title": "AirVisual"
}
}

View File

@@ -0,0 +1,23 @@
{
"config": {
"abort": {
"already_configured": "\u6b64 API \u5bc6\u9470\u5df2\u88ab\u4f7f\u7528\u3002"
},
"error": {
"invalid_api_key": "API \u5bc6\u78bc\u7121\u6548"
},
"step": {
"user": {
"data": {
"api_key": "API \u5bc6\u9470",
"latitude": "\u7def\u5ea6",
"longitude": "\u7d93\u5ea6",
"show_on_map": "\u65bc\u5730\u5716\u4e0a\u986f\u793a\u76e3\u63a7\u4f4d\u7f6e\u3002"
},
"description": "\u4f9d\u5730\u7406\u4f4d\u7f6e\u76e3\u63a7\u7a7a\u6c23\u54c1\u8cea\u3002",
"title": "\u8a2d\u5b9a AirVisual"
}
},
"title": "AirVisual"
}
}

View File

@@ -1 +1,215 @@
"""The airvisual component."""
import asyncio
import logging
from pyairvisual import Client
from pyairvisual.errors import AirVisualError, InvalidKeyError
import voluptuous as vol
from homeassistant.config_entries import SOURCE_IMPORT
from homeassistant.const import (
CONF_API_KEY,
CONF_LATITUDE,
CONF_LONGITUDE,
CONF_SHOW_ON_MAP,
CONF_STATE,
)
from homeassistant.core import callback
from homeassistant.exceptions import ConfigEntryNotReady
from homeassistant.helpers import aiohttp_client, config_validation as cv
from homeassistant.helpers.dispatcher import async_dispatcher_send
from homeassistant.helpers.event import async_track_time_interval
from .const import (
CONF_CITY,
CONF_COUNTRY,
CONF_GEOGRAPHIES,
DATA_CLIENT,
DEFAULT_SCAN_INTERVAL,
DOMAIN,
TOPIC_UPDATE,
)
_LOGGER = logging.getLogger(__name__)
DATA_LISTENER = "listener"
DEFAULT_OPTIONS = {CONF_SHOW_ON_MAP: True}
CONF_NODE_ID = "node_id"
GEOGRAPHY_COORDINATES_SCHEMA = vol.Schema(
{
vol.Required(CONF_LATITUDE): cv.latitude,
vol.Required(CONF_LONGITUDE): cv.longitude,
}
)
GEOGRAPHY_PLACE_SCHEMA = vol.Schema(
{
vol.Required(CONF_CITY): cv.string,
vol.Required(CONF_STATE): cv.string,
vol.Required(CONF_COUNTRY): cv.string,
}
)
CLOUD_API_SCHEMA = vol.Schema(
{
vol.Required(CONF_API_KEY): cv.string,
vol.Optional(CONF_GEOGRAPHIES, default=[]): vol.All(
cv.ensure_list,
[vol.Any(GEOGRAPHY_COORDINATES_SCHEMA, GEOGRAPHY_PLACE_SCHEMA)],
),
}
)
CONFIG_SCHEMA = vol.Schema({DOMAIN: CLOUD_API_SCHEMA}, extra=vol.ALLOW_EXTRA)
@callback
def async_get_geography_id(geography_dict):
"""Generate a unique ID from a geography dict."""
if CONF_CITY in geography_dict:
return ",".join(
(
geography_dict[CONF_CITY],
geography_dict[CONF_STATE],
geography_dict[CONF_COUNTRY],
)
)
return ",".join(
(str(geography_dict[CONF_LATITUDE]), str(geography_dict[CONF_LONGITUDE]))
)
async def async_setup(hass, config):
"""Set up the AirVisual component."""
hass.data[DOMAIN] = {}
hass.data[DOMAIN][DATA_CLIENT] = {}
hass.data[DOMAIN][DATA_LISTENER] = {}
if DOMAIN not in config:
return True
conf = config[DOMAIN]
hass.async_create_task(
hass.config_entries.flow.async_init(
DOMAIN, context={"source": SOURCE_IMPORT}, data=conf
)
)
return True
async def async_setup_entry(hass, config_entry):
"""Set up AirVisual as config entry."""
entry_updates = {}
if not config_entry.unique_id:
# If the config entry doesn't already have a unique ID, set one:
entry_updates["unique_id"] = config_entry.data[CONF_API_KEY]
if not config_entry.options:
# If the config entry doesn't already have any options set, set defaults:
entry_updates["options"] = DEFAULT_OPTIONS
if entry_updates:
hass.config_entries.async_update_entry(config_entry, **entry_updates)
websession = aiohttp_client.async_get_clientsession(hass)
hass.data[DOMAIN][DATA_CLIENT][config_entry.entry_id] = AirVisualData(
hass, Client(websession, api_key=config_entry.data[CONF_API_KEY]), config_entry
)
try:
await hass.data[DOMAIN][DATA_CLIENT][config_entry.entry_id].async_update()
except InvalidKeyError:
_LOGGER.error("Invalid API key provided")
raise ConfigEntryNotReady
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(config_entry, "sensor")
)
async def refresh(event_time):
"""Refresh data from AirVisual."""
await hass.data[DOMAIN][DATA_CLIENT][config_entry.entry_id].async_update()
hass.data[DOMAIN][DATA_LISTENER][config_entry.entry_id] = async_track_time_interval(
hass, refresh, DEFAULT_SCAN_INTERVAL
)
config_entry.add_update_listener(async_update_options)
return True
async def async_unload_entry(hass, config_entry):
"""Unload an AirVisual config entry."""
hass.data[DOMAIN][DATA_CLIENT].pop(config_entry.entry_id)
remove_listener = hass.data[DOMAIN][DATA_LISTENER].pop(config_entry.entry_id)
remove_listener()
await hass.config_entries.async_forward_entry_unload(config_entry, "sensor")
return True
async def async_update_options(hass, config_entry):
"""Handle an options update."""
airvisual = hass.data[DOMAIN][DATA_CLIENT][config_entry.entry_id]
airvisual.async_update_options(config_entry.options)
class AirVisualData:
"""Define a class to manage data from the AirVisual cloud API."""
def __init__(self, hass, client, config_entry):
"""Initialize."""
self._client = client
self._hass = hass
self.data = {}
self.options = config_entry.options
self.geographies = {
async_get_geography_id(geography): geography
for geography in config_entry.data[CONF_GEOGRAPHIES]
}
async def async_update(self):
"""Get new data for all locations from the AirVisual cloud API."""
tasks = []
for geography in self.geographies.values():
if CONF_CITY in geography:
tasks.append(
self._client.api.city(
geography[CONF_CITY],
geography[CONF_STATE],
geography[CONF_COUNTRY],
)
)
else:
tasks.append(
self._client.api.nearest_city(
geography[CONF_LATITUDE], geography[CONF_LONGITUDE],
)
)
results = await asyncio.gather(*tasks, return_exceptions=True)
for geography_id, result in zip(self.geographies, results):
if isinstance(result, AirVisualError):
_LOGGER.error("Error while retrieving data: %s", result)
self.data[geography_id] = {}
continue
self.data[geography_id] = result
_LOGGER.debug("Received new data")
async_dispatcher_send(self._hass, TOPIC_UPDATE)
@callback
def async_update_options(self, options):
"""Update the data manager's options."""
self.options = options
async_dispatcher_send(self._hass, TOPIC_UPDATE)

View File

@@ -0,0 +1,123 @@
"""Define a config flow manager for AirVisual."""
import logging
from pyairvisual import Client
from pyairvisual.errors import InvalidKeyError
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.const import (
CONF_API_KEY,
CONF_LATITUDE,
CONF_LONGITUDE,
CONF_SHOW_ON_MAP,
)
from homeassistant.core import callback
from homeassistant.helpers import aiohttp_client, config_validation as cv
from .const import CONF_GEOGRAPHIES, DOMAIN # pylint: disable=unused-import
_LOGGER = logging.getLogger("homeassistant.components.airvisual")
class AirVisualFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
"""Handle an AirVisual config flow."""
VERSION = 1
CONNECTION_CLASS = config_entries.CONN_CLASS_CLOUD_POLL
@property
def cloud_api_schema(self):
"""Return the data schema for the cloud API."""
return vol.Schema(
{
vol.Required(CONF_API_KEY): str,
vol.Required(
CONF_LATITUDE, default=self.hass.config.latitude
): cv.latitude,
vol.Required(
CONF_LONGITUDE, default=self.hass.config.longitude
): cv.longitude,
}
)
async def _async_set_unique_id(self, unique_id):
"""Set the unique ID of the config flow and abort if it already exists."""
await self.async_set_unique_id(unique_id)
self._abort_if_unique_id_configured()
@callback
async def _show_form(self, errors=None):
"""Show the form to the user."""
return self.async_show_form(
step_id="user", data_schema=self.cloud_api_schema, errors=errors or {},
)
@staticmethod
@callback
def async_get_options_flow(config_entry):
"""Define the config flow to handle options."""
return AirVisualOptionsFlowHandler(config_entry)
async def async_step_import(self, import_config):
"""Import a config entry from configuration.yaml."""
return await self.async_step_user(import_config)
async def async_step_user(self, user_input=None):
"""Handle the start of the config flow."""
if not user_input:
return await self._show_form()
await self._async_set_unique_id(user_input[CONF_API_KEY])
websession = aiohttp_client.async_get_clientsession(self.hass)
client = Client(websession, api_key=user_input[CONF_API_KEY])
try:
await client.api.nearest_city()
except InvalidKeyError:
return await self._show_form(errors={CONF_API_KEY: "invalid_api_key"})
data = {CONF_API_KEY: user_input[CONF_API_KEY]}
if user_input.get(CONF_GEOGRAPHIES):
data[CONF_GEOGRAPHIES] = user_input[CONF_GEOGRAPHIES]
else:
data[CONF_GEOGRAPHIES] = [
{
CONF_LATITUDE: user_input.get(
CONF_LATITUDE, self.hass.config.latitude
),
CONF_LONGITUDE: user_input.get(
CONF_LONGITUDE, self.hass.config.longitude
),
}
]
return self.async_create_entry(
title=f"Cloud API (API key: {user_input[CONF_API_KEY][:4]}...)", data=data
)
class AirVisualOptionsFlowHandler(config_entries.OptionsFlow):
"""Handle an AirVisual options flow."""
def __init__(self, config_entry):
"""Initialize."""
self.config_entry = config_entry
async def async_step_init(self, user_input=None):
"""Manage the options."""
if user_input is not None:
return self.async_create_entry(title="", data=user_input)
return self.async_show_form(
step_id="init",
data_schema=vol.Schema(
{
vol.Required(
CONF_SHOW_ON_MAP,
default=self.config_entry.options.get(CONF_SHOW_ON_MAP),
): bool
}
),
)

View File

@@ -0,0 +1,14 @@
"""Define AirVisual constants."""
from datetime import timedelta
DOMAIN = "airvisual"
CONF_CITY = "city"
CONF_COUNTRY = "country"
CONF_GEOGRAPHIES = "geographies"
DATA_CLIENT = "client"
DEFAULT_SCAN_INTERVAL = timedelta(minutes=10)
TOPIC_UPDATE = f"{DOMAIN}_update"

View File

@@ -1,6 +1,7 @@
{
"domain": "airvisual",
"name": "AirVisual",
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/airvisual",
"requirements": ["pyairvisual==3.0.1"],
"dependencies": [],

View File

@@ -1,27 +1,24 @@
"""Support for AirVisual air quality sensors."""
from datetime import timedelta
from logging import getLogger
from pyairvisual import Client
from pyairvisual.errors import AirVisualError
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import (
ATTR_ATTRIBUTION,
ATTR_LATITUDE,
ATTR_LONGITUDE,
CONF_API_KEY,
ATTR_STATE,
CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
CONCENTRATION_PARTS_PER_BILLION,
CONCENTRATION_PARTS_PER_MILLION,
CONF_LATITUDE,
CONF_LONGITUDE,
CONF_MONITORED_CONDITIONS,
CONF_SCAN_INTERVAL,
CONF_SHOW_ON_MAP,
CONF_STATE,
)
from homeassistant.helpers import aiohttp_client, config_validation as cv
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity import Entity
from homeassistant.util import Throttle
from .const import CONF_CITY, CONF_COUNTRY, DATA_CLIENT, DOMAIN, TOPIC_UPDATE
_LOGGER = getLogger(__name__)
@@ -31,23 +28,19 @@ ATTR_POLLUTANT_SYMBOL = "pollutant_symbol"
ATTR_POLLUTANT_UNIT = "pollutant_unit"
ATTR_REGION = "region"
CONF_CITY = "city"
CONF_COUNTRY = "country"
DEFAULT_ATTRIBUTION = "Data provided by AirVisual"
DEFAULT_SCAN_INTERVAL = timedelta(minutes=10)
MASS_PARTS_PER_MILLION = "ppm"
MASS_PARTS_PER_BILLION = "ppb"
VOLUME_MICROGRAMS_PER_CUBIC_METER = "µg/m3"
SENSOR_TYPE_LEVEL = "air_pollution_level"
SENSOR_TYPE_AQI = "air_quality_index"
SENSOR_TYPE_POLLUTANT = "main_pollutant"
SENSOR_KIND_LEVEL = "air_pollution_level"
SENSOR_KIND_AQI = "air_quality_index"
SENSOR_KIND_POLLUTANT = "main_pollutant"
SENSORS = [
(SENSOR_TYPE_LEVEL, "Air Pollution Level", "mdi:gauge", None),
(SENSOR_TYPE_AQI, "Air Quality Index", "mdi:chart-line", "AQI"),
(SENSOR_TYPE_POLLUTANT, "Main Pollutant", "mdi:chemical-weapon", None),
(SENSOR_KIND_LEVEL, "Air Pollution Level", "mdi:gauge", None),
(SENSOR_KIND_AQI, "Air Quality Index", "mdi:chart-line", "AQI"),
(SENSOR_KIND_POLLUTANT, "Main Pollutant", "mdi:chemical-weapon", None),
]
POLLUTANT_LEVEL_MAPPING = [
@@ -70,112 +63,68 @@ POLLUTANT_LEVEL_MAPPING = [
]
POLLUTANT_MAPPING = {
"co": {"label": "Carbon Monoxide", "unit": MASS_PARTS_PER_MILLION},
"n2": {"label": "Nitrogen Dioxide", "unit": MASS_PARTS_PER_BILLION},
"o3": {"label": "Ozone", "unit": MASS_PARTS_PER_BILLION},
"p1": {"label": "PM10", "unit": VOLUME_MICROGRAMS_PER_CUBIC_METER},
"p2": {"label": "PM2.5", "unit": VOLUME_MICROGRAMS_PER_CUBIC_METER},
"s2": {"label": "Sulfur Dioxide", "unit": MASS_PARTS_PER_BILLION},
"co": {"label": "Carbon Monoxide", "unit": CONCENTRATION_PARTS_PER_MILLION},
"n2": {"label": "Nitrogen Dioxide", "unit": CONCENTRATION_PARTS_PER_BILLION},
"o3": {"label": "Ozone", "unit": CONCENTRATION_PARTS_PER_BILLION},
"p1": {"label": "PM10", "unit": CONCENTRATION_MICROGRAMS_PER_CUBIC_METER},
"p2": {"label": "PM2.5", "unit": CONCENTRATION_MICROGRAMS_PER_CUBIC_METER},
"s2": {"label": "Sulfur Dioxide", "unit": CONCENTRATION_PARTS_PER_BILLION},
}
SENSOR_LOCALES = {"cn": "Chinese", "us": "U.S."}
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
{
vol.Required(CONF_API_KEY): cv.string,
vol.Required(CONF_MONITORED_CONDITIONS, default=list(SENSOR_LOCALES)): vol.All(
cv.ensure_list, [vol.In(SENSOR_LOCALES)]
),
vol.Inclusive(CONF_CITY, "city"): cv.string,
vol.Inclusive(CONF_COUNTRY, "city"): cv.string,
vol.Inclusive(CONF_LATITUDE, "coords"): cv.latitude,
vol.Inclusive(CONF_LONGITUDE, "coords"): cv.longitude,
vol.Optional(CONF_SHOW_ON_MAP, default=True): cv.boolean,
vol.Inclusive(CONF_STATE, "city"): cv.string,
vol.Optional(CONF_SCAN_INTERVAL, default=DEFAULT_SCAN_INTERVAL): cv.time_period,
}
)
async def async_setup_entry(hass, entry, async_add_entities):
"""Set up AirVisual sensors based on a config entry."""
airvisual = hass.data[DOMAIN][DATA_CLIENT][entry.entry_id]
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Configure the platform and add the sensors."""
city = config.get(CONF_CITY)
state = config.get(CONF_STATE)
country = config.get(CONF_COUNTRY)
latitude = config.get(CONF_LATITUDE, hass.config.latitude)
longitude = config.get(CONF_LONGITUDE, hass.config.longitude)
websession = aiohttp_client.async_get_clientsession(hass)
if city and state and country:
_LOGGER.debug(
"Using city, state, and country: %s, %s, %s", city, state, country
)
location_id = ",".join((city, state, country))
data = AirVisualData(
Client(websession, api_key=config[CONF_API_KEY]),
city=city,
state=state,
country=country,
show_on_map=config[CONF_SHOW_ON_MAP],
scan_interval=config[CONF_SCAN_INTERVAL],
)
else:
_LOGGER.debug("Using latitude and longitude: %s, %s", latitude, longitude)
location_id = ",".join((str(latitude), str(longitude)))
data = AirVisualData(
Client(websession, api_key=config[CONF_API_KEY]),
latitude=latitude,
longitude=longitude,
show_on_map=config[CONF_SHOW_ON_MAP],
scan_interval=config[CONF_SCAN_INTERVAL],
)
await data.async_update()
sensors = []
for locale in config[CONF_MONITORED_CONDITIONS]:
for kind, name, icon, unit in SENSORS:
sensors.append(
AirVisualSensor(data, kind, name, icon, unit, locale, location_id)
)
async_add_entities(sensors, True)
async_add_entities(
[
AirVisualSensor(airvisual, kind, name, icon, unit, locale, geography_id)
for geography_id in airvisual.data
for locale in SENSOR_LOCALES
for kind, name, icon, unit in SENSORS
],
True,
)
class AirVisualSensor(Entity):
"""Define an AirVisual sensor."""
def __init__(self, airvisual, kind, name, icon, unit, locale, location_id):
def __init__(self, airvisual, kind, name, icon, unit, locale, geography_id):
"""Initialize."""
self._attrs = {ATTR_ATTRIBUTION: DEFAULT_ATTRIBUTION}
self._airvisual = airvisual
self._async_unsub_dispatcher_connects = []
self._geography_id = geography_id
self._icon = icon
self._kind = kind
self._locale = locale
self._location_id = location_id
self._name = name
self._state = None
self._type = kind
self._unit = unit
self.airvisual = airvisual
@property
def device_state_attributes(self):
"""Return the device state attributes."""
if self.airvisual.show_on_map:
self._attrs[ATTR_LATITUDE] = self.airvisual.latitude
self._attrs[ATTR_LONGITUDE] = self.airvisual.longitude
else:
self._attrs["lati"] = self.airvisual.latitude
self._attrs["long"] = self.airvisual.longitude
return self._attrs
self._attrs = {
ATTR_ATTRIBUTION: DEFAULT_ATTRIBUTION,
ATTR_CITY: airvisual.data[geography_id].get(CONF_CITY),
ATTR_STATE: airvisual.data[geography_id].get(CONF_STATE),
ATTR_COUNTRY: airvisual.data[geography_id].get(CONF_COUNTRY),
}
@property
def available(self):
"""Return True if entity is available."""
return bool(self.airvisual.pollution_info)
try:
return bool(
self._airvisual.data[self._geography_id]["current"]["pollution"]
)
except KeyError:
return False
@property
def device_state_attributes(self):
"""Return the device state attributes."""
return self._attrs
@property
def icon(self):
@@ -185,7 +134,7 @@ class AirVisualSensor(Entity):
@property
def name(self):
"""Return the name."""
return "{0} {1}".format(SENSOR_LOCALES[self._locale], self._name)
return f"{SENSOR_LOCALES[self._locale]} {self._name}"
@property
def state(self):
@@ -195,22 +144,33 @@ class AirVisualSensor(Entity):
@property
def unique_id(self):
"""Return a unique, Home Assistant friendly identifier for this entity."""
return f"{self._location_id}_{self._locale}_{self._type}"
return f"{self._geography_id}_{self._locale}_{self._kind}"
@property
def unit_of_measurement(self):
"""Return the unit the value is expressed in."""
return self._unit
async def async_added_to_hass(self):
"""Register callbacks."""
@callback
def update():
"""Update the state."""
self.async_schedule_update_ha_state(True)
self._async_unsub_dispatcher_connects.append(
async_dispatcher_connect(self.hass, TOPIC_UPDATE, update)
)
async def async_update(self):
"""Update the sensor."""
await self.airvisual.async_update()
data = self.airvisual.pollution_info
if not data:
try:
data = self._airvisual.data[self._geography_id]["current"]["pollution"]
except KeyError:
return
if self._type == SENSOR_TYPE_LEVEL:
if self._kind == SENSOR_KIND_LEVEL:
aqi = data[f"aqi{self._locale}"]
[level] = [
i
@@ -219,9 +179,9 @@ class AirVisualSensor(Entity):
]
self._state = level["label"]
self._icon = level["icon"]
elif self._type == SENSOR_TYPE_AQI:
elif self._kind == SENSOR_KIND_AQI:
self._state = data[f"aqi{self._locale}"]
elif self._type == SENSOR_TYPE_POLLUTANT:
elif self._kind == SENSOR_KIND_POLLUTANT:
symbol = data[f"main{self._locale}"]
self._state = POLLUTANT_MAPPING[symbol]["label"]
self._attrs.update(
@@ -231,43 +191,21 @@ class AirVisualSensor(Entity):
}
)
class AirVisualData:
"""Define an object to hold sensor data."""
def __init__(self, client, **kwargs):
"""Initialize."""
self._client = client
self.city = kwargs.get(CONF_CITY)
self.country = kwargs.get(CONF_COUNTRY)
self.latitude = kwargs.get(CONF_LATITUDE)
self.longitude = kwargs.get(CONF_LONGITUDE)
self.pollution_info = {}
self.show_on_map = kwargs.get(CONF_SHOW_ON_MAP)
self.state = kwargs.get(CONF_STATE)
self.async_update = Throttle(kwargs[CONF_SCAN_INTERVAL])(self._async_update)
async def _async_update(self):
"""Update AirVisual data."""
try:
if self.city and self.state and self.country:
resp = await self._client.api.city(self.city, self.state, self.country)
self.longitude, self.latitude = resp["location"]["coordinates"]
geography = self._airvisual.geographies[self._geography_id]
if CONF_LATITUDE in geography:
if self._airvisual.options[CONF_SHOW_ON_MAP]:
self._attrs[ATTR_LATITUDE] = geography[CONF_LATITUDE]
self._attrs[ATTR_LONGITUDE] = geography[CONF_LONGITUDE]
self._attrs.pop("lati", None)
self._attrs.pop("long", None)
else:
resp = await self._client.api.nearest_city(
self.latitude, self.longitude
)
self._attrs["lati"] = geography[CONF_LATITUDE]
self._attrs["long"] = geography[CONF_LONGITUDE]
self._attrs.pop(ATTR_LATITUDE, None)
self._attrs.pop(ATTR_LONGITUDE, None)
_LOGGER.debug("New data retrieved: %s", resp)
self.pollution_info = resp["current"]["pollution"]
except (KeyError, AirVisualError) as err:
if self.city and self.state and self.country:
location = (self.city, self.state, self.country)
else:
location = (self.latitude, self.longitude)
_LOGGER.error("Can't retrieve data for location: %s (%s)", location, err)
self.pollution_info = {}
async def async_will_remove_from_hass(self) -> None:
"""Disconnect dispatcher listener when removed."""
for cancel in self._async_unsub_dispatcher_connects:
cancel()
self._async_unsub_dispatcher_connects = []

View File

@@ -0,0 +1,33 @@
{
"config": {
"title": "AirVisual",
"step": {
"user": {
"title": "Configure AirVisual",
"description": "Monitor air quality in a geographical location.",
"data": {
"api_key": "API Key",
"latitude": "Latitude",
"longitude": "Longitude"
}
}
},
"error": {
"invalid_api_key": "Invalid API key"
},
"abort": {
"already_configured": "This API key is already in use."
}
},
"options": {
"step": {
"init": {
"title": "Configure AirVisual",
"description": "Set various options for the AirVisual integration.",
"data": {
"show_on_map": "Show monitored geography on the map"
}
}
}
}
}

View File

@@ -53,9 +53,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
except (TypeError, KeyError, NameError, ValueError) as ex:
_LOGGER.error("%s", ex)
hass.components.persistent_notification.create(
"Error: {}<br />"
"You will need to restart hass after fixing."
"".format(ex),
"Error: {ex}<br />You will need to restart hass after fixing.",
title=NOTIFICATION_TITLE,
notification_id=NOTIFICATION_ID,
)

View File

@@ -177,7 +177,7 @@ class AlarmDecoderAlarmPanel(AlarmControlPanel):
def alarm_arm_night(self, code=None):
"""Send arm night command."""
if code:
self.hass.data[DATA_AD].send(f"{code!s}33")
self.hass.data[DATA_AD].send(f"{code!s}7")
def alarm_toggle_chime(self, code=None):
"""Send toggle chime command."""

View File

@@ -31,7 +31,6 @@ from homeassistant.util.dt import now
_LOGGER = logging.getLogger(__name__)
DOMAIN = "alert"
ENTITY_ID_FORMAT = DOMAIN + ".{}"
CONF_CAN_ACK = "can_acknowledge"
CONF_NOTIFIERS = "notifiers"
@@ -200,7 +199,7 @@ class Alert(ToggleEntity):
self._ack = False
self._cancel = None
self._send_done_message = False
self.entity_id = ENTITY_ID_FORMAT.format(entity_id)
self.entity_id = f"{DOMAIN}.{entity_id}"
event.async_track_state_change(
hass, watched_entity_id, self.watched_entity_change

View File

@@ -4,6 +4,7 @@ import logging
import voluptuous as vol
from homeassistant.const import CONF_NAME
from homeassistant.core import callback
from homeassistant.helpers import config_validation as cv, entityfilter
from . import flash_briefings, intent, smart_home_http
@@ -23,6 +24,7 @@ from .const import (
CONF_TITLE,
CONF_UID,
DOMAIN,
EVENT_ALEXA_SMART_HOME,
)
_LOGGER = logging.getLogger(__name__)
@@ -80,7 +82,37 @@ CONFIG_SCHEMA = vol.Schema(
async def async_setup(hass, config):
"""Activate the Alexa component."""
config = config.get(DOMAIN, {})
@callback
def async_describe_logbook_event(event):
"""Describe a logbook event."""
data = event.data
entity_id = data["request"].get("entity_id")
if entity_id:
state = hass.states.get(entity_id)
name = state.name if state else entity_id
message = f"send command {data['request']['namespace']}/{data['request']['name']} for {name}"
else:
message = (
f"send command {data['request']['namespace']}/{data['request']['name']}"
)
return {
"name": "Amazon Alexa",
"message": message,
"entity_id": entity_id,
}
hass.components.logbook.async_describe_event(
DOMAIN, EVENT_ALEXA_SMART_HOME, async_describe_logbook_event
)
if DOMAIN not in config:
return True
config = config[DOMAIN]
flash_briefings_config = config.get(CONF_FLASH_BRIEFINGS)
intent.async_setup(hass)

View File

@@ -1,6 +1,5 @@
"""Alexa capabilities."""
import logging
import math
from homeassistant.components import (
cover,
@@ -8,6 +7,7 @@ from homeassistant.components import (
image_processing,
input_number,
light,
timer,
vacuum,
)
from homeassistant.components.alarm_control_panel import ATTR_CODE_FORMAT, FORMAT_NUMBER
@@ -26,6 +26,7 @@ from homeassistant.const import (
STATE_ALARM_ARMED_CUSTOM_BYPASS,
STATE_ALARM_ARMED_HOME,
STATE_ALARM_ARMED_NIGHT,
STATE_IDLE,
STATE_LOCKED,
STATE_OFF,
STATE_ON,
@@ -227,7 +228,6 @@ class AlexaCapability:
"""Return properties serialized for an API response."""
for prop in self.properties_supported():
prop_name = prop["name"]
# pylint: disable=assignment-from-no-return
prop_value = self.get_property(prop_name)
if prop_value is not None:
result = {
@@ -365,6 +365,10 @@ class AlexaPowerController(AlexaCapability):
if self.entity.domain == climate.DOMAIN:
is_on = self.entity.state != climate.HVAC_MODE_OFF
elif self.entity.domain == vacuum.DOMAIN:
is_on = self.entity.state == vacuum.STATE_CLEANING
elif self.entity.domain == timer.DOMAIN:
is_on = self.entity.state != STATE_IDLE
else:
is_on = self.entity.state != STATE_OFF
@@ -670,11 +674,8 @@ class AlexaSpeaker(AlexaCapability):
current_level = self.entity.attributes.get(
media_player.ATTR_MEDIA_VOLUME_LEVEL
)
try:
current = math.floor(int(current_level * 100))
except ZeroDivisionError:
current = 0
return current
if current_level is not None:
return round(float(current_level) * 100)
if name == "muted":
return bool(

View File

@@ -53,7 +53,7 @@ class AbstractConfig(ABC):
)
try:
await self._unsub_proactive_report
except Exception: # pylint: disable=broad-except
except Exception:
self._unsub_proactive_report = None
raise

View File

@@ -6,6 +6,7 @@ from homeassistant.components.climate import const as climate
from homeassistant.const import TEMP_CELSIUS, TEMP_FAHRENHEIT
DOMAIN = "alexa"
EVENT_ALEXA_SMART_HOME = "alexa_smart_home"
# Flash briefing constants
CONF_UID = "uid"

View File

@@ -400,7 +400,10 @@ class CoverCapabilities(AlexaEntity):
def interfaces(self):
"""Yield the supported interfaces."""
yield AlexaPowerController(self.entity)
device_class = self.entity.attributes.get(ATTR_DEVICE_CLASS)
if device_class != cover.DEVICE_CLASS_GARAGE:
yield AlexaPowerController(self.entity)
supported = self.entity.attributes.get(ATTR_SUPPORTED_FEATURES, 0)
if supported & cover.SUPPORT_SET_POSITION:
yield AlexaRangeController(
@@ -724,6 +727,7 @@ class TimerCapabilities(AlexaEntity):
def interfaces(self):
"""Yield the supported interfaces."""
yield AlexaTimeHoldController(self.entity, allow_remote_resume=True)
yield AlexaPowerController(self.entity)
yield Alexa(self.entity)
@@ -738,8 +742,11 @@ class VacuumCapabilities(AlexaEntity):
def interfaces(self):
"""Yield the supported interfaces."""
supported = self.entity.attributes.get(ATTR_SUPPORTED_FEATURES, 0)
if (supported & vacuum.SUPPORT_TURN_ON) and (
supported & vacuum.SUPPORT_TURN_OFF
if (
(supported & vacuum.SUPPORT_TURN_ON) or (supported & vacuum.SUPPORT_START)
) and (
(supported & vacuum.SUPPORT_TURN_OFF)
or (supported & vacuum.SUPPORT_RETURN_HOME)
):
yield AlexaPowerController(self.entity)

View File

@@ -121,6 +121,12 @@ async def async_api_turn_on(hass, config, directive, context):
service = SERVICE_TURN_ON
if domain == cover.DOMAIN:
service = cover.SERVICE_OPEN_COVER
elif domain == vacuum.DOMAIN:
supported = entity.attributes.get(ATTR_SUPPORTED_FEATURES, 0)
if not supported & vacuum.SUPPORT_TURN_ON and supported & vacuum.SUPPORT_START:
service = vacuum.SERVICE_START
elif domain == timer.DOMAIN:
service = timer.SERVICE_START
elif domain == media_player.DOMAIN:
supported = entity.attributes.get(ATTR_SUPPORTED_FEATURES, 0)
power_features = media_player.SUPPORT_TURN_ON | media_player.SUPPORT_TURN_OFF
@@ -149,6 +155,15 @@ async def async_api_turn_off(hass, config, directive, context):
service = SERVICE_TURN_OFF
if entity.domain == cover.DOMAIN:
service = cover.SERVICE_CLOSE_COVER
elif domain == vacuum.DOMAIN:
supported = entity.attributes.get(ATTR_SUPPORTED_FEATURES, 0)
if (
not supported & vacuum.SUPPORT_TURN_OFF
and supported & vacuum.SUPPORT_RETURN_HOME
):
service = vacuum.SERVICE_RETURN_TO_BASE
elif domain == timer.DOMAIN:
service = timer.SERVICE_CANCEL
elif domain == media_player.DOMAIN:
supported = entity.attributes.get(ATTR_SUPPORTED_FEATURES, 0)
power_features = media_player.SUPPORT_TURN_ON | media_player.SUPPORT_TURN_OFF
@@ -478,8 +493,8 @@ async def async_api_select_input(hass, config, directive, context):
media_input = source
break
else:
msg = "failed to map input {} to a media source on {}".format(
media_input, entity.entity_id
msg = (
f"failed to map input {media_input} to a media source on {entity.entity_id}"
)
raise AlexaInvalidValueError(msg)
@@ -1225,7 +1240,7 @@ async def async_api_adjust_range(hass, config, directive, context):
service = SERVICE_SET_COVER_POSITION
current = entity.attributes.get(cover.ATTR_POSITION)
if not current:
msg = "Unable to determine {} current position".format(entity.entity_id)
msg = f"Unable to determine {entity.entity_id} current position"
raise AlexaInvalidValueError(msg)
position = response_value = min(100, max(0, range_delta + current))
if position == 100:
@@ -1241,9 +1256,7 @@ async def async_api_adjust_range(hass, config, directive, context):
service = SERVICE_SET_COVER_TILT_POSITION
current = entity.attributes.get(cover.ATTR_TILT_POSITION)
if not current:
msg = "Unable to determine {} current tilt position".format(
entity.entity_id
)
msg = f"Unable to determine {entity.entity_id} current tilt position"
raise AlexaInvalidValueError(msg)
tilt_position = response_value = min(100, max(0, range_delta + current))
if tilt_position == 100:
@@ -1439,9 +1452,7 @@ async def async_api_set_eq_mode(hass, config, directive, context):
if sound_mode_list and mode.lower() in sound_mode_list:
data[media_player.const.ATTR_SOUND_MODE] = mode.lower()
else:
msg = "failed to map sound mode {} to a mode on {}".format(
mode, entity.entity_id
)
msg = f"failed to map sound mode {mode} to a mode on {entity.entity_id}"
raise AlexaInvalidValueError(msg)
await hass.services.async_call(

View File

@@ -4,5 +4,6 @@
"documentation": "https://www.home-assistant.io/integrations/alexa",
"requirements": [],
"dependencies": ["http"],
"after_dependencies": ["logbook"],
"codeowners": ["@home-assistant/cloud", "@ochlocracy"]
}

View File

@@ -3,15 +3,13 @@ import logging
import homeassistant.core as ha
from .const import API_DIRECTIVE, API_HEADER
from .const import API_DIRECTIVE, API_HEADER, EVENT_ALEXA_SMART_HOME
from .errors import AlexaBridgeUnreachableError, AlexaError
from .handlers import HANDLERS
from .messages import AlexaDirective
_LOGGER = logging.getLogger(__name__)
EVENT_ALEXA_SMART_HOME = "alexa_smart_home"
async def async_handle_message(hass, config, request, context=None, enabled=True):
"""Handle incoming API messages.

View File

@@ -26,6 +26,9 @@ async def async_enable_proactive_mode(hass, smart_home_config):
await smart_home_config.async_get_access_token()
async def async_entity_state_listener(changed_entity, old_state, new_state):
if not hass.is_running:
return
if not new_state:
return

View File

@@ -87,7 +87,6 @@ class AlmondFlowHandler(config_entry_oauth2_flow.AbstractOAuth2FlowHandler):
)
return self.async_abort(reason="cannot_connect")
# pylint: disable=invalid-name
self.CONNECTION_CLASS = config_entries.CONN_CLASS_LOCAL_POLL
return self.async_create_entry(

View File

@@ -1,5 +1,8 @@
{
"config": {
"abort": {
"already_configured": "Aquesta clau d'aplicaci\u00f3 ja est\u00e0 en \u00fas."
},
"error": {
"identifier_exists": "Clau d'aplicaci\u00f3 i/o clau API ja registrada",
"invalid_key": "Clau API i/o clau d'aplicaci\u00f3 inv\u00e0lida/es",

View File

@@ -1,5 +1,8 @@
{
"config": {
"abort": {
"already_configured": "Denne appn\u00f8gle er allerede i brug."
},
"error": {
"identifier_exists": "Applikationsn\u00f8gle og/eller API n\u00f8gle er allerede registreret",
"invalid_key": "Ugyldig API n\u00f8gle og/eller applikationsn\u00f8gle",

View File

@@ -1,5 +1,8 @@
{
"config": {
"abort": {
"already_configured": "Dieser App-Schl\u00fcssel wird bereits verwendet."
},
"error": {
"identifier_exists": "Anwendungsschl\u00fcssel und / oder API-Schl\u00fcssel bereits registriert",
"invalid_key": "Ung\u00fcltiger API Key und / oder Anwendungsschl\u00fcssel",

View File

@@ -1,5 +1,8 @@
{
"config": {
"abort": {
"already_configured": "This app key is already in use."
},
"error": {
"identifier_exists": "Application Key and/or API Key already registered",
"invalid_key": "Invalid API Key and/or Application Key",

View File

@@ -1,5 +1,8 @@
{
"config": {
"abort": {
"already_configured": "Esta clave API ya est\u00e1 en uso."
},
"error": {
"identifier_exists": "La clave API y/o la clave de aplicaci\u00f3n ya est\u00e1 registrada",
"invalid_key": "Clave API y/o clave de aplicaci\u00f3n no v\u00e1lida",

View File

@@ -1,5 +1,8 @@
{
"config": {
"abort": {
"already_configured": "Questa chiave dell'app \u00e8 gi\u00e0 in uso."
},
"error": {
"identifier_exists": "API Key e/o Application Key gi\u00e0 registrata",
"invalid_key": "API Key e/o Application Key non valida",

View File

@@ -1,5 +1,8 @@
{
"config": {
"abort": {
"already_configured": "\uc774 \uc571 \ud0a4\ub294 \uc774\ubbf8 \uc0ac\uc6a9 \uc911\uc785\ub2c8\ub2e4."
},
"error": {
"identifier_exists": "\uc560\ud50c\ub9ac\ucf00\uc774\uc158 \ud0a4 \ud639\uc740 API \ud0a4\uac00 \uc774\ubbf8 \ub4f1\ub85d\ub418\uc5c8\uc2b5\ub2c8\ub2e4",
"invalid_key": "\uc560\ud50c\ub9ac\ucf00\uc774\uc158 \ud0a4 \ud639\uc740 API \ud0a4\uac00 \uc798\ubabb\ub418\uc5c8\uc2b5\ub2c8\ub2e4",

View File

@@ -1,5 +1,8 @@
{
"config": {
"abort": {
"already_configured": "D\u00ebsen App Schl\u00ebssel g\u00ebtt scho benotzt"
},
"error": {
"identifier_exists": "Applikatioun's Schl\u00ebssel an/oder API Schl\u00ebssel ass scho registr\u00e9iert",
"invalid_key": "Ong\u00ebltegen API Schl\u00ebssel an/oder Applikatioun's Schl\u00ebssel",

View File

@@ -1,5 +1,8 @@
{
"config": {
"abort": {
"already_configured": "Denne app n\u00f8kkelen er allerede i bruk."
},
"error": {
"identifier_exists": "Programn\u00f8kkel og/eller API-n\u00f8kkel er allerede registrert",
"invalid_key": "Ugyldig API-n\u00f8kkel og/eller programn\u00f8kkel",

View File

@@ -1,5 +1,8 @@
{
"config": {
"abort": {
"already_configured": "Ten klucz aplikacji jest ju\u017c w u\u017cyciu."
},
"error": {
"identifier_exists": "Klucz aplikacji i/lub klucz API ju\u017c jest zarejestrowany.",
"invalid_key": "Nieprawid\u0142owy klucz API i/lub klucz aplikacji",

View File

@@ -1,5 +1,8 @@
{
"config": {
"abort": {
"already_configured": "\u042d\u0442\u043e\u0442 \u043a\u043b\u044e\u0447 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0443\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f."
},
"error": {
"identifier_exists": "\u041a\u043b\u044e\u0447 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438/\u0438\u043b\u0438 \u043a\u043b\u044e\u0447 API \u0443\u0436\u0435 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d.",
"invalid_key": "\u041d\u0435\u0432\u0435\u0440\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 API \u0438/\u0438\u043b\u0438 \u043a\u043b\u044e\u0447 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.",

View File

@@ -1,5 +1,8 @@
{
"config": {
"abort": {
"already_configured": "\u6b64\u61c9\u7528\u7a0b\u5f0f\u5bc6\u9470\u5df2\u88ab\u4f7f\u7528\u3002"
},
"error": {
"identifier_exists": "API \u5bc6\u9470\u53ca/\u6216\u61c9\u7528\u5bc6\u9470\u5df2\u8a3b\u518a",
"invalid_key": "API \u5bc6\u9470\u53ca/\u6216\u61c9\u7528\u5bc6\u9470\u7121\u6548",

View File

@@ -10,8 +10,11 @@ from homeassistant.config_entries import SOURCE_IMPORT
from homeassistant.const import (
ATTR_LOCATION,
ATTR_NAME,
CONCENTRATION_PARTS_PER_MILLION,
CONF_API_KEY,
EVENT_HOMEASSISTANT_STOP,
SPEED_MILES_PER_HOUR,
UNIT_PERCENTAGE,
)
from homeassistant.core import callback
from homeassistant.exceptions import ConfigEntryNotReady
@@ -23,14 +26,12 @@ from homeassistant.helpers.dispatcher import (
from homeassistant.helpers.entity import Entity
from homeassistant.helpers.event import async_call_later
from .config_flow import configured_instances
from .const import (
ATTR_LAST_DATA,
ATTR_MONITORED_CONDITIONS,
CONF_APP_KEY,
DATA_CLIENT,
DOMAIN,
TOPIC_UPDATE,
TYPE_BINARY_SENSOR,
TYPE_SENSOR,
)
@@ -148,26 +149,26 @@ SENSOR_TYPES = {
TYPE_BATT8: ("Battery 8", None, TYPE_BINARY_SENSOR, "battery"),
TYPE_BATT9: ("Battery 9", None, TYPE_BINARY_SENSOR, "battery"),
TYPE_BATTOUT: ("Battery", None, TYPE_BINARY_SENSOR, "battery"),
TYPE_CO2: ("co2", "ppm", TYPE_SENSOR, None),
TYPE_CO2: ("co2", CONCENTRATION_PARTS_PER_MILLION, TYPE_SENSOR, None),
TYPE_DAILYRAININ: ("Daily Rain", "in", TYPE_SENSOR, None),
TYPE_DEWPOINT: ("Dew Point", "°F", TYPE_SENSOR, "temperature"),
TYPE_EVENTRAININ: ("Event Rain", "in", TYPE_SENSOR, None),
TYPE_FEELSLIKE: ("Feels Like", "°F", TYPE_SENSOR, "temperature"),
TYPE_HOURLYRAININ: ("Hourly Rain Rate", "in/hr", TYPE_SENSOR, None),
TYPE_HUMIDITY10: ("Humidity 10", "%", TYPE_SENSOR, "humidity"),
TYPE_HUMIDITY1: ("Humidity 1", "%", TYPE_SENSOR, "humidity"),
TYPE_HUMIDITY2: ("Humidity 2", "%", TYPE_SENSOR, "humidity"),
TYPE_HUMIDITY3: ("Humidity 3", "%", TYPE_SENSOR, "humidity"),
TYPE_HUMIDITY4: ("Humidity 4", "%", TYPE_SENSOR, "humidity"),
TYPE_HUMIDITY5: ("Humidity 5", "%", TYPE_SENSOR, "humidity"),
TYPE_HUMIDITY6: ("Humidity 6", "%", TYPE_SENSOR, "humidity"),
TYPE_HUMIDITY7: ("Humidity 7", "%", TYPE_SENSOR, "humidity"),
TYPE_HUMIDITY8: ("Humidity 8", "%", TYPE_SENSOR, "humidity"),
TYPE_HUMIDITY9: ("Humidity 9", "%", TYPE_SENSOR, "humidity"),
TYPE_HUMIDITY: ("Humidity", "%", TYPE_SENSOR, "humidity"),
TYPE_HUMIDITYIN: ("Humidity In", "%", TYPE_SENSOR, "humidity"),
TYPE_HUMIDITY10: ("Humidity 10", UNIT_PERCENTAGE, TYPE_SENSOR, "humidity"),
TYPE_HUMIDITY1: ("Humidity 1", UNIT_PERCENTAGE, TYPE_SENSOR, "humidity"),
TYPE_HUMIDITY2: ("Humidity 2", UNIT_PERCENTAGE, TYPE_SENSOR, "humidity"),
TYPE_HUMIDITY3: ("Humidity 3", UNIT_PERCENTAGE, TYPE_SENSOR, "humidity"),
TYPE_HUMIDITY4: ("Humidity 4", UNIT_PERCENTAGE, TYPE_SENSOR, "humidity"),
TYPE_HUMIDITY5: ("Humidity 5", UNIT_PERCENTAGE, TYPE_SENSOR, "humidity"),
TYPE_HUMIDITY6: ("Humidity 6", UNIT_PERCENTAGE, TYPE_SENSOR, "humidity"),
TYPE_HUMIDITY7: ("Humidity 7", UNIT_PERCENTAGE, TYPE_SENSOR, "humidity"),
TYPE_HUMIDITY8: ("Humidity 8", UNIT_PERCENTAGE, TYPE_SENSOR, "humidity"),
TYPE_HUMIDITY9: ("Humidity 9", UNIT_PERCENTAGE, TYPE_SENSOR, "humidity"),
TYPE_HUMIDITY: ("Humidity", UNIT_PERCENTAGE, TYPE_SENSOR, "humidity"),
TYPE_HUMIDITYIN: ("Humidity In", UNIT_PERCENTAGE, TYPE_SENSOR, "humidity"),
TYPE_LASTRAIN: ("Last Rain", None, TYPE_SENSOR, "timestamp"),
TYPE_MAXDAILYGUST: ("Max Gust", "mph", TYPE_SENSOR, None),
TYPE_MAXDAILYGUST: ("Max Gust", SPEED_MILES_PER_HOUR, TYPE_SENSOR, None),
TYPE_MONTHLYRAININ: ("Monthly Rain", "in", TYPE_SENSOR, None),
TYPE_RELAY10: ("Relay 10", None, TYPE_BINARY_SENSOR, "connectivity"),
TYPE_RELAY1: ("Relay 1", None, TYPE_BINARY_SENSOR, "connectivity"),
@@ -179,16 +180,16 @@ SENSOR_TYPES = {
TYPE_RELAY7: ("Relay 7", None, TYPE_BINARY_SENSOR, "connectivity"),
TYPE_RELAY8: ("Relay 8", None, TYPE_BINARY_SENSOR, "connectivity"),
TYPE_RELAY9: ("Relay 9", None, TYPE_BINARY_SENSOR, "connectivity"),
TYPE_SOILHUM10: ("Soil Humidity 10", "%", TYPE_SENSOR, "humidity"),
TYPE_SOILHUM1: ("Soil Humidity 1", "%", TYPE_SENSOR, "humidity"),
TYPE_SOILHUM2: ("Soil Humidity 2", "%", TYPE_SENSOR, "humidity"),
TYPE_SOILHUM3: ("Soil Humidity 3", "%", TYPE_SENSOR, "humidity"),
TYPE_SOILHUM4: ("Soil Humidity 4", "%", TYPE_SENSOR, "humidity"),
TYPE_SOILHUM5: ("Soil Humidity 5", "%", TYPE_SENSOR, "humidity"),
TYPE_SOILHUM6: ("Soil Humidity 6", "%", TYPE_SENSOR, "humidity"),
TYPE_SOILHUM7: ("Soil Humidity 7", "%", TYPE_SENSOR, "humidity"),
TYPE_SOILHUM8: ("Soil Humidity 8", "%", TYPE_SENSOR, "humidity"),
TYPE_SOILHUM9: ("Soil Humidity 9", "%", TYPE_SENSOR, "humidity"),
TYPE_SOILHUM10: ("Soil Humidity 10", UNIT_PERCENTAGE, TYPE_SENSOR, "humidity"),
TYPE_SOILHUM1: ("Soil Humidity 1", UNIT_PERCENTAGE, TYPE_SENSOR, "humidity"),
TYPE_SOILHUM2: ("Soil Humidity 2", UNIT_PERCENTAGE, TYPE_SENSOR, "humidity"),
TYPE_SOILHUM3: ("Soil Humidity 3", UNIT_PERCENTAGE, TYPE_SENSOR, "humidity"),
TYPE_SOILHUM4: ("Soil Humidity 4", UNIT_PERCENTAGE, TYPE_SENSOR, "humidity"),
TYPE_SOILHUM5: ("Soil Humidity 5", UNIT_PERCENTAGE, TYPE_SENSOR, "humidity"),
TYPE_SOILHUM6: ("Soil Humidity 6", UNIT_PERCENTAGE, TYPE_SENSOR, "humidity"),
TYPE_SOILHUM7: ("Soil Humidity 7", UNIT_PERCENTAGE, TYPE_SENSOR, "humidity"),
TYPE_SOILHUM8: ("Soil Humidity 8", UNIT_PERCENTAGE, TYPE_SENSOR, "humidity"),
TYPE_SOILHUM9: ("Soil Humidity 9", UNIT_PERCENTAGE, TYPE_SENSOR, "humidity"),
TYPE_SOILTEMP10F: ("Soil Temp 10", "°F", TYPE_SENSOR, "temperature"),
TYPE_SOILTEMP1F: ("Soil Temp 1", "°F", TYPE_SENSOR, "temperature"),
TYPE_SOILTEMP2F: ("Soil Temp 2", "°F", TYPE_SENSOR, "temperature"),
@@ -218,12 +219,12 @@ SENSOR_TYPES = {
TYPE_WEEKLYRAININ: ("Weekly Rain", "in", TYPE_SENSOR, None),
TYPE_WINDDIR: ("Wind Dir", "°", TYPE_SENSOR, None),
TYPE_WINDDIR_AVG10M: ("Wind Dir Avg 10m", "°", TYPE_SENSOR, None),
TYPE_WINDDIR_AVG2M: ("Wind Dir Avg 2m", "mph", TYPE_SENSOR, None),
TYPE_WINDDIR_AVG2M: ("Wind Dir Avg 2m", SPEED_MILES_PER_HOUR, TYPE_SENSOR, None),
TYPE_WINDGUSTDIR: ("Gust Dir", "°", TYPE_SENSOR, None),
TYPE_WINDGUSTMPH: ("Wind Gust", "mph", TYPE_SENSOR, None),
TYPE_WINDSPDMPH_AVG10M: ("Wind Avg 10m", "mph", TYPE_SENSOR, None),
TYPE_WINDSPDMPH_AVG2M: ("Wind Avg 2m", "mph", TYPE_SENSOR, None),
TYPE_WINDSPEEDMPH: ("Wind Speed", "mph", TYPE_SENSOR, None),
TYPE_WINDGUSTMPH: ("Wind Gust", SPEED_MILES_PER_HOUR, TYPE_SENSOR, None),
TYPE_WINDSPDMPH_AVG10M: ("Wind Avg 10m", SPEED_MILES_PER_HOUR, TYPE_SENSOR, None),
TYPE_WINDSPDMPH_AVG2M: ("Wind Avg 2m", SPEED_MILES_PER_HOUR, TYPE_SENSOR, None),
TYPE_WINDSPEEDMPH: ("Wind Speed", SPEED_MILES_PER_HOUR, TYPE_SENSOR, None),
TYPE_YEARLYRAININ: ("Yearly Rain", "in", TYPE_SENSOR, None),
}
@@ -253,9 +254,6 @@ async def async_setup(hass, config):
# Store config for use during entry setup:
hass.data[DOMAIN][DATA_CONFIG] = conf
if conf[CONF_APP_KEY] in configured_instances(hass):
return True
hass.async_create_task(
hass.config_entries.flow.async_init(
DOMAIN,
@@ -269,6 +267,11 @@ async def async_setup(hass, config):
async def async_setup_entry(hass, config_entry):
"""Set up the Ambient PWS as config entry."""
if not config_entry.unique_id:
hass.config_entries.async_update_entry(
config_entry, unique_id=config_entry.data[CONF_APP_KEY]
)
session = aiohttp_client.async_get_clientsession(hass)
try:
@@ -378,7 +381,9 @@ class AmbientStation:
if data != self.stations[mac_address][ATTR_LAST_DATA]:
_LOGGER.debug("New data received: %s", data)
self.stations[mac_address][ATTR_LAST_DATA] = data
async_dispatcher_send(self._hass, TOPIC_UPDATE.format(mac_address))
async_dispatcher_send(
self._hass, f"ambient_station_data_update_{mac_address}"
)
_LOGGER.debug("Resetting watchdog")
self._watchdog_listener()
@@ -518,7 +523,7 @@ class AmbientWeatherEntity(Entity):
self.async_schedule_update_ha_state(True)
self._async_unsub_dispatcher_connect = async_dispatcher_connect(
self.hass, TOPIC_UPDATE.format(self._mac_address), update
self.hass, f"ambient_station_data_update_{self._mac_address}", update
)
async def async_will_remove_from_hass(self):

View File

@@ -5,35 +5,29 @@ import voluptuous as vol
from homeassistant import config_entries
from homeassistant.const import CONF_API_KEY
from homeassistant.core import callback
from homeassistant.helpers import aiohttp_client
from .const import CONF_APP_KEY, DOMAIN
from .const import CONF_APP_KEY, DOMAIN # pylint: disable=unused-import
@callback
def configured_instances(hass):
"""Return a set of configured Ambient PWS instances."""
return set(
entry.data[CONF_APP_KEY] for entry in hass.config_entries.async_entries(DOMAIN)
)
@config_entries.HANDLERS.register(DOMAIN)
class AmbientStationFlowHandler(config_entries.ConfigFlow):
class AmbientStationFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
"""Handle an Ambient PWS config flow."""
VERSION = 2
CONNECTION_CLASS = config_entries.CONN_CLASS_CLOUD_PUSH
async def _show_form(self, errors=None):
"""Show the form to the user."""
data_schema = vol.Schema(
def __init__(self):
"""Initialize the config flow."""
self.data_schema = vol.Schema(
{vol.Required(CONF_API_KEY): str, vol.Required(CONF_APP_KEY): str}
)
async def _show_form(self, errors=None):
"""Show the form to the user."""
return self.async_show_form(
step_id="user", data_schema=data_schema, errors=errors if errors else {}
step_id="user",
data_schema=self.data_schema,
errors=errors if errors else {},
)
async def async_step_import(self, import_config):
@@ -42,12 +36,11 @@ class AmbientStationFlowHandler(config_entries.ConfigFlow):
async def async_step_user(self, user_input=None):
"""Handle the start of the config flow."""
if not user_input:
return await self._show_form()
if user_input[CONF_APP_KEY] in configured_instances(self.hass):
return await self._show_form({CONF_APP_KEY: "identifier_exists"})
await self.async_set_unique_id(user_input[CONF_APP_KEY])
self._abort_if_unique_id_configured()
session = aiohttp_client.async_get_clientsession(self.hass)
client = Client(user_input[CONF_API_KEY], user_input[CONF_APP_KEY], session)

View File

@@ -8,7 +8,5 @@ CONF_APP_KEY = "app_key"
DATA_CLIENT = "data_client"
TOPIC_UPDATE = "ambient_station_data_update_{0}"
TYPE_BINARY_SENSOR = "binary_sensor"
TYPE_SENSOR = "sensor"

View File

@@ -3,7 +3,7 @@
"name": "Ambient Weather Station",
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/ambient_station",
"requirements": ["aioambient==1.0.2"],
"requirements": ["aioambient==1.0.4"],
"dependencies": [],
"codeowners": ["@bachya"]
}

View File

@@ -83,7 +83,11 @@ class AmbientWeatherSensor(AmbientWeatherEntity):
w_m2_brightness_val = self._ambient.stations[self._mac_address][
ATTR_LAST_DATA
].get(TYPE_SOLARRADIATION)
self._state = round(float(w_m2_brightness_val) / 0.0079)
if w_m2_brightness_val is None:
self._state = None
else:
self._state = round(float(w_m2_brightness_val) / 0.0079)
else:
self._state = self._ambient.stations[self._mac_address][ATTR_LAST_DATA].get(
self._sensor_type

View File

@@ -11,9 +11,11 @@
}
},
"error": {
"identifier_exists": "Application Key and/or API Key already registered",
"invalid_key": "Invalid API Key and/or Application Key",
"no_devices": "No devices found in account"
},
"abort": {
"already_configured": "This app key is already in use."
}
}
}

View File

@@ -109,7 +109,6 @@ CONFIG_SCHEMA = vol.Schema(
)
# pylint: disable=too-many-ancestors
class AmcrestChecker(Http):
"""amcrest.Http wrapper for catching errors."""

View File

@@ -54,7 +54,7 @@ class AmcrestBinarySensor(BinarySensorDevice):
def __init__(self, name, device, sensor_type):
"""Initialize entity."""
self._name = "{} {}".format(name, BINARY_SENSORS[sensor_type][0])
self._name = f"{name} {BINARY_SENSORS[sensor_type][0]}"
self._signal_name = name
self._api = device.api
self._sensor_type = sensor_type

View File

@@ -491,9 +491,7 @@ class AmcrestCam(Camera):
"""Enable or disable indicator light."""
try:
self._api.command(
"configManager.cgi?action=setConfig&LightGlobal[0].Enable={}".format(
str(enable).lower()
)
f"configManager.cgi?action=setConfig&LightGlobal[0].Enable={str(enable).lower()}"
)
except AmcrestError as error:
log_update_error(

View File

@@ -6,7 +6,7 @@ def service_signal(service, ident=None):
"""Encode service and identifier into signal."""
signal = f"{DOMAIN}_{service}"
if ident:
signal += "_{}".format(ident.replace(".", "_"))
signal += f"_{ident.replace('.', '_')}"
return signal

View File

@@ -4,7 +4,7 @@ import logging
from amcrest import AmcrestError
from homeassistant.const import CONF_NAME, CONF_SENSORS
from homeassistant.const import CONF_NAME, CONF_SENSORS, UNIT_PERCENTAGE
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity import Entity
@@ -20,7 +20,7 @@ SENSOR_SDCARD = "sdcard"
# Sensor types are defined like: Name, units, icon
SENSORS = {
SENSOR_PTZ_PRESET: ["PTZ Preset", None, "mdi:camera-iris"],
SENSOR_SDCARD: ["SD Used", "%", "mdi:sd"],
SENSOR_SDCARD: ["SD Used", UNIT_PERCENTAGE, "mdi:sd"],
}
@@ -45,7 +45,7 @@ class AmcrestSensor(Entity):
def __init__(self, name, device, sensor_type):
"""Initialize a sensor for Amcrest camera."""
self._name = "{} {}".format(name, SENSORS[sensor_type][0])
self._name = f"{name} {SENSORS[sensor_type][0]}"
self._signal_name = name
self._api = device.api
self._sensor_type = sensor_type
@@ -98,15 +98,21 @@ class AmcrestSensor(Entity):
elif self._sensor_type == SENSOR_SDCARD:
storage = self._api.storage_all
try:
self._attrs["Total"] = "{:.2f} {}".format(*storage["total"])
self._attrs[
"Total"
] = f"{storage['total'][0]:.2f} {storage['total'][1]}"
except ValueError:
self._attrs["Total"] = "{} {}".format(*storage["total"])
self._attrs[
"Total"
] = f"{storage['total'][0]} {storage['total'][1]}"
try:
self._attrs["Used"] = "{:.2f} {}".format(*storage["used"])
self._attrs[
"Used"
] = f"{storage['used'][0]:.2f} {storage['used'][1]}"
except ValueError:
self._attrs["Used"] = "{} {}".format(*storage["used"])
self._attrs["Used"] = f"{storage['used'][0]} {storage['used'][1]}"
try:
self._state = "{:.2f}".format(storage["used_percent"])
self._state = f"{storage['used_percent']:.2f}"
except ValueError:
self._state = storage["used_percent"]
except AmcrestError as error:

View File

@@ -75,9 +75,7 @@ class PwrCtrlSwitch(SwitchDevice):
@property
def unique_id(self):
"""Return the unique ID of the device."""
return "{device}-{switch_idx}".format(
device=self._port.device.host, switch_idx=self._port.get_index()
)
return f"{self._port.device.host}-{self._port.get_index()}"
@property
def name(self):

View File

@@ -6,7 +6,14 @@ import voluptuous as vol
from homeassistant.components import apcupsd
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import CONF_RESOURCES, POWER_WATT, TEMP_CELSIUS
from homeassistant.const import (
CONF_RESOURCES,
POWER_WATT,
TEMP_CELSIUS,
TIME_MINUTES,
TIME_SECONDS,
UNIT_PERCENTAGE,
)
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity
@@ -22,7 +29,7 @@ SENSOR_TYPES = {
"battdate": ["Battery Replaced", "", "mdi:calendar-clock"],
"battstat": ["Battery Status", "", "mdi:information-outline"],
"battv": ["Battery Voltage", "V", "mdi:flash"],
"bcharge": ["Battery", "%", "mdi:battery"],
"bcharge": ["Battery", UNIT_PERCENTAGE, "mdi:battery"],
"cable": ["Cable Type", "", "mdi:ethernet-cable"],
"cumonbatt": ["Total Time on Battery", "", "mdi:timer"],
"date": ["Status Date", "", "mdi:calendar-clock"],
@@ -36,20 +43,20 @@ SENSOR_TYPES = {
"firmware": ["Firmware Version", "", "mdi:information-outline"],
"hitrans": ["Transfer High", "V", "mdi:flash"],
"hostname": ["Hostname", "", "mdi:information-outline"],
"humidity": ["Ambient Humidity", "%", "mdi:water-percent"],
"humidity": ["Ambient Humidity", UNIT_PERCENTAGE, "mdi:water-percent"],
"itemp": ["Internal Temperature", TEMP_CELSIUS, "mdi:thermometer"],
"lastxfer": ["Last Transfer", "", "mdi:transfer"],
"linefail": ["Input Voltage Status", "", "mdi:information-outline"],
"linefreq": ["Line Frequency", "Hz", "mdi:information-outline"],
"linev": ["Input Voltage", "V", "mdi:flash"],
"loadpct": ["Load", "%", "mdi:gauge"],
"loadapnt": ["Load Apparent Power", "%", "mdi:gauge"],
"loadpct": ["Load", UNIT_PERCENTAGE, "mdi:gauge"],
"loadapnt": ["Load Apparent Power", UNIT_PERCENTAGE, "mdi:gauge"],
"lotrans": ["Transfer Low", "V", "mdi:flash"],
"mandate": ["Manufacture Date", "", "mdi:calendar"],
"masterupd": ["Master Update", "", "mdi:information-outline"],
"maxlinev": ["Input Voltage High", "V", "mdi:flash"],
"maxtime": ["Battery Timeout", "", "mdi:timer-off"],
"mbattchg": ["Battery Shutdown", "%", "mdi:battery-alert"],
"mbattchg": ["Battery Shutdown", UNIT_PERCENTAGE, "mdi:battery-alert"],
"minlinev": ["Input Voltage Low", "V", "mdi:flash"],
"mintimel": ["Shutdown Time", "", "mdi:timer"],
"model": ["Model", "", "mdi:information-outline"],
@@ -64,7 +71,7 @@ SENSOR_TYPES = {
"reg1": ["Register 1 Fault", "", "mdi:information-outline"],
"reg2": ["Register 2 Fault", "", "mdi:information-outline"],
"reg3": ["Register 3 Fault", "", "mdi:information-outline"],
"retpct": ["Restore Requirement", "%", "mdi:battery-alert"],
"retpct": ["Restore Requirement", UNIT_PERCENTAGE, "mdi:battery-alert"],
"selftest": ["Last Self Test", "", "mdi:calendar-clock"],
"sense": ["Sensitivity", "", "mdi:information-outline"],
"serialno": ["Serial Number", "", "mdi:information-outline"],
@@ -84,16 +91,16 @@ SENSOR_TYPES = {
SPECIFIC_UNITS = {"ITEMP": TEMP_CELSIUS}
INFERRED_UNITS = {
" Minutes": "min",
" Seconds": "sec",
" Percent": "%",
" Minutes": TIME_MINUTES,
" Seconds": TIME_SECONDS,
" Percent": UNIT_PERCENTAGE,
" Volts": "V",
" Ampere": "A",
" Volt-Ampere": "VA",
" Watts": POWER_WATT,
" Hz": "Hz",
" C": TEMP_CELSIUS,
" Percent Load Capacity": "%",
" Percent Load Capacity": UNIT_PERCENTAGE,
}
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(

View File

@@ -26,7 +26,6 @@ from homeassistant.const import (
URL_API_EVENTS,
URL_API_SERVICES,
URL_API_STATES,
URL_API_STATES_ENTITY,
URL_API_STREAM,
URL_API_TEMPLATE,
__version__,
@@ -254,7 +253,7 @@ class APIEntityStateView(HomeAssistantView):
status_code = HTTP_CREATED if is_new_state else 200
resp = self.json(hass.states.get(entity_id), status_code)
resp.headers.add("Location", URL_API_STATES_ENTITY.format(entity_id))
resp.headers.add("Location", f"/api/states/{entity_id}")
return resp

View File

@@ -88,16 +88,15 @@ def request_configuration(hass, config, atv, credentials):
try:
await atv.airplay.finish_authentication(pin)
hass.components.persistent_notification.async_create(
"Authentication succeeded!<br /><br />Add the following "
"to credentials: in your apple_tv configuration:<br /><br />"
"{0}".format(credentials),
f"Authentication succeeded!<br /><br />"
f"Add the following to credentials: "
f"in your apple_tv configuration:<br /><br />{credentials}",
title=NOTIFICATION_AUTH_TITLE,
notification_id=NOTIFICATION_AUTH_ID,
)
except DeviceAuthenticationError as ex:
hass.components.persistent_notification.async_create(
"Authentication failed! Did you enter correct PIN?<br /><br />"
"Details: {0}".format(ex),
f"Authentication failed! Did you enter correct PIN?<br /><br />Details: {ex}",
title=NOTIFICATION_AUTH_TITLE,
notification_id=NOTIFICATION_AUTH_ID,
)
@@ -124,9 +123,7 @@ async def scan_apple_tvs(hass):
if login_id is None:
login_id = "Home Sharing disabled"
devices.append(
"Name: {0}<br />Host: {1}<br />Login ID: {2}".format(
atv.name, atv.address, login_id
)
f"Name: {atv.name}<br />Host: {atv.address}<br />Login ID: {login_id}"
)
if not devices:

View File

@@ -57,7 +57,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
def make_filter(callsigns: list) -> str:
"""Make a server-side filter from a list of callsigns."""
return " ".join("b/{0}".format(cs.upper()) for cs in callsigns)
return " ".join(f"b/{sign.upper()}" for sign in callsigns)
def gps_accuracy(gps, posambiguity: int) -> int:

View File

@@ -4,7 +4,12 @@ import logging
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import CONF_MONITORED_CONDITIONS, TEMP_CELSIUS, TEMP_FAHRENHEIT
from homeassistant.const import (
CONF_MONITORED_CONDITIONS,
TEMP_CELSIUS,
TEMP_FAHRENHEIT,
UNIT_PERCENTAGE,
)
from homeassistant.core import callback
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity
@@ -14,7 +19,7 @@ from . import DOMAIN, UPDATE_TOPIC
_LOGGER = logging.getLogger(__name__)
TEMP_UNITS = [TEMP_CELSIUS, TEMP_FAHRENHEIT]
PERCENT_UNITS = ["%", "%"]
PERCENT_UNITS = [UNIT_PERCENTAGE, UNIT_PERCENTAGE]
SALT_UNITS = ["g/L", "PPM"]
WATT_UNITS = ["W", "W"]
NO_UNITS = [None, None]
@@ -70,7 +75,7 @@ class AquaLogicSensor(Entity):
@property
def name(self):
"""Return the name of the sensor."""
return "AquaLogic {}".format(SENSOR_TYPES[self._type][0])
return f"AquaLogic {SENSOR_TYPES[self._type][0]}"
@property
def unit_of_measurement(self):

View File

@@ -70,7 +70,7 @@ class AquaLogicSwitch(SwitchDevice):
@property
def name(self):
"""Return the name of the switch."""
return "AquaLogic {}".format(SWITCH_TYPES[self._type])
return f"AquaLogic {SWITCH_TYPES[self._type]}"
@property
def should_poll(self):

View File

@@ -44,9 +44,9 @@ def _optional_zone(value):
def _zone_name_validator(config):
for zone, zone_config in config[CONF_ZONE].items():
if CONF_NAME not in zone_config:
zone_config[CONF_NAME] = "{} ({}:{}) - {}".format(
DEFAULT_NAME, config[CONF_HOST], config[CONF_PORT], zone
)
zone_config[
CONF_NAME
] = f"{DEFAULT_NAME} ({config[CONF_HOST]}:{config[CONF_PORT]}) - {zone}"
return config

View File

@@ -140,7 +140,7 @@ class ArestSensor(Entity):
"""Initialize the sensor."""
self.arest = arest
self._resource = resource
self._name = "{} {}".format(location.title(), name.title())
self._name = f"{location.title()} {name.title()}"
self._variable = variable
self._pin = pin
self._state = None
@@ -204,8 +204,7 @@ class ArestData:
try:
if str(self._pin[0]) == "A":
response = requests.get(
"{}/analog/{}".format(self._resource, self._pin[1:]),
timeout=10,
f"{self._resource,}/analog/{self._pin[1:]}", timeout=10
)
self.data = {"value": response.json()["return_value"]}
except TypeError:

View File

@@ -86,7 +86,7 @@ class ArestSwitchBase(SwitchDevice):
def __init__(self, resource, location, name):
"""Initialize the switch."""
self._resource = resource
self._name = "{} {}".format(location.title(), name.title())
self._name = f"{location.title()} {name.title()}"
self._state = None
self._available = True

View File

@@ -67,9 +67,7 @@ def setup(hass, config):
except (ConnectTimeout, HTTPError) as ex:
_LOGGER.error("Unable to connect to Netgear Arlo: %s", str(ex))
hass.components.persistent_notification.create(
"Error: {}<br />"
"You will need to restart hass after fixing."
"".format(ex),
f"Error: {ex}<br />You will need to restart hass after fixing.",
title=NOTIFICATION_TITLE,
notification_id=NOTIFICATION_ID,
)

View File

@@ -110,19 +110,19 @@ class ArloBaseStation(AlarmControlPanel):
else:
self._state = None
async def async_alarm_disarm(self, code=None):
def alarm_disarm(self, code=None):
"""Send disarm command."""
self._base_station.mode = DISARMED
async def async_alarm_arm_away(self, code=None):
def alarm_arm_away(self, code=None):
"""Send arm away command. Uses custom mode."""
self._base_station.mode = self._away_mode_name
async def async_alarm_arm_home(self, code=None):
def alarm_arm_home(self, code=None):
"""Send arm home command. Uses custom mode."""
self._base_station.mode = self._home_mode_name
async def async_alarm_arm_night(self, code=None):
def alarm_arm_night(self, code=None):
"""Send arm night command. Uses custom mode."""
self._base_station.mode = self._night_mode_name

View File

@@ -78,11 +78,14 @@ class ArloCam(Camera):
async def handle_async_mjpeg_stream(self, request):
"""Generate an HTTP MJPEG stream from the camera."""
video = await self.hass.async_add_executor_job(
getattr, self._camera, "last_video"
)
video = self._camera.last_video
if not video:
error_msg = "Video not found for {0}. Is it older than {1} days?".format(
self.name, self._camera.min_days_vdo_cache
error_msg = (
f"Video not found for {self.name}. "
f"Is it older than {self._camera.min_days_vdo_cache} days?"
)
_LOGGER.error(error_msg)
return

View File

@@ -6,10 +6,12 @@ import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import (
ATTR_ATTRIBUTION,
CONCENTRATION_PARTS_PER_MILLION,
CONF_MONITORED_CONDITIONS,
DEVICE_CLASS_HUMIDITY,
DEVICE_CLASS_TEMPERATURE,
TEMP_CELSIUS,
UNIT_PERCENTAGE,
)
from homeassistant.core import callback
import homeassistant.helpers.config_validation as cv
@@ -26,11 +28,11 @@ SENSOR_TYPES = {
"last_capture": ["Last", None, "run-fast"],
"total_cameras": ["Arlo Cameras", None, "video"],
"captured_today": ["Captured Today", None, "file-video"],
"battery_level": ["Battery Level", "%", "battery-50"],
"battery_level": ["Battery Level", UNIT_PERCENTAGE, "battery-50"],
"signal_strength": ["Signal Strength", None, "signal"],
"temperature": ["Temperature", TEMP_CELSIUS, "thermometer"],
"humidity": ["Humidity", "%", "water-percent"],
"air_quality": ["Air Quality", "ppm", "biohazard"],
"humidity": ["Humidity", UNIT_PERCENTAGE, "water-percent"],
"air_quality": ["Air Quality", CONCENTRATION_PARTS_PER_MILLION, "biohazard"],
}
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
@@ -57,7 +59,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
if sensor_type in ("temperature", "humidity", "air_quality"):
continue
name = "{0} {1}".format(SENSOR_TYPES[sensor_type][0], camera.name)
name = f"{SENSOR_TYPES[sensor_type][0]} {camera.name}"
sensors.append(ArloSensor(name, camera, sensor_type))
for base_station in arlo.base_stations:
@@ -65,9 +67,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
sensor_type in ("temperature", "humidity", "air_quality")
and base_station.model_id == "ABC1000"
):
name = "{0} {1}".format(
SENSOR_TYPES[sensor_type][0], base_station.name
)
name = f"{SENSOR_TYPES[sensor_type][0]} {base_station.name}"
sensors.append(ArloSensor(name, base_station, sensor_type))
add_entities(sensors, True)
@@ -83,7 +83,7 @@ class ArloSensor(Entity):
self._data = device
self._sensor_type = sensor_type
self._state = None
self._icon = "mdi:{}".format(SENSOR_TYPES.get(self._sensor_type)[2])
self._icon = f"mdi:{SENSOR_TYPES.get(self._sensor_type)[2]}"
@property
def name(self):
@@ -141,8 +141,9 @@ class ArloSensor(Entity):
video = self._data.last_video
self._state = video.created_at_pretty("%m-%d-%Y %H:%M:%S")
except (AttributeError, IndexError):
error_msg = "Video not found for {0}. Older than {1} days?".format(
self.name, self._data.min_days_vdo_cache
error_msg = (
f"Video not found for {self.name}. "
f"Older than {self._data.min_days_vdo_cache} days?"
)
_LOGGER.debug(error_msg)
self._state = None

View File

@@ -84,8 +84,8 @@ class ArubaDeviceScanner(DeviceScanner):
def get_aruba_data(self):
"""Retrieve data from Aruba Access Point and return parsed result."""
connect = "ssh {}@{}"
ssh = pexpect.spawn(connect.format(self.username, self.host))
connect = f"ssh {self.username}@{self.host}"
ssh = pexpect.spawn(connect)
query = ssh.expect(
[
"password:",

View File

@@ -50,7 +50,7 @@ def discover_sensors(topic, payload):
def _slug(name):
return "sensor.arwn_{}".format(slugify(name))
return f"sensor.arwn_{slugify(name)}"
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):

View File

@@ -49,8 +49,10 @@ class AsteriskCDR(Mailbox):
"duration": entry["duration"],
}
sha = hashlib.sha256(str(entry).encode("utf-8")).hexdigest()
msg = "Destination: {}\nApplication: {}\n Context: {}".format(
entry["dest"], entry["application"], entry["context"]
msg = (
f"Destination: {entry['dest']}\n"
f"Application: {entry['application']}\n "
f"Context: {entry['context']}"
)
cdr.append({"info": info, "sha": sha, "text": msg})
self.cdr = cdr

View File

@@ -17,6 +17,8 @@ from homeassistant.helpers.discovery import async_load_platform
_LOGGER = logging.getLogger(__name__)
CONF_DNSMASQ = "dnsmasq"
CONF_INTERFACE = "interface"
CONF_PUB_KEY = "pub_key"
CONF_REQUIRE_IP = "require_ip"
CONF_SENSORS = "sensors"
@@ -24,7 +26,10 @@ CONF_SSH_KEY = "ssh_key"
DOMAIN = "asuswrt"
DATA_ASUSWRT = DOMAIN
DEFAULT_SSH_PORT = 22
DEFAULT_INTERFACE = "eth0"
DEFAULT_DNSMASQ = "/var/lib/misc"
SECRET_GROUP = "Password or SSH Key"
SENSOR_TYPES = ["upload_speed", "download_speed", "download", "upload"]
@@ -45,6 +50,8 @@ CONFIG_SCHEMA = vol.Schema(
vol.Optional(CONF_SENSORS): vol.All(
cv.ensure_list, [vol.In(SENSOR_TYPES)]
),
vol.Optional(CONF_INTERFACE, default=DEFAULT_INTERFACE): cv.string,
vol.Optional(CONF_DNSMASQ, default=DEFAULT_DNSMASQ): cv.isdir,
}
)
},
@@ -59,13 +66,15 @@ async def async_setup(hass, config):
api = AsusWrt(
conf[CONF_HOST],
conf.get(CONF_PORT),
conf.get(CONF_PROTOCOL) == "telnet",
conf[CONF_PORT],
conf[CONF_PROTOCOL] == "telnet",
conf[CONF_USERNAME],
conf.get(CONF_PASSWORD, ""),
conf.get("ssh_key", conf.get("pub_key", "")),
conf.get(CONF_MODE),
conf.get(CONF_REQUIRE_IP),
conf[CONF_MODE],
conf[CONF_REQUIRE_IP],
conf[CONF_INTERFACE],
conf[CONF_DNSMASQ],
)
await api.connection.async_connect()

View File

@@ -2,7 +2,7 @@
"domain": "asuswrt",
"name": "ASUSWRT",
"documentation": "https://www.home-assistant.io/integrations/asuswrt",
"requirements": ["aioasuswrt==1.1.22"],
"requirements": ["aioasuswrt==1.2.2"],
"dependencies": [],
"codeowners": ["@kennedyshead"]
}

View File

@@ -0,0 +1,32 @@
{
"config": {
"abort": {
"already_configured": "El compte ja ha estat configurat"
},
"error": {
"cannot_connect": "No s'ha pogut connectar, torna-ho a provar",
"invalid_auth": "Autenticaci\u00f3 inv\u00e0lida",
"unknown": "Error inesperat"
},
"step": {
"user": {
"data": {
"login_method": "M\u00e8tode d'inici de sessi\u00f3",
"password": "Contrasenya",
"timeout": "Temps d'espera (segons)",
"username": "Nom d'usuari"
},
"description": "Si el m\u00e8tode d'inici de sessi\u00f3 \u00e9s 'email', el nom d'usuari \u00e9s l'adre\u00e7a de correu electr\u00f2nic. Si el m\u00e8tode d'inici de sessi\u00f3 \u00e9s 'phone', el nom d'usuari \u00e9s el n\u00famero de tel\u00e8fon en el format \"+NNNNNNNNN\".",
"title": "Configuraci\u00f3 de compte August"
},
"validation": {
"data": {
"code": "Codi de verificaci\u00f3"
},
"description": "Comprova el teu {login_method} ({username}) i introdueix el codi de verificaci\u00f3 a continuaci\u00f3",
"title": "Autenticaci\u00f3 de dos factors"
}
},
"title": "August"
}
}

View File

@@ -0,0 +1,32 @@
{
"config": {
"abort": {
"already_configured": "Kontoen er allerede konfigureret"
},
"error": {
"cannot_connect": "Kunne ikke oprette forbindelse. Pr\u00f8v igen",
"invalid_auth": "Ugyldig godkendelse",
"unknown": "Uventet fejl"
},
"step": {
"user": {
"data": {
"login_method": "Loginmetode",
"password": "Adgangskode",
"timeout": "Timeout (sekunder)",
"username": "Brugernavn"
},
"description": "Hvis loginmetoden er 'e-mail', er brugernavn e-mailadressen. Hvis loginmetoden er 'telefon', er brugernavn telefonnummeret i formatet '+NNNNNNNNNN'.",
"title": "Konfigurer en August-konto"
},
"validation": {
"data": {
"code": "Bekr\u00e6ftelseskode"
},
"description": "Kontroller dit {login_method} ({username}), og angiv bekr\u00e6ftelseskoden nedenfor",
"title": "Tofaktorgodkendelse"
}
},
"title": "August"
}
}

View File

@@ -0,0 +1,31 @@
{
"config": {
"abort": {
"already_configured": "Konto ist bereits konfiguriert"
},
"error": {
"cannot_connect": "Verbindung fehlgeschlagen, versuchen Sie es erneut",
"invalid_auth": "Ung\u00fcltige Authentifizierung",
"unknown": "Unerwarteter Fehler"
},
"step": {
"user": {
"data": {
"login_method": "Anmeldemethode",
"password": "Passwort",
"timeout": "Zeit\u00fcberschreitung (Sekunden)",
"username": "Benutzername"
},
"title": "Richten Sie ein August-Konto ein"
},
"validation": {
"data": {
"code": "Verifizierungs-Code"
},
"description": "Bitte \u00fcberpr\u00fcfen Sie Ihre {login_method} ({username}) und geben Sie den Best\u00e4tigungscode ein",
"title": "Zwei-Faktor-Authentifizierung"
}
},
"title": "August"
}
}

View File

@@ -0,0 +1,32 @@
{
"config": {
"abort": {
"already_configured": "Account is already configured"
},
"error": {
"cannot_connect": "Failed to connect, please try again",
"invalid_auth": "Invalid authentication",
"unknown": "Unexpected error"
},
"step": {
"user": {
"data": {
"login_method": "Login Method",
"password": "Password",
"timeout": "Timeout (seconds)",
"username": "Username"
},
"description": "If the Login Method is 'email', Username is the email address. If the Login Method is 'phone', Username is the phone number in the format '+NNNNNNNNN'.",
"title": "Setup an August account"
},
"validation": {
"data": {
"code": "Verification code"
},
"description": "Please check your {login_method} ({username}) and enter the verification code below",
"title": "Two factor authentication"
}
},
"title": "August"
}
}

View File

@@ -0,0 +1,32 @@
{
"config": {
"abort": {
"already_configured": "La cuenta ya est\u00e1 configurada"
},
"error": {
"cannot_connect": "No se ha podido conectar, por favor, int\u00e9ntalo de nuevo.",
"invalid_auth": "Autenticaci\u00f3n no v\u00e1lida",
"unknown": "Error inesperado"
},
"step": {
"user": {
"data": {
"login_method": "M\u00e9todo de inicio de sesi\u00f3n",
"password": "Contrase\u00f1a",
"timeout": "Tiempo de espera (segundos)",
"username": "Usuario"
},
"description": "Si el M\u00e9todo de Inicio de Sesi\u00f3n es 'correo electr\u00f3nico', Usuario es la direcci\u00f3n de correo electr\u00f3nico. Si el M\u00e9todo de Inicio de Sesi\u00f3n es 'tel\u00e9fono', Usuario es el n\u00famero de tel\u00e9fono en formato '+NNNNNNNNN'.",
"title": "Configurar una cuenta de August"
},
"validation": {
"data": {
"code": "C\u00f3digo de verificaci\u00f3n"
},
"description": "Por favor, compruebe tu {login_method} ({username}) e introduce el c\u00f3digo de verificaci\u00f3n a continuaci\u00f3n",
"title": "Autenticaci\u00f3n de dos factores"
}
},
"title": "August"
}
}

View File

@@ -0,0 +1,32 @@
{
"config": {
"abort": {
"already_configured": "L'account \u00e8 gi\u00e0 configurato"
},
"error": {
"cannot_connect": "Impossibile connettersi, si prega di riprovare.",
"invalid_auth": "Autenticazione non valida",
"unknown": "Errore imprevisto"
},
"step": {
"user": {
"data": {
"login_method": "Metodo di accesso",
"password": "Password",
"timeout": "Timeout (in secondi)",
"username": "Nome utente"
},
"description": "Se il metodo di accesso \u00e8 \"e-mail\", il nome utente \u00e8 l'indirizzo e-mail. Se il metodo di accesso \u00e8 \"telefono\", il nome utente \u00e8 il numero di telefono nel formato \"+NNNNNNNNN\".",
"title": "Configura un account di August"
},
"validation": {
"data": {
"code": "Codice di verifica"
},
"description": "Controlla il tuo {login_method} ({username}) e inserisci il codice di verifica seguente",
"title": "Autenticazione a due fattori"
}
},
"title": "August"
}
}

View File

@@ -0,0 +1,32 @@
{
"config": {
"abort": {
"already_configured": "Kont ass scho konfigur\u00e9iert"
},
"error": {
"cannot_connect": "Feeler beim verbannen, prob\u00e9iert w.e.g. nach emol.",
"invalid_auth": "Ong\u00eblteg Authentifikatioun",
"unknown": "Onerwaarte Feeler"
},
"step": {
"user": {
"data": {
"login_method": "Login Method",
"password": "Passwuert",
"timeout": "Z\u00e4itiwwerscheidung (sekonnen)",
"username": "Benotzernumm"
},
"description": "Wann d'Login Method 'E-Mail' ass, dannn ass de Benotzernumm d'E-Mail Adress. Wann d'Login-Method 'Telefon' ass, ass den Benotzernumm d'Telefonsnummer am Format '+ NNNNNNNNN'.",
"title": "August Kont ariichten"
},
"validation": {
"data": {
"code": "Verifikatiouns Code"
},
"description": "Pr\u00e9ift w.e.g. \u00c4re {login_method} ({username}) a gitt de Verifikatiounscode hei dr\u00ebnner an",
"title": "2-Faktor-Authentifikatioun"
}
},
"title": "August"
}
}

Some files were not shown because too many files have changed in this diff Show More