Commit Graph

20054 Commits (d3f9408650da467ce0dbde0656837d269054566e)

Author SHA1 Message Date
J. Nick Koston e344c2ea64
Add gate support to myq, fix bouncy updates (#33124)
* Add gate support to myq, fix bouncy updates

Switch to DataUpdateCoordinator, previously
we would hit the myq api every 60 seconds per device.

If you have access to 20 garage doors on the account it means
we would have previously tried to update 20 times per minutes.

* switch to async_call_later
2020-03-22 16:28:55 -07:00
Ivan Dyedov ab8c50895e
Add fahrenheit support in miflora sensor (#33136)
* add support for fahrenheit in miflora sensor

* fix error introduced when resolving merge conflict

* fix formatting
2020-03-22 21:58:35 +01:00
Matt Snyder f0472f2dc2
Fix QVR Pro connection error and add port option (#33070)
* Allow port specification.  Handle connection error gracefully.

* Allow port specification.  Handle connection error gracefully.

* Alias exception. Requested changes.
2020-03-22 21:43:45 +01:00
Quentame 0249daef2e
Bump iCloud to 0.9.6.1 (#33161) 2020-03-22 21:05:27 +01:00
Eugenio Panadero 8d2e72cdf6
Add pvpc electricity prices integration (#32092)
* Add new integration: pvpc_hourly_pricing

to add a sensor with the current hourly price of electricity in Spain.
Configuration is done by selecting one of the 3 reference tariffs, with
1, 2, or 3 billing periods.

* Features config flow, entity registry, RestoreEntity, options flow
  to change tariff, manual yaml config as integration or sensor platform
* Cloud polling sensor with minimal API calls (3/hour at random times)
  and smart retry; fully async
* Only 1 state change / hour (only when the price changes)
* At evening, try to download published tomorrow prices, to always store
  prices info for a window of [3, 27] hours in the future.
* Include useful state attributes to program automations to be run
  at best electric prices.
* Add spanish and english translations.

* Requires `xmltodict` to parse official xml file with hourly prices
for each day.

* Update requirements and add to codeowners

* Avoid passing in hass as a parameter to the entity

Instead, create time change listeners in async_added_to_hass and
call async_generate_entity_id before async_add_entities

* Fix lint issues

* Add tests for config & options flow

* Add tests for manual yaml config

with entity definition as integration and also as a sensor platform

* Fix placement of PLATFORM_SCHEMA and update generated config_flows

* Store prices internally linked to UTC timestamps

- to deal with days with DST changes
- and work with different local timezones

* Add availability to sensor

to 'expire' the sensor if there is no connection available
 and current hour is not in the stored prices.

Also, turn off logging and retrying if prices can't be downloaded
repeatedly, by flagging `data_source_available` as False, so there is no
log-flood mess.

* Add more tests

- to cover behavior in DST changes and complete coverage of sensor logic
- to cover abort config flow

* fix linter

* Better handling of sensor availability and minor enhancements

- Emmit 1 error if data source is marked as unavailable
  (after some retries), and be silent until cloud access is recovered,
  then emmit 1 warning.
- Follow standard of camel_case keys in attributes

* Mock aiosession to not access real API, store fixture data

- Store a set of daily xml files to test sensor logic for all situations
- Mock time and session to run tests with stored API responses
- Add availability test to simulate a lost + recovery of cloud access,
  checking that logging is reasonable: 1 error to flag the continued
  disconnection + 1 warning in recovery.

* Change API endpoint to retrieve JSON data

and remove xmltodict from reqs.

It seems that this endpoint is more reliable than the XML.

* Adapt tests to new API endpoint

* Translate tariff labels to plain English

and sync the default timeout value for all ways of configuration.

* Relax logging levels to meet silver requirements

- 1 warning when becoming unavailable, another warning when recovered.
- Warnings for unexpected TimeoutError or ClientError
- Move the rest to debug level, leaving info for HA internals

Also reduce number of API calls from 3 to 2 calls/hour.

* Fix requirements

* Mod tests to work with timezone Atlantic/Canary

and fix state attributes for timezones != reference, by using 3 price
prefixes: 'price_last_day_XXh', 'price_next_day_XXh' and 'price_XXh',
all generated with local time (backend timezone)

* Try to fix CI tests

* Externalize pvpc data and simplify sensor.py

* add new `aiopvpc` to requirements
* Remove data parsing and price logic from here
* Replace some constant properties with class variables

* Simplify tests for pvpc_hourly_pricing

* Fix updater for options flow

* Updater always reloads
* `tariff` value comes 1st from entry.options, 2nd from entry.data

* Fix lint

* Bump aiopvpc

* Remove options flow and platform setup

- Remove PLATFORM_SCHEMA and async_setup_platform
- Generate config_entry.unique_id with tariff instead of entity_id, in flow step.
- Remove TariffSelectorConfigFlow
- Adapt tests to maintain full coverage

* Fix docstring on test

and rename SENSOR_SCHEMA to SINGLE_SENSOR_SCHEMA to avoid confusion

* Remove timeout manual config, fix entry.options usage, simplify unique_id

* Simplify tests

- No need for a test_setup now, as platform setup is removed and integration
  setup is already used in `test_availability`
- Simplified `_process_time_step`: only one async_fire(EVENT_TIME_CHANGED)/hour

* Fix possible duplicated update

when source is not available.

* Do not access State last_changed for log messages

* Do not update until entity is added to hass

and call to async_update after 1st download or when recovering access, so
async_write_ha_state is not called twice on those.

* minor changes

* Rename method to select current price and make it a callback
2020-03-22 14:25:31 -05:00
Jason Swails 2a3d688923
General code cleanups for lutron_caseta component (#33144)
* General code cleanups for lutron_caseta component

* black

* Update homeassistant/components/lutron_caseta/__init__.py

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

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2020-03-22 17:35:01 +01:00
Raman Gupta ca3a22b5a3
Filter out duplicate app names from vizio's source list (#33051)
* filter out additional app config names from pyvizios app list

* add test

* change where filtering app list occurs

* fix test

* fix mistake in change

* hopefully final test fix

* fix test scenario that unknowingly broke with test change
2020-03-22 17:34:00 +01:00
Austin Mroczek c79b3df73f
Handle generic_thermostat state unavailable (#32852)
* fix sensor unavailable error

* fix climate.py
2020-03-22 09:35:58 -05:00
Christian Ferbar 8423d18d8d
Add Miflora go_unavailable_timeout (#31156)
* Clear state on exception

Clear state if querying the device fails. The state is then set to unknown, so it can be tracked if a miflora device isn't responding any more.

* Add available()

Signal valid data via available()

* miflora: add timeout to go unavailable

* code cleanup

* miflora: tox cleanup
2020-03-22 14:00:09 +01:00
Maciej Bieniek 9d87c1ab1a
Bump gios to 0.0.4 (#33141) 2020-03-22 13:44:57 +01:00
Paulus Schoutsen f95c3e265d
Fix script logging with name (#33120) 2020-03-22 13:29:50 +01:00
On Freund 66402b9b38
Monoprice PR followups (#33133) 2020-03-22 13:25:27 +01:00
jjlawren 99877c32b1
Bump pyecobee to 0.2.3 (#33130) 2020-03-22 13:19:26 +01:00
On Freund e8bd1b9216
Config Flow and Entity registry support for Monoprice (#30337)
* Entity registry support for monoprice

* Add test for unique_id

* Add unique id namespace to monoprice

* Config Flow for Monoprice

* Update monoprice tests

* Remove TODOs

* Handle entity unloading

* Fix update test

* Streamline entity handling in monoprice services

* Increase coverage

* Remove devices cache

* Async validation in monoprice config flow
2020-03-21 18:12:32 -07:00
guillempages 99d732b974
Revert "Validate UUID for tankerkoenig (#32805)" (#33123)
This reverts commit 49c2a4a4e3.
The validation was causing more problems than it was fixing, so removed
it completely
2020-03-21 17:48:18 -07:00
Alexei Chetroi 991afccbd4
Refactor ZHA EventChannels (#32709)
* Refactor EventChannels.

* Rename EventRelayChannel.

* Fully rename EventRelayChannel.

- update docstrings
- rename all references from "relay" to "client"

* Remove CHANNEL_NAME.

* Update stale docstring.
2020-03-21 19:59:32 -04:00
Eugenio Panadero d5e606640c
Fix scheduled update time-drift in data update coordinator (#32974)
* Fix scheduled update time-drift in data update coordinator

As next schedule is calculated **after** the update is done,
setting now + update_interval makes 1 second drift in practice,
as the tick is 1Hz.

* Floor the utcnow timestamp

to remove sub-second error precision, and generate constant frequency updates
as long as the update takes < 1s.
2020-03-21 16:57:12 -07:00
Franck Nijhof 6d4fa76107
Add Wi-Fi sensors to WLED integration (#33055) 2020-03-21 15:14:41 -07:00
Austin Mroczek ba2558790d
Fix totalconnect AttributeError introduced in 0.107 (#33079)
* Fit git

* Remove period from loggging message

* Remove tests for now

* Add const.py

* Fix lint error
2020-03-21 15:14:19 -07:00
guillempages 79f6d55fe8
Fix tankerkoenig with more than 10 stations (#33098)
* Fix tankerkoenig with more than 10 stations

There seemed to be a problem, if more than 10 fuel stations were tracked.
Added a warning in this case, and split the calls to the API in chunks of
10, so that the data can be fetched anyway.

* Update homeassistant/components/tankerkoenig/__init__.py

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

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2020-03-21 15:12:14 -07:00
Aaron Bach 403b4a2e0b
Bump simplisafe-python to 9.0.5 (#33116) 2020-03-21 16:01:39 -06:00
Franck Nijhof 8272c71811
Handle query and anchors in Spotify URI's (#33084)
* Handle query and anchors in Spotify URI's

* Use yarl for cleaning up the URL
2020-03-21 12:24:23 -07:00
Anders Melchiorsen 699ca44260
Clean up Sonos attributes for radio streams (#33063) 2020-03-21 12:17:00 -07:00
Franck Nijhof 5893f6b14b
Fix Extend ONVIF unique ID with profile index (#33103) 2020-03-21 11:36:35 -07:00
Franck Nijhof a7b08c48f3
Upgrade spotipy to 2.10.0 (#33083) 2020-03-21 19:25:29 +01:00
J. Nick Koston 0148708613
Add DEVICE_CLASS_GATE (#33074)
Gates are found outside of a structure and are typically part of a fence.
2020-03-21 11:17:06 -07:00
Alexei Chetroi 81cef9a281
Split ZHA device loading and entities adding (#33075)
* Split ZHA device loading and entities adding.
Load zha devices from ZHA gateway, but add entities after integration
was setup.

* Use hass.loop.create_task()
* Split ZHA device initialization from loading.
Restore and initialize ZHA devices separately.

* Use hass.async_create_task()
Load devices prior group initialization.
2020-03-21 13:25:43 -04:00
escoand 2bb29485be
Try all Samsung TV websocket ports (#33001)
* Update bridge.py

* add test

* silence pylint

* correct pylint

* add some tests

* Update test_media_player.py
2020-03-21 16:50:18 +01:00
Jonas Kohlbrenner 57820be92a
Add scan_interval support for NUT integration (#31167)
* Added scan_interval support

* Changed to config[key] for required keys and optional keys with default value

* Removed usage of Throttle
2020-03-21 16:45:10 +01:00
Balazs Sandor e18bea0215
bump version zigpy-cc (#33097) 2020-03-21 10:43:55 -04:00
guillempages 49c2a4a4e3
Validate UUID for tankerkoenig (#32805)
* Validate UUIDs against custom validator

Instead of just validating against strings, use a custom validator,
so that the format can be checked.

* Add tests for custom UUID4 validator
2020-03-21 09:43:12 -05:00
Ville Skyttä ffc9bcb4d7
Use PEP 526 syntax with NamedTuples (#33081) 2020-03-21 11:18:32 +02:00
Franck Nijhof e87fab6b5f
Remove mopar integration (ADR-0004) (#33066) 2020-03-21 07:09:48 +01:00
Paulus Schoutsen b6d9454b54
Fix package default extraction (#33071) 2020-03-20 20:27:37 -07:00
J. Nick Koston 85328399e0
Add support for nexia automations (#33049)
* Add support for nexia automations

Bump nexia to 0.7.1

Start adding tests

Fix some of the climate attributes that were wrong (discovered while adding tests)

Pass the name of the instance so the nexia UI does not display "My Mobile"

* fix mocking

* faster asserts, scene

* scene makes so much more sense

* pylint

* Update homeassistant/components/nexia/scene.py

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

* docstring cleanup

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2020-03-20 18:49:42 -05:00
Aaron Bach 836413a4a8
Bump simplisafe-python to 9.0.4 (#33059) 2020-03-20 14:59:01 -06:00
Paulus Schoutsen d16d44d3e7
Add negative tests for identify schema for packages (#33050) 2020-03-20 13:34:56 -07:00
Knapoc c2ac8e813a
Bump aioasuswrt to 1.2.3 and fix asuswrt sensor (#33064)
* Bump aioasuswrt to 1.2.3

* Fix asuswrt connection setup parameters

* fix typo
2020-03-20 21:34:17 +01:00
J. Nick Koston 37687561c0
Add config flow for myq (#32890)
* Add a config flow for myq

* Discovered by homekit

* Fix gates being treated as garage doors

* Offline devices now show as unavailable

* Homekit flow

* strip out icon

* return -> raise
2020-03-20 15:28:14 -05:00
Franck Nijhof acf41d03db
Remove alarmdotcom integration (ADR-0004) (#33056) 2020-03-20 20:21:20 +01:00
J. Nick Koston 92d373055f
Modernize nuheat for new climate platform (#32714)
* Modernize nuheat for new climate platform

* Home Assistant state now mirrors the
  state displayed at mynewheat.com

* Remove off mode as the device does not implement
  and setting was not implemented anyways

* Implement missing set_hvac_mode for nuheat

* Now shows as unavailable when offline

* Add a unique id (serial number)

* Fix hvac_mode as it was really implementing hvac_action

* Presets now map to the open api spec
  published at https://api.mynuheat.com/swagger/

* ThermostatModel: scheduleMode

* Empty commit to re-run ci

* Revert test cleanup as it leaves files behind.

Its going to be more invasive to modernize the tests so
it will have to come in a new pr
2020-03-20 11:01:51 -07:00
James Nimmo c00f04221f
Add IntesisHome support for air to water heat pumps (#32250)
* Add Intesis support for air to water heat pumps

* Bump to pyIntesisHome 1.7.1

* Fix

* Re-order HVAC modes
2020-03-20 10:17:50 -07:00
GaryOkie 414559f018
Enable incremental Pan/Tilt/Zoom capability to Amcrest/Dahua cameras (#32839)
Add new "amcrest.ptz_control" service to specify a PTZ camera movement or zoom direction (up, down, right, left, right_up, right_down, left_up, left_down, zoom_in, zoom_out). An optional travel_time attribute specifies the amount of movement between start/stop.
2020-03-20 11:34:42 -05:00
Franck Nijhof 661101df08
Fix packages for schemas without a default (#33045) 2020-03-20 08:17:43 -07:00
Steven Rollason ecbcdee934
Bump pyhaversion to 3.3.0 (#33044) 2020-03-20 15:58:23 +01:00
cgtobi eb77b94315
Fix netatmo webhook registration issue (#32994)
* Wait for cloud connection

* Just wait

* Remove redundant entry

* Drop webhook before unloading other platforms

* Add missing scope

* Update homeassistant/components/netatmo/__init__.py

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

* Fix test

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-03-20 15:22:27 +01:00
cgtobi 6ab14a3729
Fix discovery issue with netatmo climate devices (#33040) 2020-03-20 15:20:42 +01:00
Jason Swails f81464161a
Break dependency on lutron component (#33031)
* Break dependency on lutron component

* Fix isort complaint
2020-03-20 10:42:34 +01:00
Maciej Bieniek 3461f3a1ed
Tests improvements to the Brother integration (#32982)
* Add tests for states of the sensors

* Revert async_update method

* Tests improvement

* Fix icon name

* Tests improvement

* Simplify tests

* Test improvement

* Patch the library instead of the coordinator

* Suggested change

* Remove return_value
2020-03-20 10:21:43 +01:00
Phil Bruckner 0ed7bc3b8e
Convert amcrest binary sensors from poll to stream (#32818)
* Convert amcrest binary sensors from poll to stream

- Bump amcrest package to 1.6.0.
- For online binary sensor poll camera periodically to test communications in case
  configuration & usage results in no other communication to camera.
- Start a separate thread to call camera's event_stream method since it never returns.
- Convert all received events into signals that cause corresponding sensors to update.
- Use camera's generic event_channels_happened method to update sensors at startup,
  and whenever camera comes back online after being unavailable.

* Changes per review

* Changes per review 2

* Changes per review 3

- Move event stream decoding to amcrest package.
- Change name of event processing threads so global
  counter is no longer required.
- Bump amcrest package to 1.7.0.
2020-03-19 21:07:21 -07:00