Skip to content
Permalink
Browse files

Merge branch 'dev' into current

* dev: (69 commits)
  Improve autodiscovered yeelights model detection (home-assistant#24671)
  Update azure-pipelines-release.yml for Azure Pipelines
  Add device class support for Ambient PWS sensors (home-assistant#24677)
  Updated frontend to 20190620.0
  Prefere binary with wheels (home-assistant#24669)
  Clean up Google Config (home-assistant#24663)
  Vlc telnet (home-assistant#24290)
  Update azure-pipelines-wheels.yml for Azure Pipelines
  Multiple devices support for opentherm_gw (home-assistant#22932)
  Update azure-pipelines-wheels.yml for Azure Pipelines
  Fix downloader_download_failed event not firing for HTTP response errors (home-assistant#24640)
  braviatv, nmap_tracker: use getmac for getting MAC addresses (home-assistant#24628)
  Fix AttributeError: 'NoneType' object has no attribute 'group' with sytadin component (home-assistant#24652)
  Bump pysmartthings (home-assistant#24659)
  Update LIFX brightness during long transitions (home-assistant#24653)
  Upgrade blinkpy==0.14.1 for startup bugfix (home-assistant#24656)
  Warn when user tries run custom config flow (home-assistant#24657)
  Bump ZHA dependencies. (home-assistant#24637)
  Fix device tracker see for entity registry entities (home-assistant#24633)
  Bumped version to 0.94.4
  ...
  • Loading branch information...
mxworm committed Jun 21, 2019
2 parents a89a75d + c6d5a5a commit c2d314fb9e9289f18507e4635e40a1b68d9a853e
Showing with 5,216 additions and 1,389 deletions.
  1. +4 −0 .coveragerc
  2. +1 −0 .gitignore
  3. +7 −1 CODEOWNERS
  4. +1 −1 azure-pipelines-release.yml
  5. +28 −0 homeassistant/components/adguard/.translations/de.json
  6. +2 −0 homeassistant/components/adguard/.translations/lb.json
  7. +6 −6 homeassistant/components/adguard/.translations/pl.json
  8. +14 −0 homeassistant/components/adguard/.translations/vi.json
  9. +8 −1 homeassistant/components/alarm_control_panel/__init__.py
  10. +36 −0 homeassistant/components/alexa/config.py
  11. +14 −0 homeassistant/components/alexa/entities.py
  12. +5 −1 homeassistant/components/alexa/errors.py
  13. +4 −12 homeassistant/components/alexa/handlers.py
  14. +1 −1 homeassistant/components/alexa/messages.py
  15. +0 −35 homeassistant/components/alexa/smart_home.py
  16. +7 −1 homeassistant/components/alexa/smart_home_http.py
  17. +91 −18 homeassistant/components/alexa/state_report.py
  18. +56 −50 homeassistant/components/ambient_station/__init__.py
  19. +0 −14 homeassistant/components/ambient_station/binary_sensor.py
  20. +9 −4 homeassistant/components/ambient_station/sensor.py
  21. +1 −1 homeassistant/components/androidtv/manifest.json
  22. +2 −1 homeassistant/components/axis/.translations/de.json
  23. +1 −1 homeassistant/components/blink/manifest.json
  24. +2 −1 homeassistant/components/braviatv/manifest.json
  25. +11 −17 homeassistant/components/braviatv/media_player.py
  26. +2 −0 homeassistant/components/broadlink/switch.py
  27. +11 −1 homeassistant/components/cloud/__init__.py
  28. +244 −0 homeassistant/components/cloud/alexa_config.py
  29. +33 −83 homeassistant/components/cloud/client.py
  30. +7 −0 homeassistant/components/cloud/const.py
  31. +52 −0 homeassistant/components/cloud/google_config.py
  32. +24 −2 homeassistant/components/cloud/http_api.py
  33. +1 −1 homeassistant/components/cloud/manifest.json
  34. +27 −1 homeassistant/components/cloud/prefs.py
  35. +46 −3 homeassistant/components/cover/__init__.py
  36. +18 −4 homeassistant/components/cover/services.yaml
  37. +2 −2 homeassistant/components/deconz/.translations/pl.json
  38. +1 −1 homeassistant/components/demo/alarm_control_panel.py
  39. +10 −0 homeassistant/components/device_tracker/legacy.py
  40. +1 −1 homeassistant/components/dialogflow/.translations/ca.json
  41. +11 −4 homeassistant/components/dlib_face_identify/image_processing.py
  42. +5 −0 homeassistant/components/downloader/__init__.py
  43. +1 −0 homeassistant/components/elv/__init__.py
  44. +8 −0 homeassistant/components/elv/manifest.json
  45. +103 −0 homeassistant/components/elv/switch.py
  46. +1 −1 homeassistant/components/esphome/.translations/pl.json
  47. +28 −32 homeassistant/components/esphome/__init__.py
  48. +31 −20 homeassistant/components/esphome/config_flow.py
  49. +47 −4 homeassistant/components/esphome/entry_data.py
  50. +1 −1 homeassistant/components/esphome/manifest.json
  51. +1 −1 homeassistant/components/frontend/manifest.json
  52. +2 −1 homeassistant/components/geniushub/binary_sensor.py
  53. +1 −1 homeassistant/components/geniushub/manifest.json
  54. +4 −1 homeassistant/components/geniushub/water_heater.py
  55. +3 −3 homeassistant/components/geofency/.translations/ca.json
  56. +3 −3 homeassistant/components/glances/sensor.py
  57. +20 −12 homeassistant/components/google_assistant/helpers.py
  58. +40 −21 homeassistant/components/google_assistant/http.py
  59. +3 −3 homeassistant/components/gpslogger/.translations/ca.json
  60. +1 −0 homeassistant/components/homematic/cover.py
  61. +1 −1 homeassistant/components/honeywell/__init__.py
  62. +6 −6 homeassistant/components/honeywell/climate.py
  63. +1 −1 homeassistant/components/honeywell/manifest.json
  64. +1 −1 homeassistant/components/hue/.translations/pl.json
  65. +11 −0 homeassistant/components/hue/binary_sensor.py
  66. +1 −1 homeassistant/components/ifttt/.translations/ca.json
  67. +10 −10 homeassistant/components/incomfort/__init__.py
  68. +52 −0 homeassistant/components/incomfort/binary_sensor.py
  69. +110 −0 homeassistant/components/incomfort/sensor.py
  70. +17 −6 homeassistant/components/incomfort/water_heater.py
  71. +1 −1 homeassistant/components/ipma/.translations/ru.json
  72. +17 −15 homeassistant/components/lcn/services.py
  73. +26 −0 homeassistant/components/life360/.translations/de.json
  74. +5 −5 homeassistant/components/life360/.translations/pl.json
  75. +1 −1 homeassistant/components/lifx/.translations/pl.json
  76. +2 −1 homeassistant/components/lifx/light.py
  77. +3 −3 homeassistant/components/locative/.translations/ca.json
  78. +1 −1 homeassistant/components/mailgun/.translations/ca.json
  79. +18 −5 homeassistant/components/manual/alarm_control_panel.py
  80. +18 −6 homeassistant/components/manual_mqtt/alarm_control_panel.py
  81. +20 −0 homeassistant/components/met/.translations/ca.json
  82. +20 −0 homeassistant/components/met/.translations/de.json
  83. +20 −0 homeassistant/components/met/.translations/en.json
  84. +20 −0 homeassistant/components/met/.translations/ko.json
  85. +20 −0 homeassistant/components/met/.translations/ru.json
  86. +14 −0 homeassistant/components/met/.translations/vi.json
  87. +22 −0 homeassistant/components/met/__init__.py
  88. +72 −0 homeassistant/components/met/config_flow.py
  89. +16 −0 homeassistant/components/met/const.py
  90. +1 −0 homeassistant/components/met/manifest.json
  91. +20 −0 homeassistant/components/met/strings.json
  92. +109 −35 homeassistant/components/met/weather.py
  93. +24 −0 homeassistant/components/meteo_france/__init__.py
  94. +5 −3 homeassistant/components/meteo_france/manifest.json
  95. +56 −4 homeassistant/components/meteo_france/sensor.py
  96. +8 −0 homeassistant/components/meteo_france/weather.py
  97. +1 −1 homeassistant/components/mqtt/.translations/pl.json
  98. +6 −0 homeassistant/components/mqtt/alarm_control_panel.py
  99. +17 −3 homeassistant/components/mqtt/cover.py
  100. +3 −15 homeassistant/components/nmap_tracker/device_tracker.py
  101. +2 −1 homeassistant/components/nmap_tracker/manifest.json
  102. +4 −0 homeassistant/components/onboarding/views.py
  103. +2 −1 homeassistant/components/opencv/manifest.json
  104. +170 −271 homeassistant/components/opentherm_gw/__init__.py
  105. +18 −80 homeassistant/components/opentherm_gw/binary_sensor.py
  106. +37 −30 homeassistant/components/opentherm_gw/climate.py
  107. +215 −0 homeassistant/components/opentherm_gw/const.py
  108. +3 −1 homeassistant/components/opentherm_gw/manifest.json
  109. +19 −139 homeassistant/components/opentherm_gw/sensor.py
  110. +25 −0 homeassistant/components/opentherm_gw/services.yaml
  111. +18 −0 homeassistant/components/plaato/.translations/ca.json
  112. +18 −0 homeassistant/components/plaato/.translations/de.json
  113. +18 −0 homeassistant/components/plaato/.translations/en.json
  114. +18 −0 homeassistant/components/plaato/.translations/ko.json
  115. +18 −0 homeassistant/components/plaato/.translations/ru.json
  116. +18 −0 homeassistant/components/plaato/.translations/zh-Hant.json
  117. +126 −0 homeassistant/components/plaato/__init__.py
  118. +11 −0 homeassistant/components/plaato/config_flow.py
  119. +3 −0 homeassistant/components/plaato/const.py
  120. +9 −0 homeassistant/components/plaato/manifest.json
  121. +147 −0 homeassistant/components/plaato/sensor.py
  122. +18 −0 homeassistant/components/plaato/strings.json
  123. +1 −0 homeassistant/components/qld_bushfire/__init__.py
  124. +228 −0 homeassistant/components/qld_bushfire/geo_location.py
  125. +12 −0 homeassistant/components/qld_bushfire/manifest.json
  126. +22 −3 homeassistant/components/samsungtv/media_player.py
  127. +4 −2 homeassistant/components/sma/sensor.py
  128. +1 −1 homeassistant/components/smartthings/manifest.json
  129. +6 −6 homeassistant/components/smartthings/smartapp.py
  130. +1 −1 homeassistant/components/smhi/.translations/ru.json
  131. +13 −0 homeassistant/components/somfy/.translations/de.json
  132. +1 −1 homeassistant/components/somfy/.translations/pl.json
  133. +1 −1 homeassistant/components/somfy_mylink/manifest.json
  134. +1 −1 homeassistant/components/sonos/manifest.json
  135. +27 −16 homeassistant/components/sonos/media_player.py
  136. +1 −0 homeassistant/components/sun/__init__.py
  137. +9 −3 homeassistant/components/sytadin/sensor.py
  138. +31 −0 homeassistant/components/traccar/const.py
  139. +36 −36 homeassistant/components/traccar/device_tracker.py
  140. +1 −1 homeassistant/components/twilio/.translations/ca.json
  141. +1 −0 homeassistant/components/vlc_telnet/__init__.py
  142. +10 −0 homeassistant/components/vlc_telnet/manifest.json
  143. +233 −0 homeassistant/components/vlc_telnet/media_player.py
  144. +1 −1 homeassistant/components/wemo/.translations/pl.json
  145. +4 −9 homeassistant/components/yeelight/__init__.py
  146. +38 −16 homeassistant/components/yeelight/light.py
  147. +19 −20 homeassistant/components/zha/core/channels/__init__.py
  148. +3 −0 homeassistant/components/zha/core/channels/security.py
  149. +3 −2 homeassistant/components/zha/core/device.py
  150. +38 −12 homeassistant/components/zha/core/discovery.py
  151. +4 −2 homeassistant/components/zha/core/gateway.py
  152. +33 −4 homeassistant/components/zha/core/registries.py
  153. +2 −2 homeassistant/components/zha/manifest.json
  154. +4 −0 homeassistant/components/zwave/__init__.py
  155. +14 −7 homeassistant/components/zwave/cover.py
  156. +0 −4 homeassistant/config.py
  157. +8 −0 homeassistant/config_entries.py
  158. +2 −0 homeassistant/const.py
  159. +2 −0 homeassistant/generated/config_flows.py
  160. +5 −0 homeassistant/loader.py
  161. +2 −2 homeassistant/package_constraints.txt
  162. +1 −1 homeassistant/util/package.py
  163. +30 −11 requirements_all.txt
  164. +13 −6 requirements_test_all.txt
  165. +3 −1 script/gen_requirements_all.py
  166. +1 −1 tests/components/alexa/__init__.py
  167. +4 −4 tests/components/alexa/test_smart_home.py
  168. +56 −0 tests/components/alexa/test_state_report.py
  169. +9 −11 tests/components/cloud/__init__.py
  170. +11 −1 tests/components/cloud/conftest.py
  171. +150 −44 tests/components/cloud/test_client.py
  172. +9 −7 tests/components/cloud/test_http_api.py
  173. +22 −0 tests/components/cloud/test_init.py
  174. +110 −29 tests/components/demo/test_cover.py
  175. +26 −6 tests/components/device_tracker/test_init.py
  176. +27 −0 tests/components/esphome/test_config_flow.py
  177. +28 −1 tests/components/google_assistant/__init__.py
  178. +5 −6 tests/components/google_assistant/test_smart_home.py
  179. +3 −6 tests/components/google_assistant/test_trait.py
  180. +163 −58 tests/components/group/test_cover.py
  181. +96 −0 tests/components/manual/test_alarm_control_panel.py
  182. +78 −0 tests/components/manual_mqtt/test_alarm_control_panel.py
  183. +1 −0 tests/components/met/__init__.py
  184. +24 −0 tests/components/met/conftest.py
  185. +149 −0 tests/components/met/test_config_flow.py
  186. +52 −0 tests/components/met/test_weather.py
  187. +193 −17 tests/components/mqtt/test_cover.py
  188. +25 −0 tests/components/onboarding/test_views.py
  189. +1 −0 tests/components/qld_bushfire/__init__.py
  190. +189 −0 tests/components/qld_bushfire/test_geo_location.py
  191. +19 −1 tests/components/samsungtv/test_media_player.py
  192. +43 −0 tests/components/template/test_cover.py
  193. +29 −1 tests/components/zwave/test_cover.py
  194. +15 −1 tests/test_config_entries.py
  195. +10 −0 tests/test_loader.py
  196. +1 −1 tests/util/test_package.py
  197. +1 −1 virtualization/Docker/scripts/tellstick
@@ -157,6 +157,7 @@ omit =
homeassistant/components/eight_sleep/*
homeassistant/components/eliqonline/sensor.py
homeassistant/components/elkm1/*
homeassistant/components/elv/switch.py
homeassistant/components/emby/media_player.py
homeassistant/components/emoncms/sensor.py
homeassistant/components/emoncms_history/*
@@ -451,6 +452,7 @@ omit =
homeassistant/components/ping/device_tracker.py
homeassistant/components/pioneer/media_player.py
homeassistant/components/pjlink/media_player.py
homeassistant/components/plaato/*
homeassistant/components/plex/media_player.py
homeassistant/components/plex/sensor.py
homeassistant/components/plum_lightpad/*
@@ -631,6 +633,7 @@ omit =
homeassistant/components/tplink/switch.py
homeassistant/components/tplink_lte/*
homeassistant/components/traccar/device_tracker.py
homeassistant/components/traccar/const.py
homeassistant/components/trackr/device_tracker.py
homeassistant/components/tradfri/*
homeassistant/components/tradfri/light.py
@@ -662,6 +665,7 @@ omit =
homeassistant/components/viaggiatreno/sensor.py
homeassistant/components/vizio/media_player.py
homeassistant/components/vlc/media_player.py
homeassistant/components/vlc_telnet/media_player.py
homeassistant/components/volkszaehler/sensor.py
homeassistant/components/volumio/media_player.py
homeassistant/components/volvooncall/*
@@ -95,6 +95,7 @@ virtualization/vagrant/config

# Visual Studio Code
.vscode
.devcontainer

# Built docs
docs/build
@@ -72,6 +72,7 @@ homeassistant/components/ecovacs/* @OverloadUT
homeassistant/components/edp_redy/* @abmantis
homeassistant/components/egardia/* @jeroenterheerdt
homeassistant/components/eight_sleep/* @mezz64
homeassistant/components/elv/* @majuss
homeassistant/components/emby/* @mezz64
homeassistant/components/enigma2/* @fbradyirl
homeassistant/components/enocean/* @bdurrer
@@ -115,6 +116,7 @@ homeassistant/components/homeassistant/* @home-assistant/core
homeassistant/components/homekit/* @cdce8p
homeassistant/components/homekit_controller/* @Jc2k
homeassistant/components/homematic/* @pvizeli @danielperna84
homeassistant/components/honeywell/* @zxdavb
homeassistant/components/html5/* @robbiet480
homeassistant/components/http/* @home-assistant/core
homeassistant/components/huawei_lte/* @scop
@@ -158,7 +160,7 @@ homeassistant/components/mcp23017/* @jardiamj
homeassistant/components/mediaroom/* @dgomes
homeassistant/components/melissa/* @kennedyshead
homeassistant/components/met/* @danielhiversen
homeassistant/components/meteo_france/* @victorcerutti
homeassistant/components/meteo_france/* @victorcerutti @oncleben31
homeassistant/components/meteoalarm/* @rolfberkenbosch
homeassistant/components/miflora/* @danielhiversen @ChristianKuehnel
homeassistant/components/mill/* @danielhiversen
@@ -182,6 +184,7 @@ homeassistant/components/nsw_fuel_station/* @nickw444
homeassistant/components/nuki/* @pschmitt
homeassistant/components/ohmconnect/* @robbiet480
homeassistant/components/onboarding/* @home-assistant/core
homeassistant/components/opentherm_gw/* @mvn23
homeassistant/components/openuv/* @bachya
homeassistant/components/openweathermap/* @fabaff
homeassistant/components/orangepi_gpio/* @pascallj
@@ -191,12 +194,14 @@ homeassistant/components/panel_iframe/* @home-assistant/frontend
homeassistant/components/persistent_notification/* @home-assistant/core
homeassistant/components/philips_js/* @elupus
homeassistant/components/pi_hole/* @fabaff
homeassistant/components/plaato/* @JohNan
homeassistant/components/plant/* @ChristianKuehnel
homeassistant/components/point/* @fredrike
homeassistant/components/ps4/* @ktnrg45
homeassistant/components/ptvsd/* @swamp-ig
homeassistant/components/push/* @dgomes
homeassistant/components/pvoutput/* @fabaff
homeassistant/components/qld_bushfire/* @exxamalte
homeassistant/components/qnap/* @colinodell
homeassistant/components/quantum_gateway/* @cisasteelersfan
homeassistant/components/qwikswitch/* @kellerza
@@ -271,6 +276,7 @@ homeassistant/components/utility_meter/* @dgomes
homeassistant/components/velux/* @Julius2342
homeassistant/components/version/* @fabaff
homeassistant/components/vizio/* @raman325
homeassistant/components/vlc_telnet/* @rodripf
homeassistant/components/waqi/* @andrey-git
homeassistant/components/watson_tts/* @rutkai
homeassistant/components/weather/* @fabaff
@@ -8,7 +8,7 @@ trigger:
pr: none
variables:
- name: versionBuilder
value: '3.2'
value: '4.2'
- group: docker
- group: github
- group: twine
@@ -0,0 +1,28 @@
{
"config": {
"abort": {
"single_instance_allowed": "Es ist nur eine einzige Konfiguration von AdGuard Home zul\u00e4ssig."
},
"error": {
"connection_error": "Fehler beim Herstellen einer Verbindung."
},
"step": {
"hassio_confirm": {
"description": "M\u00f6chtest du Home Assistant so konfigurieren, dass eine Verbindung mit AdGuard Home als Hass.io-Add-On hergestellt wird: {addon}?",
"title": "AdGuard Home \u00fcber das Hass.io Add-on"
},
"user": {
"data": {
"host": "Host",
"password": "Passwort",
"port": "Port",
"ssl": "AdGuard Home verwendet ein SSL-Zertifikat",
"username": "Benutzername",
"verify_ssl": "AdGuard Home verwendet ein richtiges Zertifikat"
},
"description": "Richte deine AdGuard Home-Instanz ein um sie zu \u00dcberwachen und zu Steuern.",
"title": "Verkn\u00fcpfe AdGuard Home."
}
}
}
}
@@ -8,6 +8,7 @@
},
"step": {
"hassio_confirm": {
"description": "W\u00ebllt dir Home Assistant konfigur\u00e9iere fir sech mam AdGuard Home ze verbannen dee vum hass.io add-on {addon} bereet gestallt g\u00ebtt?",
"title": "AdGuard Home via Hass.io add-on"
},
"user": {
@@ -19,6 +20,7 @@
"username": "Benotzernumm",
"verify_ssl": "AdGuard Home benotzt een eegenen Zertifikat"
},
"description": "Konfigur\u00e9iert \u00e4r AdGuard Home Instanz fir d'Iwwerwaachung an d'Kontroll z'erlaben.",
"title": "Verbannt \u00e4ren AdGuard Home"
}
},
@@ -1,26 +1,26 @@
{
"config": {
"abort": {
"single_instance_allowed": "Wymagana jest tylko jedna konfiguracja AdGuard Home."
"single_instance_allowed": "Dozwolona jest tylko jedna konfiguracja AdGuard Home."
},
"error": {
"connection_error": "Nieudane po\u0142\u0105czenie."
"connection_error": "Po\u0142\u0105czenie nieudane."
},
"step": {
"hassio_confirm": {
"description": "Czy chcesz skonfigurowa\u0107 Home Assistant'a, aby po\u0142\u0105czy\u0142 si\u0119 z AdGuard Home przez dodatek hass.io {addon}?",
"title": "AdGuard Home dzi\u0119ki dodatkowi Hass.io"
"description": "Czy chcesz skonfigurowa\u0107 Home Assistant'a, aby po\u0142\u0105czy\u0142 si\u0119 z AdGuard Home przez dodatek Hass.io {addon}?",
"title": "AdGuard Home przez dodatek Hass.io"
},
"user": {
"data": {
"host": "Host",
"password": "Has\u0142o",
"port": "Port",
"ssl": "AdGuard Home u\u017cywa certyfikatu SSL.",
"ssl": "AdGuard Home u\u017cywa certyfikatu SSL",
"username": "Nazwa u\u017cytkownika",
"verify_ssl": "AdGuard Home u\u017cywa odpowiedniego certyfikatu."
},
"description": "Skonfiguruj swoj\u0105 instancj\u0119 AdGuard Home aby umo\u017cliwi\u0107 monitorowanie i nadz\u00f3r sieci.",
"description": "Skonfiguruj swoj\u0105 instancj\u0119 AdGuard Home, aby umo\u017cliwi\u0107 monitorowanie i nadz\u00f3r sieci.",
"title": "Po\u0142\u0105cz sw\u00f3j AdGuard Home"
}
},
@@ -0,0 +1,14 @@
{
"config": {
"step": {
"user": {
"data": {
"host": "\u0110\u1ecba ch\u1ec9",
"password": "M\u1eadt kh\u1ea9u",
"port": "C\u1ed5ng",
"username": "T\u00ean \u0111\u0103ng nh\u1eadp"
}
}
}
}
}
@@ -19,6 +19,7 @@
ATTR_CHANGED_BY = 'changed_by'
FORMAT_TEXT = 'text'
FORMAT_NUMBER = 'number'
ATTR_CODE_ARM_REQUIRED = 'code_arm_required'

ENTITY_ID_FORMAT = DOMAIN + '.{}'

@@ -87,6 +88,11 @@ def changed_by(self):
"""Last change triggered by."""
return None

@property
def code_arm_required(self):
"""Whether the code is required for arm actions."""
return True

def alarm_disarm(self, code=None):
"""Send disarm command."""
raise NotImplementedError()
@@ -159,6 +165,7 @@ def state_attributes(self):
"""Return the state attributes."""
state_attr = {
ATTR_CODE_FORMAT: self.code_format,
ATTR_CHANGED_BY: self.changed_by
ATTR_CHANGED_BY: self.changed_by,
ATTR_CODE_ARM_REQUIRED: self.code_arm_required
}
return state_attr
@@ -1,14 +1,26 @@
"""Config helpers for Alexa."""
from .state_report import async_enable_proactive_mode


class AbstractConfig:
"""Hold the configuration for Alexa."""

_unsub_proactive_report = None

def __init__(self, hass):
"""Initialize abstract config."""
self.hass = hass

@property
def supports_auth(self):
"""Return if config supports auth."""
return False

@property
def should_report_state(self):
"""Return if states should be proactively reported."""
return False

@property
def endpoint(self):
"""Endpoint for report state."""
@@ -19,6 +31,30 @@ def entity_config(self):
"""Return entity config."""
return {}

@property
def is_reporting_states(self):
"""Return if proactive mode is enabled."""
return self._unsub_proactive_report is not None

async def async_enable_proactive_mode(self):
"""Enable proactive mode."""
if self._unsub_proactive_report is None:
self._unsub_proactive_report = self.hass.async_create_task(
async_enable_proactive_mode(self.hass, self)
)
resp = await self._unsub_proactive_report

# Failed to start reporting.
if resp is None:
self._unsub_proactive_report = None

async def async_disable_proactive_mode(self):
"""Disable proactive mode."""
unsub_func = await self._unsub_proactive_report
if unsub_func:
unsub_func()
self._unsub_proactive_report = None

def should_expose(self, entity_id):
"""If an entity should be exposed."""
# pylint: disable=no-self-use
@@ -168,6 +168,20 @@ def serialize_properties(self):
for prop in interface.serialize_properties():
yield prop

def serialize_discovery(self):
"""Serialize the entity for discovery."""
return {
'displayCategories': self.display_categories(),
'cookie': {},
'endpointId': self.alexa_id(),
'friendlyName': self.friendly_name(),
'description': self.description(),
'manufacturerName': 'Home Assistant',
'capabilities': [
i.serialize_discovery() for i in self.interfaces()
]
}


@callback
def async_get_entities(hass, config) -> List[AlexaEntity]:
@@ -12,8 +12,12 @@ class UnsupportedProperty(HomeAssistantError):
"""This entity does not support the requested Smart Home API property."""


class NoTokenAvailable(HomeAssistantError):
"""There is no access token available."""


class AlexaError(Exception):
"""Base class for errors that can be serialized by the Alexa API.
"""Base class for errors that can be serialized for the Alexa API.
A handler can raise subclasses of this to return an error to the request.
"""
@@ -54,17 +54,7 @@
Async friendly.
"""
discovery_endpoints = [
{
'displayCategories': alexa_entity.display_categories(),
'cookie': {},
'endpointId': alexa_entity.alexa_id(),
'friendlyName': alexa_entity.friendly_name(),
'description': alexa_entity.description(),
'manufacturerName': 'Home Assistant',
'capabilities': [
i.serialize_discovery() for i in alexa_entity.interfaces()
]
}
alexa_entity.serialize_discovery()
for alexa_entity in async_get_entities(hass, config)
if config.should_expose(alexa_entity.entity_id)
]
@@ -87,7 +77,9 @@

if config.supports_auth:
await config.async_accept_grant(auth_code)
await async_enable_proactive_mode(hass, config)

if config.should_report_state:
await async_enable_proactive_mode(hass, config)

return directive.response(
name='AcceptGrant.Response',
@@ -48,7 +48,7 @@ def load_entity(self, hass, config):
self.entity_id = _endpoint_id.replace('#', '.')

self.entity = hass.states.get(self.entity_id)
if not self.entity:
if not self.entity or not config.should_expose(self.entity_id):
raise AlexaInvalidEndpointError(_endpoint_id)

self.endpoint = ENTITY_ADAPTERS[self.entity.domain](

0 comments on commit c2d314f

Please sign in to comment.
You can’t perform that action at this time.