├── docs ├── build │ └── .empty ├── screenshots.png ├── screenshot-components.png └── source │ ├── _static │ ├── logo.png │ ├── favicon.ico │ └── logo-apple.png │ ├── api │ ├── bootstrap.rst │ ├── entity.rst │ ├── device_tracker.rst │ ├── event.rst │ └── core.rst │ ├── _templates │ ├── links.html │ └── sourcelink.html │ └── index.rst ├── tests ├── testing_config │ ├── kira_codes.yaml │ ├── .remember_the_milk.conf │ └── custom_components │ │ ├── test_package │ │ ├── const.py │ │ └── __init__.py │ │ ├── switch │ │ ├── .translations │ │ │ ├── test.es.json │ │ │ ├── test.en.json │ │ │ └── test.de.json │ │ └── test.py │ │ ├── test_standalone.py │ │ ├── light │ │ └── test.py │ │ └── device_tracker │ │ └── test.py ├── __init__.py ├── scripts │ ├── __init__.py │ └── test_init.py ├── helpers │ └── __init__.py ├── util │ └── __init__.py ├── components │ ├── __init__.py │ ├── cast │ │ ├── __init__.py │ │ └── test_init.py │ ├── hue │ │ └── __init__.py │ ├── lock │ │ └── __init__.py │ ├── mqtt │ │ └── __init__.py │ ├── nest │ │ └── __init__.py │ ├── scene │ │ └── __init__.py │ ├── tts │ │ └── __init__.py │ ├── zone │ │ └── __init__.py │ ├── alexa │ │ └── __init__.py │ ├── automation │ │ └── __init__.py │ ├── camera │ │ ├── __init__.py │ │ ├── test_demo.py │ │ └── test_mqtt.py │ ├── cloud │ │ └── __init__.py │ ├── config │ │ └── __init__.py │ ├── deconz │ │ └── __init__.py │ ├── emulated_hue │ │ └── __init__.py │ ├── group │ │ └── __init__.py │ ├── light │ │ └── __init__.py │ ├── recorder │ │ └── __init__.py │ ├── remote │ │ └── __init__.py │ ├── sensor │ │ ├── __init__.py │ │ ├── test_random.py │ │ └── test_worldclock.py │ ├── sonos │ │ ├── __init__.py │ │ └── test_init.py │ ├── switch │ │ └── __init__.py │ ├── timer │ │ └── __init__.py │ ├── vacuum │ │ └── __init__.py │ ├── zwave │ │ └── __init__.py │ ├── climate │ │ └── __init__.py │ ├── counter │ │ └── __init__.py │ ├── frontend │ │ └── __init__.py │ ├── mailbox │ │ └── __init__.py │ ├── notify │ │ └── __init__.py │ ├── weather │ │ └── __init__.py │ ├── calendar │ │ ├── __init__.py │ │ └── test_demo.py │ ├── binary_sensor │ │ ├── __init__.py │ │ └── test_binary_sensor.py │ ├── device_tracker │ │ └── __init__.py │ ├── media_player │ │ └── __init__.py │ ├── alarm_control_panel │ │ └── __init__.py │ ├── homematicip_cloud │ │ └── __init__.py │ ├── image_processing │ │ └── __init__.py │ ├── persistent_notification │ │ └── __init__.py │ ├── hassio │ │ └── __init__.py │ ├── homekit │ │ ├── common.py │ │ └── conftest.py │ ├── onboarding │ │ └── __init__.py │ ├── http │ │ ├── test_view.py │ │ └── __init__.py │ ├── test_introduction.py │ ├── auth │ │ └── __init__.py │ ├── google_assistant │ │ └── test_init.py │ └── fan │ │ └── __init__.py ├── test_util │ ├── __init__.py │ └── test_aiohttp.py ├── auth │ ├── providers │ │ └── __init__.py │ └── __init__.py ├── fixtures │ ├── efergy_budget.json │ ├── efergy_cost.json │ ├── efergy_energy.json │ ├── microsoft_face_create_person.json │ ├── efergy_instant.json │ ├── vultr_account_info.json │ ├── melissa_status.json │ ├── sleepiq-login.json │ ├── foobot_devices.json │ ├── efergy_current_values_single.json │ ├── ring_oauth.json │ ├── sleepiq-login-failed.json │ ├── ring_doorbots.json │ ├── google_maps_elevation.json │ ├── microsoft_face_persongroups.json │ ├── wunderground-error.json │ ├── freegeoip.io.json │ ├── ip-api.com.json │ ├── alpr_stdout.txt │ ├── microsoft_face_identify.json │ ├── wunderground-invalid.json │ ├── Ddwrt_Status_Wireless.txt │ ├── efergy_current_values_multi.json │ ├── melissa_cur_settings.json │ ├── ring_chime_health_attrs.json │ ├── ring_doorboot_health_attrs.json │ ├── wsdot.json │ ├── sleepiq-familystatus.json │ ├── melissa_fetch_devices.json │ ├── foobot_data.json │ ├── Ddwrt_Status_Lan.txt │ ├── microsoft_face_detect.json │ ├── microsoft_face_persons.json │ ├── feedreader.xml │ ├── sleepiq-bed.json │ ├── ring_ding_active.json │ ├── feedreader3.xml │ ├── feedreader1.xml │ ├── pushbullet_devices.json │ ├── bom_weather.json │ └── coinmarketcap.json └── resources │ └── pyhelloworld3.zip ├── .hound.yml ├── virtualization ├── vagrant │ ├── config │ │ └── .placeholder │ ├── Vagrantfile │ └── home-assistant@.service └── Docker │ └── scripts │ ├── phantomjs │ ├── tellstick │ ├── ssocr │ └── openalpr ├── .isort.cfg ├── homeassistant ├── __init__.py ├── components │ ├── nest │ │ ├── const.py │ │ └── .translations │ │ │ ├── hu.json │ │ │ ├── it.json │ │ │ ├── de.json │ │ │ └── vi.json │ ├── recorder │ │ ├── const.py │ │ └── services.yaml │ ├── google_assistant │ │ ├── services.yaml │ │ └── helpers.py │ ├── tts │ │ ├── demo.mp3 │ │ └── services.yaml │ ├── camera │ │ ├── demo_0.jpg │ │ ├── demo_1.jpg │ │ ├── demo_2.jpg │ │ └── demo_3.jpg │ ├── http │ │ └── const.py │ ├── zone │ │ ├── const.py │ │ ├── .translations │ │ │ ├── sv.json │ │ │ ├── en.json │ │ │ ├── cy.json │ │ │ ├── nl.json │ │ │ ├── no.json │ │ │ ├── ca.json │ │ │ ├── pt-BR.json │ │ │ ├── pt.json │ │ │ ├── de.json │ │ │ ├── lb.json │ │ │ ├── it.json │ │ │ ├── fr.json │ │ │ ├── sl.json │ │ │ ├── hu.json │ │ │ ├── pl.json │ │ │ ├── zh-Hant.json │ │ │ ├── zh-Hans.json │ │ │ ├── cs.json │ │ │ ├── ko.json │ │ │ ├── vi.json │ │ │ ├── ru.json │ │ │ └── bg.json │ │ └── strings.json │ ├── homekit │ │ └── services.yaml │ ├── onboarding │ │ └── const.py │ ├── light │ │ ├── light_profiles.csv │ │ ├── zigbee.py │ │ └── qwikswitch.py │ ├── sensor │ │ ├── strings.season.json │ │ ├── .translations │ │ │ ├── season.cs.json │ │ │ ├── season.cy.json │ │ │ ├── season.en.json │ │ │ ├── season.ja.json │ │ │ ├── season.nl.json │ │ │ ├── season.sl.json │ │ │ ├── season.ca.json │ │ │ ├── season.fi.json │ │ │ ├── season.it.json │ │ │ ├── season.no.json │ │ │ ├── season.pl.json │ │ │ ├── season.sv.json │ │ │ ├── season.da.json │ │ │ ├── season.de.json │ │ │ ├── season.es.json │ │ │ ├── season.fr.json │ │ │ ├── season.hu.json │ │ │ ├── season.lb.json │ │ │ ├── season.pt.json │ │ │ ├── season.pt-BR.json │ │ │ ├── season.ko.json │ │ │ ├── season.ro.json │ │ │ ├── season.zh-Hans.json │ │ │ ├── season.zh-Hant.json │ │ │ ├── season.vi.json │ │ │ ├── season.bg.json │ │ │ ├── season.ru.json │ │ │ └── season.th.json │ │ ├── strings.moon.json │ │ └── insteon_plm.py │ ├── hue │ │ ├── const.py │ │ ├── .translations │ │ │ ├── es.json │ │ │ ├── da.json │ │ │ ├── ro.json │ │ │ ├── vi.json │ │ │ ├── en.json │ │ │ ├── no.json │ │ │ ├── cy.json │ │ │ ├── nl.json │ │ │ └── pt.json │ │ ├── errors.py │ │ └── strings.json │ ├── deconz │ │ ├── .translations │ │ │ ├── da.json │ │ │ ├── cy.json │ │ │ ├── it.json │ │ │ ├── vi.json │ │ │ └── hu.json │ │ ├── const.py │ │ └── services.yaml │ ├── scene │ │ ├── services.yaml │ │ └── velux.py │ ├── conversation │ │ └── services.yaml │ ├── frontend │ │ └── services.yaml │ ├── sonos │ │ ├── .translations │ │ │ ├── de.json │ │ │ ├── hu.json │ │ │ ├── en.json │ │ │ ├── it.json │ │ │ ├── sl.json │ │ │ ├── ca.json │ │ │ ├── nl.json │ │ │ ├── pl.json │ │ │ ├── lb.json │ │ │ ├── no.json │ │ │ ├── sv.json │ │ │ ├── cs.json │ │ │ ├── zh-Hant.json │ │ │ ├── zh-Hans.json │ │ │ ├── vi.json │ │ │ ├── ko.json │ │ │ └── ru.json │ │ ├── strings.json │ │ └── __init__.py │ ├── cast │ │ ├── .translations │ │ │ ├── de.json │ │ │ ├── hu.json │ │ │ ├── en.json │ │ │ ├── it.json │ │ │ ├── sl.json │ │ │ ├── nl.json │ │ │ ├── ca.json │ │ │ ├── pl.json │ │ │ ├── sv.json │ │ │ ├── lb.json │ │ │ ├── no.json │ │ │ ├── cs.json │ │ │ ├── zh-Hant.json │ │ │ ├── zh-Hans.json │ │ │ ├── vi.json │ │ │ ├── ko.json │ │ │ └── ru.json │ │ ├── strings.json │ │ └── __init__.py │ ├── map.py │ ├── zha │ │ └── services.yaml │ ├── ads │ │ └── services.yaml │ ├── system_log │ │ └── services.yaml │ ├── ihc │ │ ├── const.py │ │ └── services.yaml │ ├── homematicip_cloud │ │ ├── const.py │ │ ├── errors.py │ │ ├── strings.json │ │ └── .translations │ │ │ └── en.json │ ├── counter │ │ └── services.yaml │ ├── alexa │ │ └── const.py │ ├── config │ │ ├── script.py │ │ ├── group.py │ │ └── core.py │ ├── image_processing │ │ └── services.yaml │ ├── persistent_notification │ │ └── services.yaml │ ├── mqtt │ │ └── services.yaml │ ├── switch │ │ ├── qwikswitch.py │ │ └── zigbee.py │ ├── rainmachine │ │ └── services.yaml │ ├── remember_the_milk │ │ └── services.yaml │ ├── mycroft.py │ ├── telegram_bot │ │ └── broadcast.py │ ├── automation │ │ └── services.yaml │ ├── browser.py │ ├── timer │ │ └── services.yaml │ ├── cloud │ │ └── const.py │ ├── calendar │ │ └── services.yaml │ ├── notify │ │ └── demo.py │ ├── binary_sensor │ │ ├── tcp.py │ │ ├── tellduslive.py │ │ └── zigbee.py │ ├── lock │ │ └── volvooncall.py │ └── velbus.py ├── auth │ ├── const.py │ └── util.py ├── helpers │ ├── typing.py │ ├── icon.py │ ├── signal.py │ └── location.py ├── util │ └── decorator.py ├── package_constraints.txt ├── scripts │ ├── macos │ │ └── launchd.plist │ └── ensure_config.py └── exceptions.py ├── MANIFEST.in ├── requirements_docs.txt ├── script ├── test ├── setup ├── update ├── server ├── bootstrap ├── travis_deploy ├── lint_docker ├── dev_openzwave_docker ├── test_docker ├── translations_develop ├── monkeytype ├── dev_docker ├── release └── lint ├── .dockerignore ├── .gitattributes ├── mypy.ini ├── .ignore ├── .github └── move.yml ├── requirements_test.txt ├── CONTRIBUTING.md ├── .travis.yml └── Dockerfile /docs/build/.empty: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/testing_config/kira_codes.yaml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.hound.yml: -------------------------------------------------------------------------------- 1 | python: 2 | enabled: true 3 | -------------------------------------------------------------------------------- /virtualization/vagrant/config/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.isort.cfg: -------------------------------------------------------------------------------- 1 | [settings] 2 | multi_line_output=4 3 | -------------------------------------------------------------------------------- /tests/__init__.py: -------------------------------------------------------------------------------- 1 | """Tests for Home Assistant.""" 2 | -------------------------------------------------------------------------------- /tests/scripts/__init__.py: -------------------------------------------------------------------------------- 1 | """Tests for the scripts.""" 2 | -------------------------------------------------------------------------------- /tests/helpers/__init__.py: -------------------------------------------------------------------------------- 1 | """The tests for the helpers.""" 2 | -------------------------------------------------------------------------------- /tests/util/__init__.py: -------------------------------------------------------------------------------- 1 | """The tests for the utilities.""" 2 | -------------------------------------------------------------------------------- /homeassistant/__init__.py: -------------------------------------------------------------------------------- 1 | """Init file for Home Assistant.""" 2 | -------------------------------------------------------------------------------- /tests/components/__init__.py: -------------------------------------------------------------------------------- 1 | """The tests for components.""" 2 | -------------------------------------------------------------------------------- /tests/test_util/__init__.py: -------------------------------------------------------------------------------- 1 | """Tests for the test utilities.""" 2 | -------------------------------------------------------------------------------- /tests/auth/providers/__init__.py: -------------------------------------------------------------------------------- 1 | """Tests for the auth providers.""" 2 | -------------------------------------------------------------------------------- /tests/components/cast/__init__.py: -------------------------------------------------------------------------------- 1 | """Tests for the Cast component.""" 2 | -------------------------------------------------------------------------------- /tests/components/hue/__init__.py: -------------------------------------------------------------------------------- 1 | """Tests for the Hue component.""" 2 | -------------------------------------------------------------------------------- /tests/components/lock/__init__.py: -------------------------------------------------------------------------------- 1 | """The tests for Lock platforms.""" 2 | -------------------------------------------------------------------------------- /tests/components/mqtt/__init__.py: -------------------------------------------------------------------------------- 1 | """Tests for MQTT component.""" 2 | -------------------------------------------------------------------------------- /tests/components/nest/__init__.py: -------------------------------------------------------------------------------- 1 | """Tests for the Nest component.""" 2 | -------------------------------------------------------------------------------- /tests/components/scene/__init__.py: -------------------------------------------------------------------------------- 1 | """Tests for scene component.""" 2 | -------------------------------------------------------------------------------- /tests/components/tts/__init__.py: -------------------------------------------------------------------------------- 1 | """The tests for tts platforms.""" 2 | -------------------------------------------------------------------------------- /tests/components/zone/__init__.py: -------------------------------------------------------------------------------- 1 | """Tests for the zone component.""" 2 | -------------------------------------------------------------------------------- /tests/testing_config/.remember_the_milk.conf: -------------------------------------------------------------------------------- 1 | {"myprofile": {"id_map": {}}} -------------------------------------------------------------------------------- /tests/auth/__init__.py: -------------------------------------------------------------------------------- 1 | """Tests for the Home Assistant auth module.""" 2 | -------------------------------------------------------------------------------- /tests/components/alexa/__init__.py: -------------------------------------------------------------------------------- 1 | """Tests for the Alexa integration.""" 2 | -------------------------------------------------------------------------------- /tests/components/automation/__init__.py: -------------------------------------------------------------------------------- 1 | """The tests for Automation.""" 2 | -------------------------------------------------------------------------------- /tests/components/camera/__init__.py: -------------------------------------------------------------------------------- 1 | """The tests for camera platforms.""" 2 | -------------------------------------------------------------------------------- /tests/components/cloud/__init__.py: -------------------------------------------------------------------------------- 1 | """Tests for the cloud component.""" 2 | -------------------------------------------------------------------------------- /tests/components/config/__init__.py: -------------------------------------------------------------------------------- 1 | """Tests for the config component.""" 2 | -------------------------------------------------------------------------------- /tests/components/deconz/__init__.py: -------------------------------------------------------------------------------- 1 | """Tests for the deCONZ component.""" 2 | -------------------------------------------------------------------------------- /tests/components/emulated_hue/__init__.py: -------------------------------------------------------------------------------- 1 | """Tests for emulated_hue.""" 2 | -------------------------------------------------------------------------------- /tests/components/group/__init__.py: -------------------------------------------------------------------------------- 1 | """Tests for the group component.""" 2 | -------------------------------------------------------------------------------- /tests/components/light/__init__.py: -------------------------------------------------------------------------------- 1 | """The tests for Light platforms.""" 2 | -------------------------------------------------------------------------------- /tests/components/recorder/__init__.py: -------------------------------------------------------------------------------- 1 | """Tests for Recorder component.""" 2 | -------------------------------------------------------------------------------- /tests/components/remote/__init__.py: -------------------------------------------------------------------------------- 1 | """The tests for Remote platforms.""" 2 | -------------------------------------------------------------------------------- /tests/components/sensor/__init__.py: -------------------------------------------------------------------------------- 1 | """The tests for Sensor platforms.""" 2 | -------------------------------------------------------------------------------- /tests/components/sonos/__init__.py: -------------------------------------------------------------------------------- 1 | """Tests for the Sonos component.""" 2 | -------------------------------------------------------------------------------- /tests/components/switch/__init__.py: -------------------------------------------------------------------------------- 1 | """The tests for Switch platforms.""" 2 | -------------------------------------------------------------------------------- /tests/components/timer/__init__.py: -------------------------------------------------------------------------------- 1 | """Test env for timer component.""" 2 | -------------------------------------------------------------------------------- /tests/components/vacuum/__init__.py: -------------------------------------------------------------------------------- 1 | """The tests for vacuum platforms.""" 2 | -------------------------------------------------------------------------------- /tests/components/zwave/__init__.py: -------------------------------------------------------------------------------- 1 | """Tests for the Z-Wave component.""" 2 | -------------------------------------------------------------------------------- /tests/components/climate/__init__.py: -------------------------------------------------------------------------------- 1 | """The tests for climate component.""" 2 | -------------------------------------------------------------------------------- /tests/components/counter/__init__.py: -------------------------------------------------------------------------------- 1 | """Tests for the counter component.""" 2 | -------------------------------------------------------------------------------- /tests/components/frontend/__init__.py: -------------------------------------------------------------------------------- 1 | """Tests for the frontend component.""" 2 | -------------------------------------------------------------------------------- /tests/components/mailbox/__init__.py: -------------------------------------------------------------------------------- 1 | """The tests for mailbox platforms.""" 2 | -------------------------------------------------------------------------------- /tests/components/notify/__init__.py: -------------------------------------------------------------------------------- 1 | """The tests for notification platforms.""" 2 | -------------------------------------------------------------------------------- /tests/components/weather/__init__.py: -------------------------------------------------------------------------------- 1 | """The tests for Weather platforms.""" 2 | -------------------------------------------------------------------------------- /tests/components/calendar/__init__.py: -------------------------------------------------------------------------------- 1 | """The tests for calendar sensor platforms.""" 2 | -------------------------------------------------------------------------------- /docs/screenshots.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zen/home-assistant/dev/docs/screenshots.png -------------------------------------------------------------------------------- /tests/components/binary_sensor/__init__.py: -------------------------------------------------------------------------------- 1 | """The tests for Binary sensor platforms.""" 2 | -------------------------------------------------------------------------------- /tests/components/calendar/test_demo.py: -------------------------------------------------------------------------------- 1 | """The tests for the demo calendar component.""" 2 | -------------------------------------------------------------------------------- /tests/components/device_tracker/__init__.py: -------------------------------------------------------------------------------- 1 | """The tests for Device tracker platforms.""" 2 | -------------------------------------------------------------------------------- /tests/components/media_player/__init__.py: -------------------------------------------------------------------------------- 1 | """The tests for Media player platforms.""" 2 | -------------------------------------------------------------------------------- /tests/fixtures/efergy_budget.json: -------------------------------------------------------------------------------- 1 | { 2 | "status": "ok", 3 | "monthly_budget": 250.0000 4 | } -------------------------------------------------------------------------------- /tests/components/alarm_control_panel/__init__.py: -------------------------------------------------------------------------------- 1 | """The tests for Alarm control panel platforms.""" 2 | -------------------------------------------------------------------------------- /tests/components/homematicip_cloud/__init__.py: -------------------------------------------------------------------------------- 1 | """Tests for the HomematicIP Cloud component.""" 2 | -------------------------------------------------------------------------------- /tests/components/image_processing/__init__.py: -------------------------------------------------------------------------------- 1 | """Test 'image_processing' component platforms.""" 2 | -------------------------------------------------------------------------------- /homeassistant/components/nest/const.py: -------------------------------------------------------------------------------- 1 | """Constants used by the Nest component.""" 2 | DOMAIN = 'nest' 3 | -------------------------------------------------------------------------------- /tests/components/persistent_notification/__init__.py: -------------------------------------------------------------------------------- 1 | """Test the persistent notification component.""" 2 | -------------------------------------------------------------------------------- /tests/fixtures/efergy_cost.json: -------------------------------------------------------------------------------- 1 | { 2 | "sum": "5.27", 3 | "duration": 70320, 4 | "units": "GBP" 5 | } -------------------------------------------------------------------------------- /tests/fixtures/efergy_energy.json: -------------------------------------------------------------------------------- 1 | { 2 | "sum": "38.21", 3 | "duration": 70320, 4 | "units": "kWh" 5 | } -------------------------------------------------------------------------------- /docs/screenshot-components.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zen/home-assistant/dev/docs/screenshot-components.png -------------------------------------------------------------------------------- /docs/source/_static/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zen/home-assistant/dev/docs/source/_static/logo.png -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include README.rst 2 | include LICENSE.md 3 | graft homeassistant 4 | recursive-exclude * *.py[co] 5 | -------------------------------------------------------------------------------- /docs/source/_static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zen/home-assistant/dev/docs/source/_static/favicon.ico -------------------------------------------------------------------------------- /homeassistant/components/recorder/const.py: -------------------------------------------------------------------------------- 1 | """Recorder constants.""" 2 | 3 | DATA_INSTANCE = 'recorder_instance' 4 | -------------------------------------------------------------------------------- /requirements_docs.txt: -------------------------------------------------------------------------------- 1 | Sphinx==1.7.5 2 | sphinx-autodoc-typehints==1.3.0 3 | sphinx-autodoc-annotation==1.0.post1 4 | -------------------------------------------------------------------------------- /script/test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Executes the tests with tox. 3 | 4 | cd "$(dirname "$0")/.." 5 | 6 | tox -e py35 7 | -------------------------------------------------------------------------------- /tests/fixtures/microsoft_face_create_person.json: -------------------------------------------------------------------------------- 1 | { 2 | "personId":"25985303-c537-4467-b41d-bdb45cd95ca1" 3 | } 4 | -------------------------------------------------------------------------------- /docs/source/_static/logo-apple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zen/home-assistant/dev/docs/source/_static/logo-apple.png -------------------------------------------------------------------------------- /tests/fixtures/efergy_instant.json: -------------------------------------------------------------------------------- 1 | { 2 | "age": 1, 3 | "last_reading_time": 1486247836000, 4 | "reading": 1580 5 | } -------------------------------------------------------------------------------- /tests/resources/pyhelloworld3.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zen/home-assistant/dev/tests/resources/pyhelloworld3.zip -------------------------------------------------------------------------------- /homeassistant/components/google_assistant/services.yaml: -------------------------------------------------------------------------------- 1 | request_sync: 2 | description: Send a request_sync command to Google. -------------------------------------------------------------------------------- /homeassistant/components/tts/demo.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zen/home-assistant/dev/homeassistant/components/tts/demo.mp3 -------------------------------------------------------------------------------- /tests/testing_config/custom_components/test_package/const.py: -------------------------------------------------------------------------------- 1 | """Constants for test_package custom component.""" 2 | TEST = 5 3 | -------------------------------------------------------------------------------- /homeassistant/components/camera/demo_0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zen/home-assistant/dev/homeassistant/components/camera/demo_0.jpg -------------------------------------------------------------------------------- /homeassistant/components/camera/demo_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zen/home-assistant/dev/homeassistant/components/camera/demo_1.jpg -------------------------------------------------------------------------------- /homeassistant/components/camera/demo_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zen/home-assistant/dev/homeassistant/components/camera/demo_2.jpg -------------------------------------------------------------------------------- /homeassistant/components/camera/demo_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zen/home-assistant/dev/homeassistant/components/camera/demo_3.jpg -------------------------------------------------------------------------------- /tests/components/hassio/__init__.py: -------------------------------------------------------------------------------- 1 | """Tests for Hassio component.""" 2 | 3 | API_PASSWORD = 'pass1234' 4 | HASSIO_TOKEN = '123456' 5 | -------------------------------------------------------------------------------- /homeassistant/components/http/const.py: -------------------------------------------------------------------------------- 1 | """HTTP specific constants.""" 2 | KEY_AUTHENTICATED = 'ha_authenticated' 3 | KEY_REAL_IP = 'ha_real_ip' 4 | -------------------------------------------------------------------------------- /tests/testing_config/custom_components/switch/.translations/test.es.json: -------------------------------------------------------------------------------- 1 | { 2 | "state": { 3 | "string1": "Spanish Value 1" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /homeassistant/auth/const.py: -------------------------------------------------------------------------------- 1 | """Constants for the auth module.""" 2 | from datetime import timedelta 3 | 4 | ACCESS_TOKEN_EXPIRATION = timedelta(minutes=30) 5 | -------------------------------------------------------------------------------- /homeassistant/components/zone/const.py: -------------------------------------------------------------------------------- 1 | """Constants for the zone component.""" 2 | 3 | CONF_PASSIVE = 'passive' 4 | DOMAIN = 'zone' 5 | HOME_ZONE = 'home' 6 | -------------------------------------------------------------------------------- /tests/fixtures/vultr_account_info.json: -------------------------------------------------------------------------------- 1 | {"balance":"-123.00","pending_charges":"3.38","last_payment_date":"2017-08-11 15:04:04","last_payment_amount":"-10.00"} 2 | -------------------------------------------------------------------------------- /tests/testing_config/custom_components/switch/.translations/test.en.json: -------------------------------------------------------------------------------- 1 | { 2 | "state": { 3 | "string1": "Value 1", 4 | "string2": "Value 2" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /homeassistant/components/homekit/services.yaml: -------------------------------------------------------------------------------- 1 | # Describes the format for available HomeKit services 2 | 3 | start: 4 | description: Starts the HomeKit component driver. 5 | -------------------------------------------------------------------------------- /tests/testing_config/custom_components/switch/.translations/test.de.json: -------------------------------------------------------------------------------- 1 | { 2 | "state": { 3 | "string1": "German Value 1", 4 | "string2": "German Value 2" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /homeassistant/components/onboarding/const.py: -------------------------------------------------------------------------------- 1 | """Constants for the onboarding component.""" 2 | DOMAIN = 'onboarding' 3 | STEP_USER = 'user' 4 | 5 | STEPS = [ 6 | STEP_USER 7 | ] 8 | -------------------------------------------------------------------------------- /script/setup: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Setups the repository. 3 | 4 | # Stop on errors 5 | set -e 6 | 7 | cd "$(dirname "$0")/.." 8 | script/bootstrap 9 | 10 | pip3 install -e . 11 | -------------------------------------------------------------------------------- /tests/fixtures/melissa_status.json: -------------------------------------------------------------------------------- 1 | { 2 | "12345678": { 3 | "temp": 27.4, 4 | "raw_temperature": 28928, 5 | "humidity": 18.7, 6 | "raw_humidity": 12946 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /docs/source/api/bootstrap.rst: -------------------------------------------------------------------------------- 1 | .. _bootstrap_module: 2 | 3 | :mod:`homeassistant.bootstrap` 4 | ------------------------- 5 | 6 | .. automodule:: homeassistant.bootstrap 7 | :members: 8 | -------------------------------------------------------------------------------- /homeassistant/components/light/light_profiles.csv: -------------------------------------------------------------------------------- 1 | id,x,y,brightness 2 | relax,0.5119,0.4147,144 3 | concentrate,0.5119,0.4147,219 4 | energize,0.368,0.3686,203 5 | reading,0.4448,0.4066,240 6 | -------------------------------------------------------------------------------- /tests/fixtures/sleepiq-login.json: -------------------------------------------------------------------------------- 1 | { 2 | "edpLoginStatus" : 200, 3 | "userId" : "-42", 4 | "registrationState" : 13, 5 | "key" : "0987", 6 | "edpLoginMessage" : "not used" 7 | } 8 | -------------------------------------------------------------------------------- /homeassistant/components/sensor/strings.season.json: -------------------------------------------------------------------------------- 1 | { 2 | "state": { 3 | "spring": "Spring", 4 | "summer": "Summer", 5 | "autumn": "Autumn", 6 | "winter": "Winter" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /script/update: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Update application to run for its current checkout. 3 | 4 | # Stop on errors 5 | set -e 6 | 7 | cd "$(dirname "$0")/.." 8 | git pull 9 | git submodule update 10 | -------------------------------------------------------------------------------- /tests/fixtures/foobot_devices.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "uuid": "231425657665645342", 4 | "userId": 6545342, 5 | "mac": "A2D3F1", 6 | "name": "Happybot" 7 | } 8 | ] 9 | -------------------------------------------------------------------------------- /script/server: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Launch the application and any extra required processes locally. 3 | 4 | # Stop on errors 5 | set -e 6 | 7 | cd "$(dirname "$0")/.." 8 | python3 -m homeassistant -c config 9 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | # General files 2 | .git 3 | .github 4 | config 5 | 6 | # Test related files 7 | .tox 8 | 9 | # Other virtualization methods 10 | venv 11 | .vagrant 12 | 13 | # Temporary files 14 | **/__pycache__ -------------------------------------------------------------------------------- /homeassistant/components/sensor/.translations/season.cs.json: -------------------------------------------------------------------------------- 1 | { 2 | "state": { 3 | "autumn": "Podzim", 4 | "spring": "Jaro", 5 | "summer": "L\u00e9to", 6 | "winter": "Zima" 7 | } 8 | } -------------------------------------------------------------------------------- /homeassistant/components/sensor/.translations/season.cy.json: -------------------------------------------------------------------------------- 1 | { 2 | "state": { 3 | "autumn": "Hydref", 4 | "spring": "Gwanwyn", 5 | "summer": "Haf", 6 | "winter": "Gaeaf" 7 | } 8 | } -------------------------------------------------------------------------------- /homeassistant/components/sensor/.translations/season.en.json: -------------------------------------------------------------------------------- 1 | { 2 | "state": { 3 | "autumn": "Autumn", 4 | "spring": "Spring", 5 | "summer": "Summer", 6 | "winter": "Winter" 7 | } 8 | } -------------------------------------------------------------------------------- /homeassistant/components/sensor/.translations/season.ja.json: -------------------------------------------------------------------------------- 1 | { 2 | "state": { 3 | "autumn": "\u79cb", 4 | "spring": "\u6625", 5 | "summer": "\u590f", 6 | "winter": "\u51ac" 7 | } 8 | } -------------------------------------------------------------------------------- /homeassistant/components/sensor/.translations/season.nl.json: -------------------------------------------------------------------------------- 1 | { 2 | "state": { 3 | "autumn": "Herfst", 4 | "spring": "Lente", 5 | "summer": "Zomer", 6 | "winter": "Winter" 7 | } 8 | } -------------------------------------------------------------------------------- /homeassistant/components/sensor/.translations/season.sl.json: -------------------------------------------------------------------------------- 1 | { 2 | "state": { 3 | "autumn": "Jesen", 4 | "spring": "Pomlad", 5 | "summer": "Poletje", 6 | "winter": "Zima" 7 | } 8 | } -------------------------------------------------------------------------------- /homeassistant/components/sensor/.translations/season.ca.json: -------------------------------------------------------------------------------- 1 | { 2 | "state": { 3 | "autumn": "Tardor", 4 | "spring": "Primavera", 5 | "summer": "Estiu", 6 | "winter": "Hivern" 7 | } 8 | } -------------------------------------------------------------------------------- /homeassistant/components/sensor/.translations/season.fi.json: -------------------------------------------------------------------------------- 1 | { 2 | "state": { 3 | "autumn": "Syksy", 4 | "spring": "Kev\u00e4t", 5 | "summer": "Kes\u00e4", 6 | "winter": "Talvi" 7 | } 8 | } -------------------------------------------------------------------------------- /homeassistant/components/sensor/.translations/season.it.json: -------------------------------------------------------------------------------- 1 | { 2 | "state": { 3 | "autumn": "Autunno", 4 | "spring": "Primavera", 5 | "summer": "Estate", 6 | "winter": "Inverno" 7 | } 8 | } -------------------------------------------------------------------------------- /homeassistant/components/sensor/.translations/season.no.json: -------------------------------------------------------------------------------- 1 | { 2 | "state": { 3 | "autumn": "H\u00f8st", 4 | "spring": "V\u00e5r", 5 | "summer": "Sommer", 6 | "winter": "Vinter" 7 | } 8 | } -------------------------------------------------------------------------------- /homeassistant/components/sensor/.translations/season.pl.json: -------------------------------------------------------------------------------- 1 | { 2 | "state": { 3 | "autumn": "Jesie\u0144", 4 | "spring": "Wiosna", 5 | "summer": "Lato", 6 | "winter": "Zima" 7 | } 8 | } -------------------------------------------------------------------------------- /homeassistant/components/sensor/.translations/season.sv.json: -------------------------------------------------------------------------------- 1 | { 2 | "state": { 3 | "autumn": "H\u00f6st", 4 | "spring": "V\u00e5r", 5 | "summer": "Sommar", 6 | "winter": "Vinter" 7 | } 8 | } -------------------------------------------------------------------------------- /homeassistant/components/sensor/.translations/season.da.json: -------------------------------------------------------------------------------- 1 | { 2 | "state": { 3 | "autumn": "Efter\u00e5r", 4 | "spring": "For\u00e5r", 5 | "summer": "Sommer", 6 | "winter": "Vinter" 7 | } 8 | } -------------------------------------------------------------------------------- /homeassistant/components/sensor/.translations/season.de.json: -------------------------------------------------------------------------------- 1 | { 2 | "state": { 3 | "autumn": "Herbst", 4 | "spring": "Fr\u00fchling", 5 | "summer": "Sommer", 6 | "winter": "Winter" 7 | } 8 | } -------------------------------------------------------------------------------- /homeassistant/components/sensor/.translations/season.es.json: -------------------------------------------------------------------------------- 1 | { 2 | "state": { 3 | "autumn": "Oto\u00f1o", 4 | "spring": "Primavera", 5 | "summer": "Verano", 6 | "winter": "Invierno" 7 | } 8 | } -------------------------------------------------------------------------------- /homeassistant/components/sensor/.translations/season.fr.json: -------------------------------------------------------------------------------- 1 | { 2 | "state": { 3 | "autumn": "Automne", 4 | "spring": "Printemps", 5 | "summer": "\u00c9t\u00e9", 6 | "winter": "Hiver" 7 | } 8 | } -------------------------------------------------------------------------------- /homeassistant/components/sensor/.translations/season.hu.json: -------------------------------------------------------------------------------- 1 | { 2 | "state": { 3 | "autumn": "\u0150sz", 4 | "spring": "Tavasz", 5 | "summer": "Ny\u00e1r", 6 | "winter": "T\u00e9l" 7 | } 8 | } -------------------------------------------------------------------------------- /homeassistant/components/sensor/.translations/season.lb.json: -------------------------------------------------------------------------------- 1 | { 2 | "state": { 3 | "autumn": "Hierscht", 4 | "spring": "Fr\u00e9ijoer", 5 | "summer": "Summer", 6 | "winter": "Wanter" 7 | } 8 | } -------------------------------------------------------------------------------- /homeassistant/components/sensor/.translations/season.pt.json: -------------------------------------------------------------------------------- 1 | { 2 | "state": { 3 | "autumn": "Outono", 4 | "spring": "Primavera", 5 | "summer": "Ver\u00e3o", 6 | "winter": "Inverno" 7 | } 8 | } -------------------------------------------------------------------------------- /homeassistant/components/hue/const.py: -------------------------------------------------------------------------------- 1 | """Constants for the Hue component.""" 2 | import logging 3 | 4 | LOGGER = logging.getLogger('homeassistant.components.hue') 5 | DOMAIN = "hue" 6 | API_NUPNP = 'https://www.meethue.com/api/nupnp' 7 | -------------------------------------------------------------------------------- /homeassistant/components/sensor/.translations/season.pt-BR.json: -------------------------------------------------------------------------------- 1 | { 2 | "state": { 3 | "autumn": "Outono", 4 | "spring": "Primavera", 5 | "summer": "Ver\u00e3o", 6 | "winter": "Inverno" 7 | } 8 | } -------------------------------------------------------------------------------- /homeassistant/components/sensor/.translations/season.ko.json: -------------------------------------------------------------------------------- 1 | { 2 | "state": { 3 | "autumn": "\uac00\uc744", 4 | "spring": "\ubd04", 5 | "summer": "\uc5ec\ub984", 6 | "winter": "\uaca8\uc6b8" 7 | } 8 | } -------------------------------------------------------------------------------- /homeassistant/components/sensor/.translations/season.ro.json: -------------------------------------------------------------------------------- 1 | { 2 | "state": { 3 | "autumn": "Toamn\u0103", 4 | "spring": "Prim\u0103var\u0103", 5 | "summer": "Var\u0103", 6 | "winter": "Iarn\u0103" 7 | } 8 | } -------------------------------------------------------------------------------- /tests/testing_config/custom_components/test_standalone.py: -------------------------------------------------------------------------------- 1 | """Provide a mock standalone component.""" 2 | DOMAIN = 'test_standalone' 3 | 4 | 5 | async def async_setup(hass, config): 6 | """Mock a successful setup.""" 7 | return True 8 | -------------------------------------------------------------------------------- /homeassistant/components/sensor/.translations/season.zh-Hans.json: -------------------------------------------------------------------------------- 1 | { 2 | "state": { 3 | "autumn": "\u79cb\u5b63", 4 | "spring": "\u6625\u5b63", 5 | "summer": "\u590f\u5b63", 6 | "winter": "\u51ac\u5b63" 7 | } 8 | } -------------------------------------------------------------------------------- /homeassistant/components/sensor/.translations/season.zh-Hant.json: -------------------------------------------------------------------------------- 1 | { 2 | "state": { 3 | "autumn": "\u79cb\u5b63", 4 | "spring": "\u6625\u5b63", 5 | "summer": "\u590f\u5b63", 6 | "winter": "\u51ac\u5b63" 7 | } 8 | } -------------------------------------------------------------------------------- /tests/fixtures/efergy_current_values_single.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "cid": "PWER", 4 | "data": [ 5 | { 6 | "1486247500000": 1628 7 | } 8 | ], 9 | "sid": "728386", 10 | "units": "kWm", 11 | "age": 5 12 | } 13 | ] -------------------------------------------------------------------------------- /tests/fixtures/ring_oauth.json: -------------------------------------------------------------------------------- 1 | { 2 | "access_token": "eyJ0eWfvEQwqfJNKyQ9999", 3 | "token_type": "bearer", 4 | "expires_in": 3600, 5 | "refresh_token": "67695a26bdefc1ac8999", 6 | "scope": "client", 7 | "created_at": 1529099870 8 | } 9 | -------------------------------------------------------------------------------- /homeassistant/components/sensor/.translations/season.vi.json: -------------------------------------------------------------------------------- 1 | { 2 | "state": { 3 | "autumn": "M\u00f9a thu", 4 | "spring": "M\u00f9a xu\u00e2n", 5 | "summer": "M\u00f9a h\u00e8", 6 | "winter": "M\u00f9a \u0111\u00f4ng" 7 | } 8 | } -------------------------------------------------------------------------------- /script/bootstrap: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Resolve all dependencies that the application requires to run. 3 | 4 | # Stop on errors 5 | set -e 6 | 7 | cd "$(dirname "$0")/.." 8 | 9 | echo "Installing test dependencies..." 10 | python3 -m pip install tox colorlog 11 | -------------------------------------------------------------------------------- /homeassistant/components/deconz/.translations/da.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "step": { 4 | "init": { 5 | "data": { 6 | "host": "V\u00e6rt" 7 | } 8 | } 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /homeassistant/components/scene/services.yaml: -------------------------------------------------------------------------------- 1 | # Describes the format for available scene services 2 | 3 | turn_on: 4 | description: Activate a scene. 5 | fields: 6 | entity_id: 7 | description: Name(s) of scenes to turn on 8 | example: 'scene.romantic' 9 | -------------------------------------------------------------------------------- /tests/fixtures/sleepiq-login-failed.json: -------------------------------------------------------------------------------- 1 | {"Error":{"Code":401,"Message":"Authentication token of type [class org.apache.shiro.authc.UsernamePasswordToken] could not be authenticated by any configured realms. Please ensure that at least one realm can authenticate these tokens."}} 2 | -------------------------------------------------------------------------------- /tests/testing_config/custom_components/test_package/__init__.py: -------------------------------------------------------------------------------- 1 | """Provide a mock package component.""" 2 | from .const import TEST # noqa 3 | 4 | 5 | DOMAIN = 'test_package' 6 | 7 | 8 | async def async_setup(hass, config): 9 | """Mock a successful setup.""" 10 | return True 11 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Ensure Docker script files uses LF to support Docker for Windows. 2 | # Ensure "git config --global core.autocrlf input" before you clone 3 | * text eol=lf 4 | *.py whitespace=error 5 | 6 | *.ico binary 7 | *.jpg binary 8 | *.png binary 9 | *.zip binary 10 | *.mp3 binary 11 | -------------------------------------------------------------------------------- /homeassistant/components/sensor/.translations/season.bg.json: -------------------------------------------------------------------------------- 1 | { 2 | "state": { 3 | "autumn": "\u0415\u0441\u0435\u043d", 4 | "spring": "\u041f\u0440\u043e\u043b\u0435\u0442", 5 | "summer": "\u041b\u044f\u0442\u043e", 6 | "winter": "\u0417\u0438\u043c\u0430" 7 | } 8 | } -------------------------------------------------------------------------------- /homeassistant/components/sensor/.translations/season.ru.json: -------------------------------------------------------------------------------- 1 | { 2 | "state": { 3 | "autumn": "\u041e\u0441\u0435\u043d\u044c", 4 | "spring": "\u0412\u0435\u0441\u043d\u0430", 5 | "summer": "\u041b\u0435\u0442\u043e", 6 | "winter": "\u0417\u0438\u043c\u0430" 7 | } 8 | } -------------------------------------------------------------------------------- /tests/fixtures/ring_doorbots.json: -------------------------------------------------------------------------------- 1 | [{ 2 | "answered": false, 3 | "created_at": "2017-03-05T15:03:40.000Z", 4 | "events": [], 5 | "favorite": false, 6 | "id": 987654321, 7 | "kind": "motion", 8 | "recording": {"status": "ready"}, 9 | "snapshot_url": "" 10 | }] 11 | -------------------------------------------------------------------------------- /docs/source/api/entity.rst: -------------------------------------------------------------------------------- 1 | .. _helpers_entity_module: 2 | 3 | :mod:`homeassistant.helpers.entity` 4 | ----------------------------------- 5 | 6 | .. automodule:: homeassistant.helpers.entity 7 | 8 | .. autoclass:: Entity 9 | :members: 10 | 11 | .. autoclass:: ToggleEntity 12 | :members: 13 | -------------------------------------------------------------------------------- /mypy.ini: -------------------------------------------------------------------------------- 1 | [mypy] 2 | check_untyped_defs = true 3 | follow_imports = silent 4 | ignore_missing_imports = true 5 | warn_redundant_casts = true 6 | warn_return_any = true 7 | warn_unused_configs = true 8 | warn_unused_ignores = true 9 | 10 | [mypy-homeassistant.util.yaml] 11 | warn_return_any = false 12 | 13 | -------------------------------------------------------------------------------- /.ignore: -------------------------------------------------------------------------------- 1 | # Patterns matched in this file will be ignored by supported search utilities 2 | 3 | # Ignore generated html and javascript files 4 | /homeassistant/components/frontend/www_static/*.html 5 | /homeassistant/components/frontend/www_static/*.js 6 | /homeassistant/components/frontend/www_static/panels/*.html 7 | -------------------------------------------------------------------------------- /homeassistant/components/conversation/services.yaml: -------------------------------------------------------------------------------- 1 | # Describes the format for available component services 2 | 3 | process: 4 | description: Launch a conversation from a transcribed text. 5 | fields: 6 | text: 7 | description: Transcribed text 8 | example: Turn all lights on 9 | 10 | 11 | -------------------------------------------------------------------------------- /script/travis_deploy: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Safe bash settings 4 | # -e Exit on command fail 5 | # -u Exit on unset variable 6 | # -o pipefail Exit if piped command has error code 7 | set -eu -o pipefail 8 | 9 | cd "$(dirname "$0")/.." 10 | 11 | script/translations_upload 12 | -------------------------------------------------------------------------------- /docs/source/api/device_tracker.rst: -------------------------------------------------------------------------------- 1 | .. _components_device_tracker_module: 2 | 3 | :mod:`homeassistant.components.device_tracker` 4 | ---------------------------------------------- 5 | 6 | .. automodule:: homeassistant.components.device_tracker 7 | :members: 8 | 9 | .. autoclass:: Device 10 | :members: 11 | -------------------------------------------------------------------------------- /tests/fixtures/google_maps_elevation.json: -------------------------------------------------------------------------------- 1 | { 2 | "results" : [ 3 | { 4 | "elevation" : 101.5, 5 | "location" : { 6 | "lat" : 32.54321, 7 | "lng" : -117.12345 8 | }, 9 | "resolution" : 4.8 10 | } 11 | ], 12 | "status" : "OK" 13 | } 14 | -------------------------------------------------------------------------------- /tests/fixtures/microsoft_face_persongroups.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "personGroupId":"test_group1", 4 | "name":"test group1", 5 | "userData":"test" 6 | }, 7 | { 8 | "personGroupId":"test_group2", 9 | "name":"test group2", 10 | "userData":"test" 11 | } 12 | ] 13 | -------------------------------------------------------------------------------- /docs/source/_templates/links.html: -------------------------------------------------------------------------------- 1 | 7 | -------------------------------------------------------------------------------- /homeassistant/auth/util.py: -------------------------------------------------------------------------------- 1 | """Auth utils.""" 2 | import binascii 3 | import os 4 | 5 | 6 | def generate_secret(entropy: int = 32) -> str: 7 | """Generate a secret. 8 | 9 | Backport of secrets.token_hex from Python 3.6 10 | 11 | Event loop friendly. 12 | """ 13 | return binascii.hexlify(os.urandom(entropy)).decode('ascii') 14 | -------------------------------------------------------------------------------- /tests/fixtures/wunderground-error.json: -------------------------------------------------------------------------------- 1 | { 2 | "response": { 3 | "version": "0.1", 4 | "termsofService": "http://www.wunderground.com/weather/api/d/terms.html", 5 | "features": {}, 6 | "error": { 7 | "type": "keynotfound", 8 | "description": "this key does not exist" 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /tests/components/homekit/common.py: -------------------------------------------------------------------------------- 1 | """Collection of fixtures and functions for the HomeKit tests.""" 2 | from unittest.mock import patch 3 | 4 | 5 | def patch_debounce(): 6 | """Return patch for debounce method.""" 7 | return patch('homeassistant.components.homekit.accessories.debounce', 8 | lambda f: lambda *args, **kwargs: f(*args, **kwargs)) 9 | -------------------------------------------------------------------------------- /homeassistant/components/hue/.translations/es.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "abort": { 4 | "unknown": "Se produjo un error desconocido" 5 | }, 6 | "error": { 7 | "linking": "Se produjo un error de enlace desconocido.", 8 | "register_failed": "No se pudo registrar, intente de nuevo" 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /tests/components/onboarding/__init__.py: -------------------------------------------------------------------------------- 1 | """Tests for the onboarding component.""" 2 | 3 | from homeassistant.components import onboarding 4 | 5 | 6 | def mock_storage(hass_storage, data): 7 | """Mock the onboarding storage.""" 8 | hass_storage[onboarding.STORAGE_KEY] = { 9 | 'version': onboarding.STORAGE_VERSION, 10 | 'data': data 11 | } 12 | -------------------------------------------------------------------------------- /tests/fixtures/freegeoip.io.json: -------------------------------------------------------------------------------- 1 | { 2 | "ip": "1.2.3.4", 3 | "country_code": "US", 4 | "country_name": "United States", 5 | "region_code": "CA", 6 | "region_name": "California", 7 | "city": "San Diego", 8 | "zip_code": "92122", 9 | "time_zone": "America\/Los_Angeles", 10 | "latitude": 32.8594, 11 | "longitude": -117.2073, 12 | "metro_code": 825 13 | } 14 | -------------------------------------------------------------------------------- /script/lint_docker: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Execute lint in a docker container to spot code mistakes. 3 | 4 | # Stop on errors 5 | set -e 6 | 7 | cd "$(dirname "$0")/.." 8 | 9 | docker build -t home-assistant-test -f virtualization/Docker/Dockerfile.dev . 10 | docker run --rm \ 11 | -v `pwd`/.tox/:/usr/src/app/.tox/ \ 12 | -t -i home-assistant-test \ 13 | tox -e lint 14 | -------------------------------------------------------------------------------- /homeassistant/components/frontend/services.yaml: -------------------------------------------------------------------------------- 1 | # Describes the format for available frontend services 2 | 3 | set_theme: 4 | description: Set a theme unless the client selected per-device theme. 5 | fields: 6 | name: 7 | description: Name of a predefined theme or 'default'. 8 | example: 'light' 9 | 10 | reload_themes: 11 | description: Reload themes from yaml configuration. 12 | -------------------------------------------------------------------------------- /homeassistant/components/sensor/.translations/season.th.json: -------------------------------------------------------------------------------- 1 | { 2 | "state": { 3 | "autumn": "\u0e24\u0e14\u0e39\u0e43\u0e1a\u0e44\u0e21\u0e49\u0e23\u0e48\u0e27\u0e07", 4 | "spring": "\u0e24\u0e14\u0e39\u0e43\u0e1a\u0e44\u0e21\u0e49\u0e1c\u0e25\u0e34", 5 | "summer": "\u0e24\u0e14\u0e39\u0e23\u0e49\u0e2d\u0e19", 6 | "winter": "\u0e24\u0e14\u0e39\u0e2b\u0e19\u0e32\u0e27" 7 | } 8 | } -------------------------------------------------------------------------------- /homeassistant/components/sensor/strings.moon.json: -------------------------------------------------------------------------------- 1 | { 2 | "state": { 3 | "new_moon": "New moon", 4 | "waxing_crescent": "Waxing crescent", 5 | "first_quarter": "First quarter", 6 | "waxing_gibbous": "Waxing gibbous", 7 | "full_moon": "Full moon", 8 | "waning_gibbous": "Waning gibbous", 9 | "last_quarter": "Last quarter", 10 | "waning_crescent": "Waning crescent" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /homeassistant/helpers/typing.py: -------------------------------------------------------------------------------- 1 | """Typing Helpers for Home Assistant.""" 2 | from typing import Dict, Any, Tuple 3 | 4 | import homeassistant.core 5 | 6 | # pylint: disable=invalid-name 7 | 8 | GPSType = Tuple[float, float] 9 | ConfigType = Dict[str, Any] 10 | HomeAssistantType = homeassistant.core.HomeAssistant 11 | ServiceDataType = Dict[str, Any] 12 | 13 | # Custom type for recorder Queries 14 | QueryType = Any 15 | -------------------------------------------------------------------------------- /homeassistant/components/sonos/.translations/de.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "abort": { 4 | "no_devices_found": "Keine Sonos Ger\u00e4te im Netzwerk gefunden." 5 | }, 6 | "step": { 7 | "confirm": { 8 | "description": "M\u00f6chten Sie Sonos konfigurieren?", 9 | "title": "" 10 | } 11 | }, 12 | "title": "" 13 | } 14 | } -------------------------------------------------------------------------------- /homeassistant/components/hue/errors.py: -------------------------------------------------------------------------------- 1 | """Errors for the Hue component.""" 2 | from homeassistant.exceptions import HomeAssistantError 3 | 4 | 5 | class HueException(HomeAssistantError): 6 | """Base class for Hue exceptions.""" 7 | 8 | 9 | class CannotConnect(HueException): 10 | """Unable to connect to the bridge.""" 11 | 12 | 13 | class AuthenticationRequired(HueException): 14 | """Unknown error occurred.""" 15 | -------------------------------------------------------------------------------- /homeassistant/util/decorator.py: -------------------------------------------------------------------------------- 1 | """Decorator utility functions.""" 2 | 3 | 4 | class Registry(dict): 5 | """Registry of items.""" 6 | 7 | def register(self, name): 8 | """Return decorator to register item with a specific name.""" 9 | def decorator(func): 10 | """Register decorated function.""" 11 | self[name] = func 12 | return func 13 | 14 | return decorator 15 | -------------------------------------------------------------------------------- /homeassistant/components/cast/.translations/de.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "abort": { 4 | "no_devices_found": "Keine Google Cast Ger\u00e4te im Netzwerk gefunden." 5 | }, 6 | "step": { 7 | "confirm": { 8 | "description": "M\u00f6chten Sie Google Cast einrichten?", 9 | "title": "" 10 | } 11 | }, 12 | "title": "" 13 | } 14 | } -------------------------------------------------------------------------------- /.github/move.yml: -------------------------------------------------------------------------------- 1 | # Configuration for move-issues - https://github.com/dessant/move-issues 2 | 3 | # Delete the command comment. Ignored when the comment also contains other content 4 | deleteCommand: true 5 | # Close the source issue after moving 6 | closeSourceIssue: true 7 | # Lock the source issue after moving 8 | lockSourceIssue: false 9 | # Set custom aliases for targets 10 | # aliases: 11 | # r: repo 12 | # or: owner/repo 13 | 14 | -------------------------------------------------------------------------------- /homeassistant/components/sonos/strings.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "title": "Sonos", 4 | "step": { 5 | "confirm": { 6 | "title": "Sonos", 7 | "description": "Do you want to setup Sonos?" 8 | } 9 | }, 10 | "abort": { 11 | "single_instance_allowed": "Only a single configuration of Sonos is necessary.", 12 | "no_devices_found": "No Sonos devices found on the network." 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /script/dev_openzwave_docker: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Open a docker that can be used to debug/dev python-openzwave. Pass in a command line argument to build 3 | 4 | cd "$(dirname "$0")/.." 5 | 6 | if [ $# -gt 0 ] 7 | then 8 | docker build -t home-assistant-dev . 9 | fi 10 | 11 | docker run \ 12 | --device=/dev/ttyUSB0:/zwaveusbstick:rwm \ 13 | -v `pwd`:/usr/src/app \ 14 | -p 8123:8123 \ 15 | -t -i home-assistant-dev \ 16 | /bin/bash 17 | -------------------------------------------------------------------------------- /homeassistant/components/sonos/.translations/hu.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "abort": { 4 | "no_devices_found": "Nem tal\u00e1lhat\u00f3k Sonos eszk\u00f6z\u00f6k a h\u00e1l\u00f3zaton." 5 | }, 6 | "step": { 7 | "confirm": { 8 | "description": "Be szeretn\u00e9d \u00e1ll\u00edtani a Sonos-t?", 9 | "title": "Sonos" 10 | } 11 | }, 12 | "title": "Sonos" 13 | } 14 | } -------------------------------------------------------------------------------- /tests/fixtures/ip-api.com.json: -------------------------------------------------------------------------------- 1 | { 2 | "as": "AS20001 Time Warner Cable Internet LLC", 3 | "city": "San Diego", 4 | "country": "United States", 5 | "countryCode": "US", 6 | "isp": "Time Warner Cable", 7 | "lat": 32.8594, 8 | "lon": -117.2073, 9 | "org": "Time Warner Cable", 10 | "query": "1.2.3.4", 11 | "region": "CA", 12 | "regionName": "California", 13 | "status": "success", 14 | "timezone": "America\/Los_Angeles", 15 | "zip": "92122" 16 | } 17 | -------------------------------------------------------------------------------- /homeassistant/package_constraints.txt: -------------------------------------------------------------------------------- 1 | aiohttp==3.3.2 2 | astral==1.6.1 3 | async_timeout==3.0.0 4 | attrs==18.1.0 5 | certifi>=2018.04.16 6 | jinja2>=2.10 7 | pip>=8.0.3 8 | pytz>=2018.04 9 | pyyaml>=3.13,<4 10 | requests==2.19.1 11 | voluptuous==0.11.1 12 | 13 | # Breaks Python 3.6 and is not needed for our supported Python versions 14 | enum34==1000000000.0.0 15 | 16 | # This is a old unmaintained library and is replaced with pycryptodome 17 | pycrypto==1000000000.0.0 18 | -------------------------------------------------------------------------------- /homeassistant/components/cast/strings.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "title": "Google Cast", 4 | "step": { 5 | "confirm": { 6 | "title": "Google Cast", 7 | "description": "Do you want to setup Google Cast?" 8 | } 9 | }, 10 | "abort": { 11 | "single_instance_allowed": "Only a single configuration of Google Cast is necessary.", 12 | "no_devices_found": "No Google Cast devices found on the network." 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /homeassistant/components/map.py: -------------------------------------------------------------------------------- 1 | """ 2 | Provides a map panel for showing device locations. 3 | 4 | For more details about this component, please refer to the documentation at 5 | https://home-assistant.io/components/map/ 6 | """ 7 | DOMAIN = 'map' 8 | 9 | 10 | async def async_setup(hass, config): 11 | """Register the built-in map panel.""" 12 | await hass.components.frontend.async_register_built_in_panel( 13 | 'map', 'map', 'mdi:account-location') 14 | return True 15 | -------------------------------------------------------------------------------- /requirements_test.txt: -------------------------------------------------------------------------------- 1 | # linters such as flake8 and pylint should be pinned, as new releases 2 | # make new things fail. Manually update these pins when pulling in a 3 | # new version 4 | asynctest==0.12.1 5 | coveralls==1.2.0 6 | flake8-docstrings==1.0.3 7 | flake8==3.5 8 | mock-open==1.3.1 9 | mypy==0.610 10 | pydocstyle==1.1.1 11 | pylint==1.9.2 12 | pytest-aiohttp==0.3.0 13 | pytest-cov==2.5.1 14 | pytest-sugar==0.9.1 15 | pytest-timeout==1.3.0 16 | pytest==3.6.3 17 | requests_mock==1.5 18 | -------------------------------------------------------------------------------- /virtualization/Docker/scripts/phantomjs: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Sets up phantomjs. 3 | 4 | # Stop on errors 5 | set -e 6 | 7 | PHANTOMJS_VERSION="2.1.1" 8 | 9 | cd /usr/src/app/ 10 | mkdir -p build && cd build 11 | 12 | curl -LSO https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-$PHANTOMJS_VERSION-linux-x86_64.tar.bz2 13 | tar -xjf phantomjs-$PHANTOMJS_VERSION-linux-x86_64.tar.bz2 14 | mv phantomjs-$PHANTOMJS_VERSION-linux-x86_64/bin/phantomjs /usr/bin/phantomjs 15 | /usr/bin/phantomjs -v -------------------------------------------------------------------------------- /homeassistant/components/zha/services.yaml: -------------------------------------------------------------------------------- 1 | # Describes the format for available zha services 2 | 3 | permit: 4 | description: Allow nodes to join the ZigBee network. 5 | fields: 6 | duration: 7 | description: Time to permit joins, in seconds 8 | example: 60 9 | 10 | remove: 11 | description: Remove a node from the ZigBee network. 12 | fields: 13 | ieee_address: 14 | description: IEEE address of the node to remove 15 | example: "00:0d:6f:00:05:7d:2d:34" 16 | -------------------------------------------------------------------------------- /docs/source/index.rst: -------------------------------------------------------------------------------- 1 | ================================ 2 | Home Assistant API Documentation 3 | ================================ 4 | 5 | Public API documentation for `Home Assistant developers`_. 6 | 7 | Contents: 8 | 9 | .. toctree:: 10 | :maxdepth: 2 11 | :glob: 12 | 13 | api/* 14 | 15 | Indices and tables 16 | ================== 17 | 18 | * :ref:`genindex` 19 | * :ref:`modindex` 20 | * :ref:`search` 21 | 22 | .. _Home Assistant developers: https://home-assistant.io/developers/ 23 | -------------------------------------------------------------------------------- /tests/components/http/test_view.py: -------------------------------------------------------------------------------- 1 | """Tests for Home Assistant View.""" 2 | from aiohttp.web_exceptions import HTTPInternalServerError 3 | import pytest 4 | 5 | from homeassistant.components.http.view import HomeAssistantView 6 | 7 | 8 | async def test_invalid_json(caplog): 9 | """Test trying to return invalid JSON.""" 10 | view = HomeAssistantView() 11 | 12 | with pytest.raises(HTTPInternalServerError): 13 | view.json(object) 14 | 15 | assert str(object) in caplog.text 16 | -------------------------------------------------------------------------------- /tests/fixtures/alpr_stdout.txt: -------------------------------------------------------------------------------- 1 | 2 | plate0: top 10 results -- Processing Time = 58.1879ms. 3 | - PE3R2X confidence: 98.9371 4 | - PE32X confidence: 98.1385 5 | - PE3R2 confidence: 97.5444 6 | - PE3R2Y confidence: 86.1448 7 | - P63R2X confidence: 82.9016 8 | - FE3R2X confidence: 72.1147 9 | - PE32 confidence: 66.7458 10 | - PE32Y confidence: 65.3462 11 | - P632X confidence: 62.1031 12 | - P63R2 confidence: 61.5089 13 | -------------------------------------------------------------------------------- /homeassistant/components/recorder/services.yaml: -------------------------------------------------------------------------------- 1 | # Describes the format for available recorder services 2 | 3 | purge: 4 | description: Start purge task - delete events and states older than x days, according to keep_days service data. 5 | fields: 6 | keep_days: 7 | description: Number of history days to keep in database after purge. Value >= 0. 8 | example: 2 9 | repack: 10 | description: Attempt to save disk space by rewriting the entire database file. 11 | example: true 12 | -------------------------------------------------------------------------------- /docs/source/api/event.rst: -------------------------------------------------------------------------------- 1 | .. _helpers_event_module: 2 | 3 | :mod:`homeassistant.helpers.event` 4 | ---------------------------------- 5 | 6 | .. automodule:: homeassistant.helpers.event 7 | 8 | .. autofunction:: track_state_change 9 | 10 | .. autofunction:: track_point_in_time 11 | 12 | .. autofunction:: track_point_in_utc_time 13 | 14 | .. autofunction:: track_sunrise 15 | 16 | .. autofunction:: track_sunset 17 | 18 | .. autofunction:: track_utc_time_change 19 | 20 | .. autofunction:: track_time_change 21 | -------------------------------------------------------------------------------- /homeassistant/components/cast/.translations/hu.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "abort": { 4 | "no_devices_found": "Nem tal\u00e1lhat\u00f3k Google Cast eszk\u00f6z\u00f6k a h\u00e1l\u00f3zaton." 5 | }, 6 | "step": { 7 | "confirm": { 8 | "description": "Be szeretn\u00e9d \u00e1ll\u00edtani a Google Cast szolg\u00e1ltat\u00e1st?", 9 | "title": "Google Cast" 10 | } 11 | }, 12 | "title": "Google Cast" 13 | } 14 | } -------------------------------------------------------------------------------- /homeassistant/components/deconz/const.py: -------------------------------------------------------------------------------- 1 | """Constants for the deCONZ component.""" 2 | import logging 3 | 4 | _LOGGER = logging.getLogger('homeassistant.components.deconz') 5 | 6 | DOMAIN = 'deconz' 7 | CONFIG_FILE = 'deconz.conf' 8 | DATA_DECONZ_EVENT = 'deconz_events' 9 | DATA_DECONZ_ID = 'deconz_entities' 10 | DATA_DECONZ_UNSUB = 'deconz_dispatchers' 11 | 12 | CONF_ALLOW_CLIP_SENSOR = 'allow_clip_sensor' 13 | CONF_ALLOW_DECONZ_GROUPS = 'allow_deconz_groups' 14 | 15 | ATTR_DARK = 'dark' 16 | ATTR_ON = 'on' 17 | -------------------------------------------------------------------------------- /homeassistant/components/sonos/.translations/en.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "abort": { 4 | "no_devices_found": "No Sonos devices found on the network.", 5 | "single_instance_allowed": "Only a single configuration of Sonos is necessary." 6 | }, 7 | "step": { 8 | "confirm": { 9 | "description": "Do you want to setup Sonos?", 10 | "title": "Sonos" 11 | } 12 | }, 13 | "title": "Sonos" 14 | } 15 | } -------------------------------------------------------------------------------- /homeassistant/components/sonos/.translations/it.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "abort": { 4 | "no_devices_found": "Non sono presenti dispositivi Sonos in rete.", 5 | "single_instance_allowed": "\u00c8 necessaria una sola configurazione di Sonos." 6 | }, 7 | "step": { 8 | "confirm": { 9 | "description": "Vuoi installare Sonos", 10 | "title": "Sonos" 11 | } 12 | }, 13 | "title": "Sonos" 14 | } 15 | } -------------------------------------------------------------------------------- /homeassistant/components/sonos/.translations/sl.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "abort": { 4 | "no_devices_found": "V omre\u017eju ni najdenih naprav Sonos.", 5 | "single_instance_allowed": "Potrebna je samo ena konfiguracija Sonosa." 6 | }, 7 | "step": { 8 | "confirm": { 9 | "description": "Ali \u017eelite nastaviti Sonos?", 10 | "title": "Sonos" 11 | } 12 | }, 13 | "title": "Sonos" 14 | } 15 | } -------------------------------------------------------------------------------- /virtualization/Docker/scripts/tellstick: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Sets up tellstick. 3 | 4 | # Stop on errors 5 | set -e 6 | 7 | PACKAGES=( 8 | # homeassistant.components.tellstick 9 | libtelldus-core2 10 | ) 11 | 12 | # Add Tellstick repository 13 | echo "deb http://download.telldus.com/debian/ stable main" >> /etc/apt/sources.list.d/telldus.list 14 | wget -qO - http://download.telldus.com/debian/telldus-public.key | apt-key add - 15 | 16 | apt-get update 17 | apt-get install -y --no-install-recommends ${PACKAGES[@]} -------------------------------------------------------------------------------- /homeassistant/components/ads/services.yaml: -------------------------------------------------------------------------------- 1 | # Describes the format for available ADS services 2 | 3 | write_data_by_name: 4 | description: Write a value to the connected ADS device. 5 | 6 | fields: 7 | adsvar: 8 | description: The name of the variable to write to. 9 | example: '.global_var' 10 | adstype: 11 | description: The data type of the variable to write to. 12 | example: 'int' 13 | value: 14 | description: The value to write to the variable. 15 | example: 1 16 | -------------------------------------------------------------------------------- /docs/source/_templates/sourcelink.html: -------------------------------------------------------------------------------- 1 | {%- if show_source and has_source and sourcename %} 2 |

{{ _('This Page') }}

3 | 13 | {%- endif %} 14 | -------------------------------------------------------------------------------- /homeassistant/components/sonos/.translations/ca.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "abort": { 4 | "no_devices_found": "No s'han trobat dispositius Sonos a la xarxa.", 5 | "single_instance_allowed": "Nom\u00e9s cal una \u00fanica configuraci\u00f3 de Sonos." 6 | }, 7 | "step": { 8 | "confirm": { 9 | "description": "Voleu configurar Sonos?", 10 | "title": "Sonos" 11 | } 12 | }, 13 | "title": "Sonos" 14 | } 15 | } -------------------------------------------------------------------------------- /homeassistant/components/sonos/.translations/nl.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "abort": { 4 | "no_devices_found": "Geen Sonos-apparaten gevonden op het netwerk.", 5 | "single_instance_allowed": "Er is slechts \u00e9\u00e9n configuratie van Sonos nodig." 6 | }, 7 | "step": { 8 | "confirm": { 9 | "description": "Wilt u Sonos instellen?", 10 | "title": "Sonos" 11 | } 12 | }, 13 | "title": "Sonos" 14 | } 15 | } -------------------------------------------------------------------------------- /homeassistant/components/sonos/.translations/pl.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "abort": { 4 | "no_devices_found": "Nie znaleziono w sieci urz\u0105dze\u0144 Sonos.", 5 | "single_instance_allowed": "Wymagana jest tylko jedna konfiguracja Sonos." 6 | }, 7 | "step": { 8 | "confirm": { 9 | "description": "Chcesz skonfigurowa\u0107 Sonos?", 10 | "title": "Sonos" 11 | } 12 | }, 13 | "title": "Sonos" 14 | } 15 | } -------------------------------------------------------------------------------- /homeassistant/components/sonos/.translations/lb.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "abort": { 4 | "no_devices_found": "Keng Sonos Apparater am Netzwierk fonnt.", 5 | "single_instance_allowed": "N\u00ebmmen eng eenzeg Konfiguratioun vun Sonos ass n\u00e9ideg." 6 | }, 7 | "step": { 8 | "confirm": { 9 | "description": "Soll Sonos konfigur\u00e9iert ginn?", 10 | "title": "Sonos" 11 | } 12 | }, 13 | "title": "Sonos" 14 | } 15 | } -------------------------------------------------------------------------------- /homeassistant/components/sonos/.translations/no.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "abort": { 4 | "no_devices_found": "Ingen Sonos enheter funnet p\u00e5 nettverket.", 5 | "single_instance_allowed": "Kun en enkelt konfigurasjon av Sonos er n\u00f8dvendig." 6 | }, 7 | "step": { 8 | "confirm": { 9 | "description": "\u00d8nsker du \u00e5 sette opp Sonos?", 10 | "title": "Sonos" 11 | } 12 | }, 13 | "title": "Sonos" 14 | } 15 | } -------------------------------------------------------------------------------- /homeassistant/components/sonos/.translations/sv.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "abort": { 4 | "no_devices_found": "Inga Sonos-enheter hittades i n\u00e4tverket.", 5 | "single_instance_allowed": "Endast en enda konfiguration av Sonos \u00e4r n\u00f6dv\u00e4ndig." 6 | }, 7 | "step": { 8 | "confirm": { 9 | "description": "Vill du konfigurera Sonos?", 10 | "title": "Sonos" 11 | } 12 | }, 13 | "title": "Sonos" 14 | } 15 | } -------------------------------------------------------------------------------- /homeassistant/components/cast/.translations/en.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "abort": { 4 | "no_devices_found": "No Google Cast devices found on the network.", 5 | "single_instance_allowed": "Only a single configuration of Google Cast is necessary." 6 | }, 7 | "step": { 8 | "confirm": { 9 | "description": "Do you want to setup Google Cast?", 10 | "title": "Google Cast" 11 | } 12 | }, 13 | "title": "Google Cast" 14 | } 15 | } -------------------------------------------------------------------------------- /homeassistant/components/cast/.translations/it.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "abort": { 4 | "no_devices_found": "Nessun dispositivo Google Cast trovato in rete.", 5 | "single_instance_allowed": "\u00c8 necessaria una sola configurazione di Google Cast." 6 | }, 7 | "step": { 8 | "confirm": { 9 | "description": "Vuoi configurare Google Cast?", 10 | "title": "Google Cast" 11 | } 12 | }, 13 | "title": "Google Cast" 14 | } 15 | } -------------------------------------------------------------------------------- /homeassistant/components/cast/.translations/sl.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "abort": { 4 | "no_devices_found": "V omre\u017eju niso najdene naprave Google Cast.", 5 | "single_instance_allowed": "Potrebna je samo ena konfiguracija Google Cast-a." 6 | }, 7 | "step": { 8 | "confirm": { 9 | "description": "Ali \u017eelite nastaviti Google Cast?", 10 | "title": "Google Cast" 11 | } 12 | }, 13 | "title": "Google Cast" 14 | } 15 | } -------------------------------------------------------------------------------- /homeassistant/components/sonos/.translations/cs.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "abort": { 4 | "no_devices_found": "V s\u00edti nebyly nalezena \u017e\u00e1dn\u00e1 za\u0159\u00edzen\u00ed Sonos.", 5 | "single_instance_allowed": "Je t\u0159eba jen jedna konfigurace Sonos." 6 | }, 7 | "step": { 8 | "confirm": { 9 | "description": "Chcete nastavit Sonos?", 10 | "title": "Sonos" 11 | } 12 | }, 13 | "title": "Sonos" 14 | } 15 | } -------------------------------------------------------------------------------- /homeassistant/components/hue/.translations/da.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "abort": { 4 | "no_bridges": "Ingen Philips Hue bridge fundet" 5 | }, 6 | "step": { 7 | "init": { 8 | "data": { 9 | "host": "V\u00e6rt" 10 | }, 11 | "title": "V\u00e6lg Hue bridge" 12 | }, 13 | "link": { 14 | "title": "Link Hub" 15 | } 16 | }, 17 | "title": "Philips Hue Bridge" 18 | } 19 | } -------------------------------------------------------------------------------- /homeassistant/components/cast/.translations/nl.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "abort": { 4 | "no_devices_found": "Geen Google Cast-apparaten gevonden op het netwerk.", 5 | "single_instance_allowed": "Er is slechts \u00e9\u00e9n configuratie van Google Cast nodig." 6 | }, 7 | "step": { 8 | "confirm": { 9 | "description": "Wilt u Google Cast instellen?", 10 | "title": "Google Cast" 11 | } 12 | }, 13 | "title": "Google Cast" 14 | } 15 | } -------------------------------------------------------------------------------- /homeassistant/components/cast/.translations/ca.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "abort": { 4 | "no_devices_found": "No s'han trobat dispositius de Google Cast a la xarxa.", 5 | "single_instance_allowed": "Nom\u00e9s cal una \u00fanica configuraci\u00f3 de Google Cast." 6 | }, 7 | "step": { 8 | "confirm": { 9 | "description": "Voleu configurar Google Cast?", 10 | "title": "Google Cast" 11 | } 12 | }, 13 | "title": "Google Cast" 14 | } 15 | } -------------------------------------------------------------------------------- /homeassistant/components/cast/.translations/pl.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "abort": { 4 | "no_devices_found": "Nie znaleziono w sieci urz\u0105dze\u0144 Google Cast.", 5 | "single_instance_allowed": "Wymagana jest tylko jedna konfiguracja Google Cast." 6 | }, 7 | "step": { 8 | "confirm": { 9 | "description": "Czy chcesz skonfigurowa\u0107 Google Cast?", 10 | "title": "Google Cast" 11 | } 12 | }, 13 | "title": "Google Cast" 14 | } 15 | } -------------------------------------------------------------------------------- /homeassistant/components/nest/.translations/hu.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "error": { 4 | "invalid_code": "\u00c9rv\u00e9nytelen k\u00f3d" 5 | }, 6 | "step": { 7 | "init": { 8 | "data": { 9 | "flow_impl": "Szolg\u00e1ltat\u00f3" 10 | } 11 | }, 12 | "link": { 13 | "data": { 14 | "code": "PIN-k\u00f3d" 15 | } 16 | } 17 | }, 18 | "title": "Nest" 19 | } 20 | } -------------------------------------------------------------------------------- /homeassistant/components/cast/.translations/sv.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "abort": { 4 | "no_devices_found": "Inga Google Cast-enheter hittades i n\u00e4tverket.", 5 | "single_instance_allowed": "Endast en enda konfiguration av Google Cast \u00e4r n\u00f6dv\u00e4ndig." 6 | }, 7 | "step": { 8 | "confirm": { 9 | "description": "Vill du konfigurera Google Cast?", 10 | "title": "Google Cast" 11 | } 12 | }, 13 | "title": "Google Cast" 14 | } 15 | } -------------------------------------------------------------------------------- /homeassistant/components/cast/.translations/lb.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "abort": { 4 | "no_devices_found": "Keng Google Cast Apparater am Netzwierk fonnt.", 5 | "single_instance_allowed": "N\u00ebmmen eng eenzeg Konfiguratioun vun Google Cast ass n\u00e9ideg." 6 | }, 7 | "step": { 8 | "confirm": { 9 | "description": "Soll Google Cast konfigur\u00e9iert ginn?", 10 | "title": "Google Cast" 11 | } 12 | }, 13 | "title": "Google Cast" 14 | } 15 | } -------------------------------------------------------------------------------- /homeassistant/components/cast/.translations/no.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "abort": { 4 | "no_devices_found": "Ingen Google Cast enheter funnet p\u00e5 nettverket.", 5 | "single_instance_allowed": "Kun en enkelt konfigurasjon av Google Cast er n\u00f8dvendig." 6 | }, 7 | "step": { 8 | "confirm": { 9 | "description": "\u00d8nsker du \u00e5 sette opp Google Cast?", 10 | "title": "Google Cast" 11 | } 12 | }, 13 | "title": "Google Cast" 14 | } 15 | } -------------------------------------------------------------------------------- /script/test_docker: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Executes the tests with tox in a docker container. 3 | # Every argument is passed to tox to allow running only a subset of tests. 4 | # The following example will only run media_player tests: 5 | # ./test_docker -- tests/components/media_player/ 6 | 7 | # Stop on errors 8 | set -e 9 | 10 | cd "$(dirname "$0")/.." 11 | 12 | docker build -t home-assistant-test -f virtualization/Docker/Dockerfile.dev . 13 | docker run --rm \ 14 | -v `pwd`/.tox/:/usr/src/app/.tox/ \ 15 | -t -i home-assistant-test \ 16 | tox -e py36 ${@:2} 17 | -------------------------------------------------------------------------------- /homeassistant/components/sonos/.translations/zh-Hant.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "abort": { 4 | "no_devices_found": "\u5728\u7db2\u8def\u4e0a\u627e\u4e0d\u5230 Sonos \u8a2d\u5099\u3002", 5 | "single_instance_allowed": "\u50c5\u9700\u8a2d\u5b9a\u4e00\u6b21 Sonos \u5373\u53ef\u3002" 6 | }, 7 | "step": { 8 | "confirm": { 9 | "description": "\u662f\u5426\u8981\u8a2d\u5b9a Sonos\uff1f", 10 | "title": "Sonos" 11 | } 12 | }, 13 | "title": "Sonos" 14 | } 15 | } -------------------------------------------------------------------------------- /homeassistant/components/cast/.translations/cs.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "abort": { 4 | "no_devices_found": "V s\u00edti nebyly nalezena \u017e\u00e1dn\u00e1 za\u0159\u00edzen\u00ed Google Cast.", 5 | "single_instance_allowed": "Pouze jedin\u00e1 konfigurace Google Cast je nezbytn\u00e1." 6 | }, 7 | "step": { 8 | "confirm": { 9 | "description": "Chcete nastavit Google Cast?", 10 | "title": "Google Cast" 11 | } 12 | }, 13 | "title": "Google Cast" 14 | } 15 | } -------------------------------------------------------------------------------- /tests/fixtures/microsoft_face_identify.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "faceId":"c5c24a82-6845-4031-9d5d-978df9175426", 4 | "candidates":[ 5 | { 6 | "personId":"2ae4935b-9659-44c3-977f-61fac20d0538", 7 | "confidence":0.92 8 | } 9 | ] 10 | }, 11 | { 12 | "faceId":"c5c24a82-6825-4031-9d5d-978df0175426", 13 | "candidates":[ 14 | { 15 | "personId":"25985303-c537-4467-b41d-bdb45cd95ca1", 16 | "confidence":0.32 17 | } 18 | ] 19 | } 20 | ] 21 | -------------------------------------------------------------------------------- /tests/fixtures/wunderground-invalid.json: -------------------------------------------------------------------------------- 1 | { 2 | "response": { 3 | "version": "0.1", 4 | "termsofService": "http://www.wunderground.com/weather/api/d/terms.html", 5 | "features": { 6 | "conditions": 1, 7 | "alerts": 1, 8 | "forecast": 1 9 | } 10 | }, 11 | "current_observation": { 12 | "image": { 13 | "url": "http://icons.wxug.com/graphics/wu2/logo_130x80.png", 14 | "title": "Weather Underground", 15 | "link": "http://www.wunderground.com" 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /virtualization/Docker/scripts/ssocr: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Sets up ssocr to support Seven Segments Display. 3 | 4 | # Stop on errors 5 | set -e 6 | 7 | PACKAGES=( 8 | libimlib2 libimlib2-dev 9 | ) 10 | 11 | apt-get install -y --no-install-recommends ${PACKAGES[@]} 12 | 13 | cd /usr/src/app/ 14 | mkdir -p build && cd build 15 | 16 | # Clone the latest code from GitHub 17 | git clone --depth 1 https://github.com/auerswal/ssocr.git ssocr 18 | cd ssocr/ 19 | 20 | # Compile the library 21 | make 22 | 23 | # Install the binaries/libraries to your local system (prefix is /usr/local) 24 | make install -------------------------------------------------------------------------------- /homeassistant/components/deconz/services.yaml: -------------------------------------------------------------------------------- 1 | 2 | configure: 3 | description: Set attribute of device in deCONZ. See https://home-assistant.io/components/deconz/#device-services for details. 4 | fields: 5 | field: 6 | description: Field is a string representing a specific device in deCONZ. 7 | example: '/lights/1/state' 8 | entity: 9 | description: Entity id representing a specific device in deCONZ. 10 | example: 'light.rgb_light' 11 | data: 12 | description: Data is a json object with what data you want to alter. 13 | example: '{"on": true}' 14 | -------------------------------------------------------------------------------- /homeassistant/components/sonos/.translations/zh-Hans.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "abort": { 4 | "no_devices_found": "\u6ca1\u6709\u5728\u7f51\u7edc\u4e0a\u627e\u5230 Sonos \u8bbe\u5907\u3002", 5 | "single_instance_allowed": "\u53ea\u6709\u4e00\u6b21 Sonos \u914d\u7f6e\u662f\u5fc5\u8981\u7684\u3002" 6 | }, 7 | "step": { 8 | "confirm": { 9 | "description": "\u60a8\u60f3\u8981\u914d\u7f6e Sonos \u5417\uff1f", 10 | "title": "Sonos" 11 | } 12 | }, 13 | "title": "Sonos" 14 | } 15 | } -------------------------------------------------------------------------------- /homeassistant/components/cast/.translations/zh-Hant.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "abort": { 4 | "no_devices_found": "\u5728\u7db2\u8def\u4e0a\u627e\u4e0d\u5230 Google Cast \u8a2d\u5099\u3002", 5 | "single_instance_allowed": "\u50c5\u9700\u8a2d\u5b9a\u4e00\u6b21 Google Cast \u5373\u53ef\u3002" 6 | }, 7 | "step": { 8 | "confirm": { 9 | "description": "\u662f\u5426\u8981\u8a2d\u5b9a Google Cast\uff1f", 10 | "title": "Google Cast" 11 | } 12 | }, 13 | "title": "Google Cast" 14 | } 15 | } -------------------------------------------------------------------------------- /homeassistant/components/system_log/services.yaml: -------------------------------------------------------------------------------- 1 | system_log: 2 | clear: 3 | description: Clear all log entries. 4 | write: 5 | description: Write log entry. 6 | fields: 7 | message: 8 | description: Message to log. [Required] 9 | example: Something went wrong 10 | level: 11 | description: "Log level: debug, info, warning, error, critical. Defaults to 'error'." 12 | example: debug 13 | logger: 14 | description: Logger name under which to log the message. Defaults to 'system_log.external'. 15 | example: mycomponent.myplatform 16 | -------------------------------------------------------------------------------- /virtualization/vagrant/Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | Vagrant.configure(2) do |config| 5 | config.vm.box = "debian/contrib-stretch64" 6 | config.vm.synced_folder "../../", "/home-assistant" 7 | config.vm.synced_folder "./config", "/root/.homeassistant" 8 | config.vm.network "forwarded_port", guest: 8123, host: 8123 9 | config.vm.provision "fix-no-tty", type: "shell" do |shell| 10 | shell.path = "provision.sh" 11 | end 12 | config.vm.provider :virtualbox do |vb| 13 | vb.cpus = 2 14 | vb.customize ['modifyvm', :id, '--memory', '1024'] 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /homeassistant/components/ihc/const.py: -------------------------------------------------------------------------------- 1 | """IHC component constants.""" 2 | 3 | CONF_AUTOSETUP = 'auto_setup' 4 | CONF_INFO = 'info' 5 | CONF_XPATH = 'xpath' 6 | CONF_NODE = 'node' 7 | CONF_INVERTING = 'inverting' 8 | CONF_DIMMABLE = 'dimmable' 9 | CONF_BINARY_SENSOR = 'binary_sensor' 10 | CONF_LIGHT = 'light' 11 | CONF_SENSOR = 'sensor' 12 | CONF_SWITCH = 'switch' 13 | 14 | ATTR_IHC_ID = 'ihc_id' 15 | ATTR_VALUE = 'value' 16 | 17 | SERVICE_SET_RUNTIME_VALUE_BOOL = "set_runtime_value_bool" 18 | SERVICE_SET_RUNTIME_VALUE_INT = "set_runtime_value_int" 19 | SERVICE_SET_RUNTIME_VALUE_FLOAT = "set_runtime_value_float" 20 | -------------------------------------------------------------------------------- /homeassistant/components/homematicip_cloud/const.py: -------------------------------------------------------------------------------- 1 | """Constants for the HomematicIP Cloud component.""" 2 | import logging 3 | 4 | _LOGGER = logging.getLogger('homeassistant.components.homematicip_cloud') 5 | 6 | DOMAIN = 'homematicip_cloud' 7 | 8 | COMPONENTS = [ 9 | 'alarm_control_panel', 10 | 'binary_sensor', 11 | 'climate', 12 | 'light', 13 | 'sensor', 14 | 'switch', 15 | ] 16 | 17 | CONF_NAME = 'name' 18 | CONF_ACCESSPOINT = 'accesspoint' 19 | CONF_AUTHTOKEN = 'authtoken' 20 | 21 | HMIPC_NAME = 'name' 22 | HMIPC_HAPID = 'hapid' 23 | HMIPC_AUTHTOKEN = 'authtoken' 24 | HMIPC_PIN = 'pin' 25 | -------------------------------------------------------------------------------- /homeassistant/components/cast/.translations/zh-Hans.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "abort": { 4 | "no_devices_found": "\u6ca1\u6709\u5728\u7f51\u7edc\u4e0a\u627e\u5230 Google Cast \u8bbe\u5907\u3002", 5 | "single_instance_allowed": "\u53ea\u6709\u4e00\u6b21 Google Cast \u914d\u7f6e\u662f\u5fc5\u8981\u7684\u3002" 6 | }, 7 | "step": { 8 | "confirm": { 9 | "description": "\u60a8\u60f3\u8981\u914d\u7f6e Google Cast \u5417\uff1f", 10 | "title": "Google Cast" 11 | } 12 | }, 13 | "title": "Google Cast" 14 | } 15 | } -------------------------------------------------------------------------------- /homeassistant/components/nest/.translations/it.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "step": { 4 | "init": { 5 | "title": "Fornitore di autenticazione" 6 | }, 7 | "link": { 8 | "data": { 9 | "code": "Codice PIN" 10 | }, 11 | "description": "Per collegare l'account Nido, [autorizzare l'account]({url}).\n\nDopo l'autorizzazione, copia-incolla il codice PIN fornito di seguito.", 12 | "title": "Collega un account Nest" 13 | } 14 | }, 15 | "title": "Nest" 16 | } 17 | } -------------------------------------------------------------------------------- /tests/fixtures/Ddwrt_Status_Wireless.txt: -------------------------------------------------------------------------------- 1 | {wl_mac::AA:BB:CC:DD:EE:FF} 2 | {wl_ssid::WIFI_SSD} 3 | {wl_channel::10} 4 | {wl_radio::Radio is On} 5 | {wl_xmit::Auto} 6 | {wl_rate::72 Mbps} 7 | {wl_ack::} 8 | {active_wireless::'AA:BB:CC:DD:EE:00','eth1','3:13:14','72M','24M','HT20','-9','-92','83','1048','AA:BB:CC:DD:EE:01','eth1','10:48:22','72M','72M','HT20','-40','-92','52','664'} 9 | {active_wds::} 10 | {packet_info::SWRXgoodPacket=173673555;SWRXerrorPacket=27;SWTXgoodPacket=311344396;SWTXerrorPacket=3107;} 11 | {uptime:: 12:29:23 up 132 days, 18:03, load average: 0.16, 0.19, 0.20} 12 | {ipinfo:: IP: 192.168.0.108} 13 | 14 | -------------------------------------------------------------------------------- /homeassistant/components/sonos/.translations/vi.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "abort": { 4 | "no_devices_found": "Kh\u00f4ng t\u00ecm th\u1ea5y thi\u1ebft b\u1ecb Sonos n\u00e0o tr\u00ean m\u1ea1ng.", 5 | "single_instance_allowed": "Ch\u1ec9 c\u1ea7n m\u1ed9t c\u1ea5u h\u00ecnh duy nh\u1ea5t c\u1ee7a Sonos l\u00e0 \u0111\u1ee7." 6 | }, 7 | "step": { 8 | "confirm": { 9 | "description": "B\u1ea1n c\u00f3 mu\u1ed1n thi\u1ebft l\u1eadp Sonos kh\u00f4ng?", 10 | "title": "Sonos" 11 | } 12 | }, 13 | "title": "Sonos" 14 | } 15 | } -------------------------------------------------------------------------------- /tests/components/homekit/conftest.py: -------------------------------------------------------------------------------- 1 | """HomeKit session fixtures.""" 2 | from unittest.mock import patch 3 | 4 | import pytest 5 | 6 | from pyhap.accessory_driver import AccessoryDriver 7 | 8 | 9 | @pytest.fixture(scope='session') 10 | def hk_driver(): 11 | """Return a custom AccessoryDriver instance for HomeKit accessory init.""" 12 | with patch('pyhap.accessory_driver.Zeroconf'), \ 13 | patch('pyhap.accessory_driver.AccessoryEncoder'), \ 14 | patch('pyhap.accessory_driver.HAPServer'), \ 15 | patch('pyhap.accessory_driver.AccessoryDriver.publish'): 16 | return AccessoryDriver(pincode=b'123-45-678') 17 | -------------------------------------------------------------------------------- /tests/fixtures/efergy_current_values_multi.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "cid": "PWER", 4 | "data": [ 5 | { 6 | "1485853183000": 218 7 | } 8 | ], 9 | "sid": "728386", 10 | "units": "kWm", 11 | "age": 3 12 | }, 13 | { 14 | "cid": "PWER", 15 | "data": [ 16 | { 17 | "1485695742000": 1808 18 | } 19 | ], 20 | "sid": "0", 21 | "units": "kWm", 22 | "age": 157444 23 | }, 24 | { 25 | "cid": "PWER_GAC", 26 | "data": [ 27 | { 28 | "1485853181000": 312 29 | } 30 | ], 31 | "sid": "728387", 32 | "units": null, 33 | "age": 5 34 | } 35 | ] -------------------------------------------------------------------------------- /homeassistant/components/counter/services.yaml: -------------------------------------------------------------------------------- 1 | # Describes the format for available counter services 2 | 3 | decrement: 4 | description: Decrement a counter. 5 | fields: 6 | entity_id: 7 | description: Entity id of the counter to decrement. 8 | example: 'counter.count0' 9 | increment: 10 | description: Increment a counter. 11 | fields: 12 | entity_id: 13 | description: Entity id of the counter to increment. 14 | example: 'counter.count0' 15 | reset: 16 | description: Reset a counter. 17 | fields: 18 | entity_id: 19 | description: Entity id of the counter to reset. 20 | example: 'counter.count0' -------------------------------------------------------------------------------- /homeassistant/components/sonos/.translations/ko.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "abort": { 4 | "no_devices_found": "Sonos \uc7a5\uce58\uac00 \ub124\ud2b8\uc6cc\ud06c\uc5d0\uc11c \ubc1c\uacac\ub418\uc9c0 \uc54a\uc558\uc2b5\ub2c8\ub2e4.", 5 | "single_instance_allowed": "Sonos\uc758 \ub2e8\uc77c \uad6c\uc131 \ub9cc \ud544\uc694\ud569\ub2c8\ub2e4." 6 | }, 7 | "step": { 8 | "confirm": { 9 | "description": "Sonos\ub97c \uc124\uc815 \ud558\uc2dc\uaca0\uc2b5\ub2c8\uae4c?", 10 | "title": "Sonos" 11 | } 12 | }, 13 | "title": "Sonos" 14 | } 15 | } -------------------------------------------------------------------------------- /homeassistant/components/alexa/const.py: -------------------------------------------------------------------------------- 1 | """Constants for the Alexa integration.""" 2 | DOMAIN = 'alexa' 3 | 4 | # Flash briefing constants 5 | CONF_UID = 'uid' 6 | CONF_TITLE = 'title' 7 | CONF_AUDIO = 'audio' 8 | CONF_TEXT = 'text' 9 | CONF_DISPLAY_URL = 'display_url' 10 | 11 | CONF_FILTER = 'filter' 12 | CONF_ENTITY_CONFIG = 'entity_config' 13 | 14 | ATTR_UID = 'uid' 15 | ATTR_UPDATE_DATE = 'updateDate' 16 | ATTR_TITLE_TEXT = 'titleText' 17 | ATTR_STREAM_URL = 'streamUrl' 18 | ATTR_MAIN_TEXT = 'mainText' 19 | ATTR_REDIRECTION_URL = 'redirectionURL' 20 | 21 | SYN_RESOLUTION_MATCH = 'ER_SUCCESS_MATCH' 22 | 23 | DATE_FORMAT = '%Y-%m-%dT%H:%M:%S.0Z' 24 | -------------------------------------------------------------------------------- /homeassistant/components/zone/.translations/sv.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "error": { 4 | "name_exists": "Namnet finns redan" 5 | }, 6 | "step": { 7 | "init": { 8 | "data": { 9 | "icon": "Ikon", 10 | "latitude": "Latitud", 11 | "longitude": "Longitud", 12 | "name": "Namn", 13 | "passive": "Passiv", 14 | "radius": "Radie" 15 | }, 16 | "title": "Definiera zonparametrar" 17 | } 18 | }, 19 | "title": "Zon" 20 | } 21 | } -------------------------------------------------------------------------------- /homeassistant/components/zone/strings.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "title": "Zone", 4 | "step": { 5 | "init": { 6 | "title": "Define zone parameters", 7 | "data": { 8 | "name": "Name", 9 | "latitude": "Latitude", 10 | "longitude": "Longitude", 11 | "radius": "Radius", 12 | "passive": "Passive", 13 | "icon": "Icon" 14 | } 15 | } 16 | }, 17 | "error": { 18 | "name_exists": "Name already exists" 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /homeassistant/components/zone/.translations/en.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "error": { 4 | "name_exists": "Name already exists" 5 | }, 6 | "step": { 7 | "init": { 8 | "data": { 9 | "icon": "Icon", 10 | "latitude": "Latitude", 11 | "longitude": "Longitude", 12 | "name": "Name", 13 | "passive": "Passive", 14 | "radius": "Radius" 15 | }, 16 | "title": "Define zone parameters" 17 | } 18 | }, 19 | "title": "Zone" 20 | } 21 | } -------------------------------------------------------------------------------- /homeassistant/components/zone/.translations/cy.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "error": { 4 | "name_exists": "Enw eisoes yn bodoli" 5 | }, 6 | "step": { 7 | "init": { 8 | "data": { 9 | "icon": "Eicon", 10 | "latitude": "Lledred", 11 | "longitude": "Hydred", 12 | "name": "Enw", 13 | "passive": "Goddefol", 14 | "radius": "Radiws" 15 | }, 16 | "title": "Ddiffinio paramedrau parth" 17 | } 18 | }, 19 | "title": "Parth" 20 | } 21 | } -------------------------------------------------------------------------------- /script/translations_develop: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Compile the current translation strings files for testing 4 | 5 | # Safe bash settings 6 | # -e Exit on command fail 7 | # -u Exit on unset variable 8 | # -o pipefail Exit if piped command has error code 9 | set -eu -o pipefail 10 | 11 | cd "$(dirname "$0")/.." 12 | 13 | mkdir -p build/translations-download 14 | 15 | script/translations_upload_merge.py 16 | 17 | # Use the generated translations upload file as the mock output from the 18 | # Lokalise download 19 | mv build/translations-upload.json build/translations-download/en.json 20 | 21 | script/translations_download_split.py 22 | -------------------------------------------------------------------------------- /homeassistant/components/cast/.translations/vi.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "abort": { 4 | "no_devices_found": "Kh\u00f4ng t\u00ecm th\u1ea5y thi\u1ebft b\u1ecb Google Cast n\u00e0o tr\u00ean m\u1ea1ng.", 5 | "single_instance_allowed": "Ch\u1ec9 c\u1ea7n m\u1ed9t c\u1ea5u h\u00ecnh duy nh\u1ea5t c\u1ee7a Google Cast l\u00e0 \u0111\u1ee7." 6 | }, 7 | "step": { 8 | "confirm": { 9 | "description": "B\u1ea1n c\u00f3 mu\u1ed1n thi\u1ebft l\u1eadp Google Cast kh\u00f4ng?", 10 | "title": "Google Cast" 11 | } 12 | }, 13 | "title": "Google Cast" 14 | } 15 | } -------------------------------------------------------------------------------- /homeassistant/components/zone/.translations/nl.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "error": { 4 | "name_exists": "Naam bestaat al" 5 | }, 6 | "step": { 7 | "init": { 8 | "data": { 9 | "icon": "Pictogram", 10 | "latitude": "Breedtegraad", 11 | "longitude": "Lengtegraad", 12 | "name": "Naam", 13 | "passive": "Passief", 14 | "radius": "Straal" 15 | }, 16 | "title": "Definieer zone parameters" 17 | } 18 | }, 19 | "title": "Zone" 20 | } 21 | } -------------------------------------------------------------------------------- /homeassistant/components/zone/.translations/no.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "error": { 4 | "name_exists": "Navnet eksisterer allerede" 5 | }, 6 | "step": { 7 | "init": { 8 | "data": { 9 | "icon": "Ikon", 10 | "latitude": "Breddegrad", 11 | "longitude": "Lengdegrad", 12 | "name": "Navn", 13 | "passive": "Passiv", 14 | "radius": "Radius" 15 | }, 16 | "title": "Definer sone parametere" 17 | } 18 | }, 19 | "title": "Sone" 20 | } 21 | } -------------------------------------------------------------------------------- /homeassistant/components/zone/.translations/ca.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "error": { 4 | "name_exists": "El nom ja existeix" 5 | }, 6 | "step": { 7 | "init": { 8 | "data": { 9 | "icon": "Icona", 10 | "latitude": "Latitud", 11 | "longitude": "Longitud", 12 | "name": "Nom", 13 | "passive": "Passiu", 14 | "radius": "Radi" 15 | }, 16 | "title": "Defineix els par\u00e0metres de la zona" 17 | } 18 | }, 19 | "title": "Zona" 20 | } 21 | } -------------------------------------------------------------------------------- /homeassistant/components/cast/.translations/ko.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "abort": { 4 | "no_devices_found": "Googgle Cast \uc7a5\uce58\uac00 \ub124\ud2b8\uc6cc\ud06c\uc5d0\uc11c \ubc1c\uacac\ub418\uc9c0 \uc54a\uc558\uc2b5\ub2c8\ub2e4.", 5 | "single_instance_allowed": "Google Cast\uc758 \ub2e8\uc77c \uad6c\uc131 \ub9cc \ud544\uc694\ud569\ub2c8\ub2e4." 6 | }, 7 | "step": { 8 | "confirm": { 9 | "description": "Google Cast\ub97c \uc124\uc815 \ud558\uc2dc\uaca0\uc2b5\ub2c8\uae4c?", 10 | "title": "Google Cast" 11 | } 12 | }, 13 | "title": "Google Cast" 14 | } 15 | } -------------------------------------------------------------------------------- /homeassistant/components/config/script.py: -------------------------------------------------------------------------------- 1 | """Provide configuration end points for scripts.""" 2 | import asyncio 3 | 4 | from homeassistant.components.config import EditKeyBasedConfigView 5 | from homeassistant.components.script import SCRIPT_ENTRY_SCHEMA, async_reload 6 | import homeassistant.helpers.config_validation as cv 7 | 8 | 9 | CONFIG_PATH = 'scripts.yaml' 10 | 11 | 12 | @asyncio.coroutine 13 | def async_setup(hass): 14 | """Set up the script config API.""" 15 | hass.http.register_view(EditKeyBasedConfigView( 16 | 'script', 'config', CONFIG_PATH, cv.slug, SCRIPT_ENTRY_SCHEMA, 17 | post_write_hook=async_reload 18 | )) 19 | return True 20 | -------------------------------------------------------------------------------- /homeassistant/components/zone/.translations/pt-BR.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "error": { 4 | "name_exists": "O nome j\u00e1 existe" 5 | }, 6 | "step": { 7 | "init": { 8 | "data": { 9 | "icon": "\u00cdcone", 10 | "latitude": "Latitude", 11 | "longitude": "Longitude", 12 | "name": "Nome", 13 | "passive": "Passivo", 14 | "radius": "Raio" 15 | }, 16 | "title": "Definir par\u00e2metros da zona" 17 | } 18 | }, 19 | "title": "Zona" 20 | } 21 | } -------------------------------------------------------------------------------- /homeassistant/components/zone/.translations/pt.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "error": { 4 | "name_exists": "Nome j\u00e1 existente" 5 | }, 6 | "step": { 7 | "init": { 8 | "data": { 9 | "icon": "\u00cdcone", 10 | "latitude": "Latitude", 11 | "longitude": "Longitude", 12 | "name": "Nome", 13 | "passive": "Passivo", 14 | "radius": "Raio" 15 | }, 16 | "title": "Definir os par\u00e2metros da zona" 17 | } 18 | }, 19 | "title": "Zona" 20 | } 21 | } -------------------------------------------------------------------------------- /tests/fixtures/melissa_cur_settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "controller": { 3 | "id": 1, 4 | "user_id": 1, 5 | "serial_number": "12345678", 6 | "mac": "12345678", 7 | "firmware_version": "V1SHTHF", 8 | "name": "Melissa 12345678", 9 | "type": "melissa", 10 | "room_id": null, 11 | "created": "2016-07-06 18:59:46", 12 | "deleted_at": null, 13 | "online": true, 14 | "_relation": { 15 | "command_log": { 16 | "state": 1, 17 | "mode": 2, 18 | "temp": 16, 19 | "fan": 1 20 | } 21 | } 22 | }, 23 | "_links": { 24 | "self": { 25 | "href": "/v1/controllers/12345678" 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /tests/fixtures/ring_chime_health_attrs.json: -------------------------------------------------------------------------------- 1 | { 2 | "device_health": { 3 | "average_signal_category": "good", 4 | "average_signal_strength": -39, 5 | "battery_percentage": 100, 6 | "battery_percentage_category": null, 7 | "battery_voltage": null, 8 | "battery_voltage_category": null, 9 | "firmware": "1.2.3", 10 | "firmware_out_of_date": false, 11 | "id": 999999, 12 | "latest_signal_category": "good", 13 | "latest_signal_strength": -39, 14 | "updated_at": "2017-09-30T07:05:03Z", 15 | "wifi_is_ring_network": false, 16 | "wifi_name": "ring_mock_wifi" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /tests/fixtures/ring_doorboot_health_attrs.json: -------------------------------------------------------------------------------- 1 | { 2 | "device_health": { 3 | "average_signal_category": "good", 4 | "average_signal_strength": -39, 5 | "battery_percentage": 100, 6 | "battery_percentage_category": null, 7 | "battery_voltage": null, 8 | "battery_voltage_category": null, 9 | "firmware": "1.9.2", 10 | "firmware_out_of_date": false, 11 | "id": 987652, 12 | "latest_signal_category": "good", 13 | "latest_signal_strength": -58, 14 | "updated_at": "2017-09-30T07:05:03Z", 15 | "wifi_is_ring_network": false, 16 | "wifi_name": "ring_mock_wifi" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /homeassistant/components/zone/.translations/de.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "error": { 4 | "name_exists": "Name existiert bereits" 5 | }, 6 | "step": { 7 | "init": { 8 | "data": { 9 | "icon": "Symbol", 10 | "latitude": "Breitengrad", 11 | "longitude": "L\u00e4ngengrad", 12 | "name": "Name", 13 | "passive": "Passiv", 14 | "radius": "Radius" 15 | }, 16 | "title": "Definieren Sie die Zonenparameter" 17 | } 18 | }, 19 | "title": "Zone" 20 | } 21 | } -------------------------------------------------------------------------------- /homeassistant/components/zone/.translations/lb.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "error": { 4 | "name_exists": "Numm g\u00ebtt et schonn" 5 | }, 6 | "step": { 7 | "init": { 8 | "data": { 9 | "icon": "Ikone", 10 | "latitude": "Breedegrad", 11 | "longitude": "L\u00e4ngegrad", 12 | "name": "Numm", 13 | "passive": "Passif", 14 | "radius": "Radius" 15 | }, 16 | "title": "D\u00e9fin\u00e9iert Zone Parameter" 17 | } 18 | }, 19 | "title": "Zone" 20 | } 21 | } -------------------------------------------------------------------------------- /homeassistant/components/zone/.translations/it.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "error": { 4 | "name_exists": "Il nome \u00e8 gi\u00e0 esistente" 5 | }, 6 | "step": { 7 | "init": { 8 | "data": { 9 | "icon": "Icona", 10 | "latitude": "Latitudine", 11 | "longitude": "Logitudine", 12 | "name": "Nome", 13 | "passive": "Passiva", 14 | "radius": "Raggio" 15 | }, 16 | "title": "Imposta i parametri della zona" 17 | } 18 | }, 19 | "title": "Zona" 20 | } 21 | } -------------------------------------------------------------------------------- /homeassistant/components/zone/.translations/fr.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "error": { 4 | "name_exists": "Ce nom est d\u00e9j\u00e0 utilis\u00e9" 5 | }, 6 | "step": { 7 | "init": { 8 | "data": { 9 | "icon": "Ic\u00f4ne", 10 | "latitude": "Latitude", 11 | "longitude": "Longitude", 12 | "name": "Nom", 13 | "passive": "Passif", 14 | "radius": "Rayon" 15 | }, 16 | "title": "D\u00e9finir les param\u00e8tres de la zone" 17 | } 18 | }, 19 | "title": "Zone" 20 | } 21 | } -------------------------------------------------------------------------------- /tests/fixtures/wsdot.json: -------------------------------------------------------------------------------- 1 | {"Description": "Downtown Seattle to Downtown Bellevue via I-90", 2 | "TimeUpdated": "/Date(1485040200000-0800)/", 3 | "Distance": 10.6, 4 | "EndPoint": {"Direction": "N", 5 | "Description": "I-405 @ NE 8th St in Bellevue", 6 | "Longitude": -122.18797, 7 | "MilePost": 13.6, 8 | "Latitude": 47.61361, 9 | "RoadName": "I-405"}, 10 | "StartPoint": {"Direction": "S", 11 | "Description": "I-5 @ University St in Seattle", 12 | "Longitude": -122.331759, 13 | "MilePost": 165.83, 14 | "Latitude": 47.609294, 15 | "RoadName": "I-5"}, 16 | "CurrentTime": 11, 17 | "TravelTimeID": 96, 18 | "Name": "Seattle-Bellevue via I-90 (EB AM)", 19 | "AverageTime": 11} 20 | 21 | -------------------------------------------------------------------------------- /tests/fixtures/sleepiq-familystatus.json: -------------------------------------------------------------------------------- 1 | { 2 | "beds" : [ 3 | { 4 | "bedId" : "-31", 5 | "rightSide" : { 6 | "alertId" : 0, 7 | "lastLink" : "00:00:00", 8 | "isInBed" : true, 9 | "sleepNumber" : 40, 10 | "alertDetailedMessage" : "No Alert", 11 | "pressure" : -16 12 | }, 13 | "status" : 1, 14 | "leftSide" : { 15 | "alertId" : 0, 16 | "lastLink" : "00:00:00", 17 | "sleepNumber" : 80, 18 | "alertDetailedMessage" : "No Alert", 19 | "isInBed" : false, 20 | "pressure" : 2191 21 | } 22 | } 23 | ] 24 | } 25 | -------------------------------------------------------------------------------- /homeassistant/components/zone/.translations/sl.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "error": { 4 | "name_exists": "Ime \u017ee obstaja" 5 | }, 6 | "step": { 7 | "init": { 8 | "data": { 9 | "icon": "Ikona", 10 | "latitude": "Zemljepisna \u0161irina", 11 | "longitude": "Zemljepisna dol\u017eina", 12 | "name": "Ime", 13 | "passive": "Pasivno", 14 | "radius": "Radij" 15 | }, 16 | "title": "Dolo\u010dite parametre obmo\u010dja" 17 | } 18 | }, 19 | "title": "Obmo\u010dje" 20 | } 21 | } -------------------------------------------------------------------------------- /tests/fixtures/melissa_fetch_devices.json: -------------------------------------------------------------------------------- 1 | { 2 | "12345678": { 3 | "user_id": 1, 4 | "serial_number": "12345678", 5 | "mac": "12345678", 6 | "firmware_version": "V1SHTHF", 7 | "name": "Melissa 12345678", 8 | "type": "melissa", 9 | "room_id": null, 10 | "created": "2016-07-06 18:59:46", 11 | "id": 1, 12 | "online": true, 13 | "brand_id": 1, 14 | "controller_log": { 15 | "temp": 27.4, 16 | "created": "2018-01-08T21:01:14.281Z", 17 | "raw_temperature": 28928, 18 | "humidity": 18.7, 19 | "raw_humidity": 12946 20 | }, 21 | "_links": { 22 | "self": { 23 | "href": "/v1/controllers" 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /tests/fixtures/foobot_data.json: -------------------------------------------------------------------------------- 1 | { 2 | "uuid": "32463564765421243", 3 | "start": 1518134963, 4 | "end": 1518134963, 5 | "sensors": [ 6 | "time", 7 | "pm", 8 | "tmp", 9 | "hum", 10 | "co2", 11 | "voc", 12 | "allpollu" 13 | ], 14 | "units": [ 15 | "s", 16 | "ugm3", 17 | "C", 18 | "pc", 19 | "ppm", 20 | "ppb", 21 | "%" 22 | ], 23 | "datapoints": [ 24 | [ 25 | 1518134963, 26 | 144.76668, 27 | 21.064333, 28 | 49.474, 29 | 1232.0, 30 | 340.66666, 31 | 138.93651 32 | ] 33 | ] 34 | } 35 | -------------------------------------------------------------------------------- /homeassistant/components/zone/.translations/hu.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "error": { 4 | "name_exists": "A n\u00e9v m\u00e1r l\u00e9tezik" 5 | }, 6 | "step": { 7 | "init": { 8 | "data": { 9 | "icon": "Ikon", 10 | "latitude": "Sz\u00e9less\u00e9g", 11 | "longitude": "Hossz\u00fas\u00e1g", 12 | "name": "N\u00e9v", 13 | "passive": "Passz\u00edv", 14 | "radius": "Sug\u00e1r" 15 | }, 16 | "title": "Z\u00f3na param\u00e9terek megad\u00e1sa" 17 | } 18 | }, 19 | "title": "Z\u00f3na" 20 | } 21 | } -------------------------------------------------------------------------------- /homeassistant/components/zone/.translations/pl.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "error": { 4 | "name_exists": "Nazwa ju\u017c istnieje" 5 | }, 6 | "step": { 7 | "init": { 8 | "data": { 9 | "icon": "Ikona", 10 | "latitude": "Szeroko\u015b\u0107 geograficzna", 11 | "longitude": "D\u0142ugo\u015b\u0107 geograficzna", 12 | "name": "Nazwa", 13 | "passive": "Pasywnie", 14 | "radius": "Promie\u0144" 15 | }, 16 | "title": "Zdefiniuj parametry strefy" 17 | } 18 | }, 19 | "title": "Strefa" 20 | } 21 | } -------------------------------------------------------------------------------- /tests/test_util/test_aiohttp.py: -------------------------------------------------------------------------------- 1 | """Tests for our aiohttp mocker.""" 2 | from .aiohttp import AiohttpClientMocker 3 | 4 | import pytest 5 | 6 | 7 | async def test_matching_url(): 8 | """Test we can match urls.""" 9 | mocker = AiohttpClientMocker() 10 | mocker.get('http://example.com') 11 | await mocker.match_request('get', 'http://example.com/') 12 | 13 | mocker.clear_requests() 14 | 15 | with pytest.raises(AssertionError): 16 | await mocker.match_request('get', 'http://example.com/') 17 | 18 | mocker.clear_requests() 19 | 20 | mocker.get('http://example.com?a=1') 21 | await mocker.match_request('get', 'http://example.com/', 22 | params={'a': 1, 'b': 2}) 23 | -------------------------------------------------------------------------------- /homeassistant/components/homematicip_cloud/errors.py: -------------------------------------------------------------------------------- 1 | """Errors for the HomematicIP component.""" 2 | from homeassistant.exceptions import HomeAssistantError 3 | 4 | 5 | class HmipcException(HomeAssistantError): 6 | """Base class for HomematicIP exceptions.""" 7 | 8 | 9 | class HmipcConnectionError(HmipcException): 10 | """Unable to connect to the HomematicIP cloud server.""" 11 | 12 | 13 | class HmipcConnectionWait(HmipcException): 14 | """Wait for registration to the HomematicIP cloud server.""" 15 | 16 | 17 | class HmipcRegistrationFailed(HmipcException): 18 | """Registration on HomematicIP cloud failed.""" 19 | 20 | 21 | class HmipcPressButton(HmipcException): 22 | """User needs to press the blue button.""" 23 | -------------------------------------------------------------------------------- /homeassistant/components/zone/.translations/zh-Hant.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "error": { 4 | "name_exists": "\u8a72\u540d\u7a31\u5df2\u5b58\u5728" 5 | }, 6 | "step": { 7 | "init": { 8 | "data": { 9 | "icon": "\u5716\u793a", 10 | "latitude": "\u7def\u5ea6", 11 | "longitude": "\u7d93\u5ea6", 12 | "name": "\u540d\u7a31", 13 | "passive": "\u88ab\u52d5", 14 | "radius": "\u534a\u5f91" 15 | }, 16 | "title": "\u5b9a\u7fa9\u5340\u57df\u53c3\u6578" 17 | } 18 | }, 19 | "title": "\u5340\u57df" 20 | } 21 | } -------------------------------------------------------------------------------- /homeassistant/components/zone/.translations/zh-Hans.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "error": { 4 | "name_exists": "\u540d\u79f0\u5df2\u5b58\u5728" 5 | }, 6 | "step": { 7 | "init": { 8 | "data": { 9 | "icon": "\u56fe\u6807", 10 | "latitude": "\u7eac\u5ea6", 11 | "longitude": "\u7ecf\u5ea6", 12 | "name": "\u540d\u79f0", 13 | "passive": "\u88ab\u52a8", 14 | "radius": "\u534a\u5f84" 15 | }, 16 | "title": "\u5b9a\u4e49\u533a\u57df\u76f8\u5173\u53d8\u91cf" 17 | } 18 | }, 19 | "title": "\u533a\u57df" 20 | } 21 | } -------------------------------------------------------------------------------- /docs/source/api/core.rst: -------------------------------------------------------------------------------- 1 | .. _core_module: 2 | 3 | :mod:`homeassistant.core` 4 | ------------------------- 5 | 6 | .. automodule:: homeassistant.core 7 | 8 | .. autoclass:: Config 9 | :members: 10 | 11 | .. autoclass:: Event 12 | :members: 13 | 14 | .. autoclass:: EventBus 15 | :members: 16 | 17 | .. autoclass:: HomeAssistant 18 | :members: 19 | 20 | .. autoclass:: State 21 | :members: 22 | 23 | .. autoclass:: StateMachine 24 | :members: 25 | 26 | .. autoclass:: ServiceCall 27 | :members: 28 | 29 | .. autoclass:: ServiceRegistry 30 | :members: 31 | 32 | Module contents 33 | --------------- 34 | 35 | .. automodule:: homeassistant.core 36 | :members: 37 | :undoc-members: 38 | :show-inheritance: 39 | -------------------------------------------------------------------------------- /homeassistant/components/hue/.translations/ro.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "error": { 4 | "linking": "A ap\u0103rut o eroare de leg\u0103tur\u0103 necunoscut\u0103.", 5 | "register_failed": "Nu a reu\u0219it \u00eenregistrarea, \u00eencerca\u021bi din nou" 6 | }, 7 | "step": { 8 | "init": { 9 | "data": { 10 | "host": "Gazd\u0103" 11 | } 12 | }, 13 | "link": { 14 | "description": "Ap\u0103sa\u021bi butonul de pe pod pentru a \u00eenregistra Philips Hue cu Home Assistant. \n\n ! [Loca\u021bia butonului pe pod] (/ static / images / config_philips_hue.jpg)" 15 | } 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /homeassistant/components/image_processing/services.yaml: -------------------------------------------------------------------------------- 1 | # Describes the format for available image processing services 2 | 3 | scan: 4 | description: Process an image immediately. 5 | fields: 6 | entity_id: 7 | description: Name(s) of entities to scan immediately. 8 | example: 'image_processing.alpr_garage' 9 | 10 | facebox_teach_face: 11 | description: Teach facebox a face using a file. 12 | fields: 13 | entity_id: 14 | description: The facebox entity to teach. 15 | example: 'image_processing.facebox' 16 | name: 17 | description: The name of the face to teach. 18 | example: 'my_name' 19 | file_path: 20 | description: The path to the image file. 21 | example: '/images/my_image.jpg' 22 | -------------------------------------------------------------------------------- /homeassistant/components/zone/.translations/cs.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "error": { 4 | "name_exists": "N\u00e1zev ji\u017e existuje" 5 | }, 6 | "step": { 7 | "init": { 8 | "data": { 9 | "icon": "Ikona", 10 | "latitude": "Zem\u011bpisn\u00e1 \u0161\u00ed\u0159ka", 11 | "longitude": "Zem\u011bpisn\u00e1 d\u00e9lka", 12 | "name": "N\u00e1zev", 13 | "passive": "Pasivn\u00ed", 14 | "radius": "Polom\u011br" 15 | }, 16 | "title": "Definujte parametry z\u00f3ny" 17 | } 18 | }, 19 | "title": "Z\u00f3na" 20 | } 21 | } -------------------------------------------------------------------------------- /tests/fixtures/Ddwrt_Status_Lan.txt: -------------------------------------------------------------------------------- 1 | {lan_mac::AA:BB:CC:DD:EE:F0} 2 | {lan_ip::192.168.1.1} 3 | {lan_ip_prefix::192.168.1.} 4 | {lan_netmask::255.255.255.0} 5 | {lan_gateway::0.0.0.0} 6 | {lan_dns::8.8.8.8} 7 | {lan_proto::dhcp} 8 | {dhcp_daemon::DNSMasq} 9 | {dhcp_start::100} 10 | {dhcp_num::50} 11 | {dhcp_lease_time::1440} 12 | {dhcp_leases:: 'device_1','192.168.1.113','AA:BB:CC:DD:EE:00','1 day 00:00:00','113','device_2','192.168.1.201','AA:BB:CC:DD:EE:01','Static','201'} 13 | {pptp_leases::} 14 | {pppoe_leases::} 15 | {arp_table:: 'device_1','192.168.1.113','AA:BB:CC:DD:EE:00','13','device_2','192.168.1.201','AA:BB:CC:DD:EE:01','1'} 16 | {uptime:: 12:28:48 up 132 days, 18:02, load average: 0.15, 0.19, 0.21} 17 | {ipinfo:: IP: 192.168.0.108} 18 | 19 | -------------------------------------------------------------------------------- /homeassistant/components/hue/.translations/vi.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "abort": { 4 | "all_configured": "T\u1ea5t c\u1ea3 c\u00e1c c\u1ea7u Philips Hue \u0111\u00e3 \u0111\u01b0\u1ee3c c\u1ea5u h\u00ecnh", 5 | "unknown": "X\u1ea3y ra l\u1ed7i kh\u00f4ng x\u00e1c \u0111\u1ecbnh \u0111\u01b0\u1ee3c" 6 | }, 7 | "error": { 8 | "linking": "\u0110\u00e3 x\u1ea3y ra l\u1ed7i li\u00ean k\u1ebft kh\u00f4ng x\u00e1c \u0111\u1ecbnh.", 9 | "register_failed": "Kh\u00f4ng th\u1ec3 \u0111\u0103ng k\u00fd, vui l\u00f2ng th\u1eed l\u1ea1i" 10 | }, 11 | "step": { 12 | "link": { 13 | "title": "Li\u00ean k\u1ebft Hub" 14 | } 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /homeassistant/components/zone/.translations/ko.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "error": { 4 | "name_exists": "\uc774\ub984\uc774 \uc774\ubbf8 \uc874\uc7ac\ud569\ub2c8\ub2e4" 5 | }, 6 | "step": { 7 | "init": { 8 | "data": { 9 | "icon": "\uc544\uc774\ucf58", 10 | "latitude": "\uc704\ub3c4", 11 | "longitude": "\uacbd\ub3c4", 12 | "name": "\uc774\ub984", 13 | "passive": "\uc790\ub3d9\ud654 \uc804\uc6a9", 14 | "radius": "\ubc18\uacbd" 15 | }, 16 | "title": "\uad6c\uc5ed \uc124\uc815" 17 | } 18 | }, 19 | "title": "\uad6c\uc5ed" 20 | } 21 | } -------------------------------------------------------------------------------- /homeassistant/helpers/icon.py: -------------------------------------------------------------------------------- 1 | """Icon helper methods.""" 2 | from typing import Optional 3 | 4 | 5 | def icon_for_battery_level(battery_level: Optional[int] = None, 6 | charging: bool = False) -> str: 7 | """Return a battery icon valid identifier.""" 8 | icon = 'mdi:battery' 9 | if battery_level is None: 10 | return icon + '-unknown' 11 | if charging and battery_level > 10: 12 | icon += '-charging-{}'.format( 13 | int(round(battery_level / 20 - .01)) * 20) 14 | elif charging: 15 | icon += '-outline' 16 | elif battery_level <= 5: 17 | icon += '-alert' 18 | elif 5 < battery_level < 95: 19 | icon += '-{}'.format(int(round(battery_level / 10 - .01)) * 10) 20 | return icon 21 | -------------------------------------------------------------------------------- /virtualization/vagrant/home-assistant@.service: -------------------------------------------------------------------------------- 1 | # This is a simple service file for systems with systemd to tun HA as user. 2 | # 3 | # For details please check https://home-assistant.io/getting-started/autostart/ 4 | # 5 | [Unit] 6 | Description=Home Assistant for %i 7 | After=network.target 8 | 9 | [Service] 10 | Type=simple 11 | User=%i 12 | # Enable the following line if you get network-related HA errors during boot 13 | #ExecStartPre=/usr/bin/sleep 60 14 | # Use `whereis hass` to determine the path of hass 15 | ExecStart=/usr/bin/hass --runner 16 | SendSIGKILL=no 17 | RestartForceExitStatus=100 18 | 19 | # on vagrant (vboxfs), disable sendfile https://www.virtualbox.org/ticket/9069 20 | Environment=AIOHTTP_NOSENDFILE=1 21 | 22 | [Install] 23 | WantedBy=multi-user.target 24 | -------------------------------------------------------------------------------- /homeassistant/components/zone/.translations/vi.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "error": { 4 | "name_exists": "T\u00ean \u0111\u00e3 t\u1ed3n t\u1ea1i" 5 | }, 6 | "step": { 7 | "init": { 8 | "data": { 9 | "icon": "Bi\u1ec3u t\u01b0\u1ee3ng", 10 | "latitude": "V\u0129 \u0111\u1ed9", 11 | "longitude": "Kinh \u0111\u1ed9", 12 | "name": "T\u00ean", 13 | "passive": "Th\u1ee5 \u0111\u1ed9ng", 14 | "radius": "B\u00e1n k\u00ednh" 15 | }, 16 | "title": "X\u00e1c \u0111\u1ecbnh tham s\u1ed1 v\u00f9ng" 17 | } 18 | }, 19 | "title": "V\u00f9ng" 20 | } 21 | } -------------------------------------------------------------------------------- /script/monkeytype: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Run monkeytype on test suite or optionally on a test module or directory. 3 | 4 | # Stop on errors 5 | set -e 6 | 7 | cd "$(dirname "$0")/.." 8 | 9 | command -v pytest >/dev/null 2>&1 || { 10 | echo >&2 "This script requires pytest but it's not installed." \ 11 | "Aborting. Try: pip install pytest"; exit 1; } 12 | 13 | command -v monkeytype >/dev/null 2>&1 || { 14 | echo >&2 "This script requires monkeytype but it's not installed." \ 15 | "Aborting. Try: pip install monkeytype"; exit 1; } 16 | 17 | if [ $# -eq 0 ] 18 | then 19 | echo "Run monkeytype on test suite" 20 | monkeytype run "`command -v pytest`" 21 | exit 22 | fi 23 | 24 | echo "Run monkeytype on tests in $1" 25 | monkeytype run "`command -v pytest`" "$1" 26 | -------------------------------------------------------------------------------- /tests/fixtures/microsoft_face_detect.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "faceId": "c5c24a82-6845-4031-9d5d-978df9175426", 4 | "faceRectangle": { 5 | "width": 78, 6 | "height": 78, 7 | "left": 394, 8 | "top": 54 9 | }, 10 | "faceAttributes": { 11 | "age": 71.0, 12 | "gender": "male", 13 | "smile": 0.88, 14 | "facialHair": { 15 | "mustache": 0.8, 16 | "beard": 0.1, 17 | "sideburns": 0.02 18 | }, 19 | "glasses": "sunglasses", 20 | "headPose": { 21 | "roll": 2.1, 22 | "yaw": 3, 23 | "pitch": 0 24 | } 25 | } 26 | } 27 | ] 28 | -------------------------------------------------------------------------------- /tests/fixtures/microsoft_face_persons.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "personId":"25985303-c537-4467-b41d-bdb45cd95ca1", 4 | "name":"Ryan", 5 | "userData":"User-provided data attached to the person", 6 | "persistedFaceIds":[ 7 | "015839fb-fbd9-4f79-ace9-7675fc2f1dd9", 8 | "fce92aed-d578-4d2e-8114-068f8af4492e", 9 | "b64d5e15-8257-4af2-b20a-5a750f8940e7" 10 | ] 11 | }, 12 | { 13 | "personId":"2ae4935b-9659-44c3-977f-61fac20d0538", 14 | "name":"David", 15 | "userData":"User-provided data attached to the person", 16 | "persistedFaceIds":[ 17 | "30ea1073-cc9e-4652-b1e3-d08fb7b95315", 18 | "fbd2a038-dbff-452c-8e79-2ee81b1aa84e" 19 | ] 20 | } 21 | ] 22 | -------------------------------------------------------------------------------- /tests/components/test_introduction.py: -------------------------------------------------------------------------------- 1 | """The tests for the Introduction component.""" 2 | import unittest 3 | 4 | from homeassistant.setup import setup_component 5 | from homeassistant.components import introduction 6 | 7 | from tests.common import get_test_home_assistant 8 | 9 | 10 | class TestIntroduction(unittest.TestCase): 11 | """Test Introduction.""" 12 | 13 | def setUp(self): 14 | """Setup things to be run when tests are started.""" 15 | self.hass = get_test_home_assistant() 16 | 17 | def tearDown(self): 18 | """Stop down everything that was started.""" 19 | self.hass.stop() 20 | 21 | def test_setup(self): 22 | """Test introduction setup.""" 23 | self.assertTrue(setup_component(self.hass, introduction.DOMAIN, {})) 24 | -------------------------------------------------------------------------------- /tests/fixtures/feedreader.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | RSS Sample 5 | This is an example of an RSS feed 6 | http://www.example.com/main.html 7 | Mon, 30 Apr 2018 12:00:00 +1000 8 | Mon, 30 Apr 2018 15:00:00 +1000 9 | 1800 10 | 11 | 12 | Title 1 13 | Description 1 14 | http://www.example.com/link/1 15 | GUID 1 16 | Mon, 30 Apr 2018 15:10:00 +1000 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /homeassistant/components/google_assistant/helpers.py: -------------------------------------------------------------------------------- 1 | """Helper classes for Google Assistant integration.""" 2 | 3 | 4 | class SmartHomeError(Exception): 5 | """Google Assistant Smart Home errors. 6 | 7 | https://developers.google.com/actions/smarthome/create-app#error_responses 8 | """ 9 | 10 | def __init__(self, code, msg): 11 | """Log error code.""" 12 | super().__init__(msg) 13 | self.code = code 14 | 15 | 16 | class Config: 17 | """Hold the configuration for Google Assistant.""" 18 | 19 | def __init__(self, should_expose, agent_user_id, entity_config=None): 20 | """Initialize the configuration.""" 21 | self.should_expose = should_expose 22 | self.agent_user_id = agent_user_id 23 | self.entity_config = entity_config or {} 24 | -------------------------------------------------------------------------------- /homeassistant/components/persistent_notification/services.yaml: -------------------------------------------------------------------------------- 1 | create: 2 | description: Show a notification in the frontend. 3 | fields: 4 | message: 5 | description: Message body of the notification. [Templates accepted] 6 | example: Please check your configuration.yaml. 7 | title: 8 | description: Optional title for your notification. [Optional, Templates accepted] 9 | example: Test notification 10 | notification_id: 11 | description: Target ID of the notification, will replace a notification with the same Id. [Optional] 12 | example: 1234 13 | 14 | dismiss: 15 | description: Remove a notification from the frontend. 16 | fields: 17 | notification_id: 18 | description: Target ID of the notification, which should be removed. [Required] 19 | example: 1234 20 | -------------------------------------------------------------------------------- /homeassistant/components/sonos/.translations/ru.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "abort": { 4 | "no_devices_found": "\u0423\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 Sonos \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u044b.", 5 | "single_instance_allowed": "\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f Sonos." 6 | }, 7 | "step": { 8 | "confirm": { 9 | "description": "\u0412\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c Sonos?", 10 | "title": "Sonos" 11 | } 12 | }, 13 | "title": "Sonos" 14 | } 15 | } -------------------------------------------------------------------------------- /script/dev_docker: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Build and run Home Assinstant in Docker. 3 | 4 | # Optional: pass in a timezone as first argument 5 | # If not given will attempt to mount /etc/localtime 6 | 7 | # Stop on errors 8 | set -e 9 | 10 | cd "$(dirname "$0")/.." 11 | 12 | docker build -t home-assistant-dev -f virtualization/Docker/Dockerfile.dev . 13 | 14 | if [ $# -gt 0 ] 15 | then 16 | docker run \ 17 | --net=host \ 18 | --device=/dev/ttyUSB0:/zwaveusbstick:rwm \ 19 | -e "TZ=$1" \ 20 | -v `pwd`:/usr/src/app \ 21 | -v `pwd`/config:/config \ 22 | -t -i home-assistant-dev 23 | 24 | else 25 | docker run \ 26 | --net=host \ 27 | -v /etc/localtime:/etc/localtime:ro \ 28 | -v `pwd`:/usr/src/app \ 29 | -v `pwd`/config:/config \ 30 | --rm \ 31 | -t -i home-assistant-dev 32 | 33 | fi 34 | -------------------------------------------------------------------------------- /script/release: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Pushes a new version to PyPi. 3 | 4 | cd "$(dirname "$0")/.." 5 | 6 | head -n 5 homeassistant/const.py | tail -n 1 | grep PATCH_VERSION > /dev/null 7 | 8 | if [ $? -eq 1 ] 9 | then 10 | echo "Patch version not found on const.py line 5" 11 | exit 1 12 | fi 13 | 14 | head -n 5 homeassistant/const.py | tail -n 1 | grep dev > /dev/null 15 | 16 | if [ $? -eq 0 ] 17 | then 18 | echo "Release version should not contain dev tag" 19 | exit 1 20 | fi 21 | 22 | CURRENT_BRANCH=`git rev-parse --abbrev-ref HEAD` 23 | 24 | if [ "$CURRENT_BRANCH" != "master" ] && [ "$CURRENT_BRANCH" != "rc" ] 25 | then 26 | echo "You have to be on the master or rc branch to release." 27 | exit 1 28 | fi 29 | 30 | rm -rf dist 31 | python3 setup.py sdist bdist_wheel 32 | python3 -m twine upload dist/* --skip-existing 33 | -------------------------------------------------------------------------------- /homeassistant/components/ihc/services.yaml: -------------------------------------------------------------------------------- 1 | # Describes the format for available ihc services 2 | 3 | set_runtime_value_bool: 4 | description: Set a boolean runtime value on the ihc controller 5 | fields: 6 | ihc_id: 7 | description: The integer ihc resource id 8 | value: 9 | description: The boolean value to set 10 | 11 | set_runtime_value_int: 12 | description: Set an integer runtime value on the ihc controller 13 | fields: 14 | ihc_id: 15 | description: The integer ihc resource id 16 | value: 17 | description: The integer value to set 18 | 19 | set_runtime_value_float: 20 | description: Set a float runtime value on the ihc controller 21 | fields: 22 | ihc_id: 23 | description: The integer ihc resource id 24 | value: 25 | description: The float value to set 26 | 27 | -------------------------------------------------------------------------------- /homeassistant/components/tts/services.yaml: -------------------------------------------------------------------------------- 1 | # Describes the format for available TTS services 2 | 3 | say: 4 | description: Say some things on a media player. 5 | fields: 6 | entity_id: 7 | description: Name(s) of media player entities. 8 | example: 'media_player.floor' 9 | message: 10 | description: Text to speak on devices. 11 | example: 'My name is hanna' 12 | cache: 13 | description: Control file cache of this message. 14 | example: 'true' 15 | language: 16 | description: Language to use for speech generation. 17 | example: 'ru' 18 | options: 19 | description: A dictionary containing platform-specific options. Optional depending on the platform. 20 | example: platform specific 21 | 22 | clear_cache: 23 | description: Remove cache files and RAM cache. 24 | -------------------------------------------------------------------------------- /tests/testing_config/custom_components/light/test.py: -------------------------------------------------------------------------------- 1 | """ 2 | Provide a mock light platform. 3 | 4 | Call init before using it in your tests to ensure clean test data. 5 | """ 6 | from homeassistant.const import STATE_ON, STATE_OFF 7 | from tests.common import MockToggleDevice 8 | 9 | 10 | DEVICES = [] 11 | 12 | 13 | def init(empty=False): 14 | """Initialize the platform with devices.""" 15 | global DEVICES 16 | 17 | DEVICES = [] if empty else [ 18 | MockToggleDevice('Ceiling', STATE_ON), 19 | MockToggleDevice('Ceiling', STATE_OFF), 20 | MockToggleDevice(None, STATE_OFF) 21 | ] 22 | 23 | 24 | async def async_setup_platform(hass, config, async_add_devices_callback, 25 | discovery_info=None): 26 | """Return mock devices.""" 27 | async_add_devices_callback(DEVICES) 28 | -------------------------------------------------------------------------------- /tests/components/sonos/test_init.py: -------------------------------------------------------------------------------- 1 | """Tests for the Sonos config flow.""" 2 | from unittest.mock import patch 3 | 4 | from homeassistant import data_entry_flow 5 | from homeassistant.components import sonos 6 | 7 | from tests.common import mock_coro 8 | 9 | 10 | async def test_creating_entry_sets_up_media_player(hass): 11 | """Test setting up Sonos loads the media player.""" 12 | with patch('homeassistant.components.media_player.sonos.async_setup_entry', 13 | return_value=mock_coro(True)) as mock_setup, \ 14 | patch('soco.discover', return_value=True): 15 | result = await hass.config_entries.flow.async_init(sonos.DOMAIN) 16 | assert result['type'] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY 17 | 18 | await hass.async_block_till_done() 19 | 20 | assert len(mock_setup.mock_calls) == 1 21 | -------------------------------------------------------------------------------- /tests/testing_config/custom_components/switch/test.py: -------------------------------------------------------------------------------- 1 | """ 2 | Provide a mock switch platform. 3 | 4 | Call init before using it in your tests to ensure clean test data. 5 | """ 6 | from homeassistant.const import STATE_ON, STATE_OFF 7 | from tests.common import MockToggleDevice 8 | 9 | 10 | DEVICES = [] 11 | 12 | 13 | def init(empty=False): 14 | """Initialize the platform with devices.""" 15 | global DEVICES 16 | 17 | DEVICES = [] if empty else [ 18 | MockToggleDevice('AC', STATE_ON), 19 | MockToggleDevice('AC', STATE_OFF), 20 | MockToggleDevice(None, STATE_OFF) 21 | ] 22 | 23 | 24 | async def async_setup_platform(hass, config, async_add_devices_callback, 25 | discovery_info=None): 26 | """Find and return test switches.""" 27 | async_add_devices_callback(DEVICES) 28 | -------------------------------------------------------------------------------- /homeassistant/components/cast/.translations/ru.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "abort": { 4 | "no_devices_found": "\u0423\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 Google Cast \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u044b.", 5 | "single_instance_allowed": "\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f Google Cast." 6 | }, 7 | "step": { 8 | "confirm": { 9 | "description": "\u0412\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c Google Cast?", 10 | "title": "Google Cast" 11 | } 12 | }, 13 | "title": "Google Cast" 14 | } 15 | } -------------------------------------------------------------------------------- /homeassistant/components/mqtt/services.yaml: -------------------------------------------------------------------------------- 1 | # Describes the format for available MQTT services 2 | 3 | publish: 4 | description: Publish a message to an MQTT topic. 5 | fields: 6 | topic: 7 | description: Topic to publish payload. 8 | example: /homeassistant/hello 9 | payload: 10 | description: Payload to publish. 11 | example: This is great 12 | payload_template: 13 | description: Template to render as payload value. Ignored if payload given. 14 | example: "{{ states('sensor.temperature') }}" 15 | qos: 16 | description: Quality of Service to use. 17 | example: 2 18 | values: 19 | - 0 20 | - 1 21 | - 2 22 | default: 0 23 | retain: 24 | description: If message should have the retain flag set. 25 | example: true 26 | default: false 27 | -------------------------------------------------------------------------------- /tests/scripts/test_init.py: -------------------------------------------------------------------------------- 1 | """Test script init.""" 2 | import unittest 3 | from unittest.mock import patch 4 | 5 | import homeassistant.scripts as scripts 6 | 7 | 8 | class TestScripts(unittest.TestCase): 9 | """Tests homeassistant.scripts module.""" 10 | 11 | @patch('homeassistant.scripts.get_default_config_dir', 12 | return_value='/default') 13 | def test_config_per_platform(self, mock_def): 14 | """Test config per platform method.""" 15 | self.assertEqual(scripts.get_default_config_dir(), '/default') 16 | self.assertEqual(scripts.extract_config_dir(), '/default') 17 | self.assertEqual(scripts.extract_config_dir(['']), '/default') 18 | self.assertEqual(scripts.extract_config_dir(['-c', '/arg']), '/arg') 19 | self.assertEqual(scripts.extract_config_dir(['--config', '/a']), '/a') 20 | -------------------------------------------------------------------------------- /tests/fixtures/sleepiq-bed.json: -------------------------------------------------------------------------------- 1 | { 2 | "beds" : [ 3 | { 4 | "dualSleep" : true, 5 | "base" : "FlexFit", 6 | "sku" : "AILE", 7 | "model" : "ILE", 8 | "size" : "KING", 9 | "isKidsBed" : false, 10 | "sleeperRightId" : "-80", 11 | "accountId" : "-32", 12 | "bedId" : "-31", 13 | "registrationDate" : "2016-07-22T14:00:58Z", 14 | "serial" : null, 15 | "reference" : "95000794555-1", 16 | "macAddress" : "CD13A384BA51", 17 | "version" : null, 18 | "purchaseDate" : "2016-06-22T00:00:00Z", 19 | "sleeperLeftId" : "-92", 20 | "zipcode" : "12345", 21 | "returnRequestStatus" : 0, 22 | "name" : "ILE", 23 | "status" : 1, 24 | "timezone" : "US/Eastern" 25 | } 26 | ] 27 | } 28 | 29 | -------------------------------------------------------------------------------- /homeassistant/components/nest/.translations/de.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "step": { 4 | "init": { 5 | "data": { 6 | "flow_impl": "Anbieter" 7 | }, 8 | "description": "W\u00e4hlen Sie, \u00fcber welchen Authentifizierungsanbieter Sie sich bei Nest authentifizieren m\u00f6chten.", 9 | "title": "Authentifizierungsanbieter" 10 | }, 11 | "link": { 12 | "data": { 13 | "code": "PIN Code" 14 | }, 15 | "description": "[Autorisieren Sie ihr Konto] ( {url} ), um ihren Nest-Account zu verkn\u00fcpfen.\n\n F\u00fcgen Sie anschlie\u00dfend den erhaltenen PIN Code hier ein.", 16 | "title": "Nest-Konto verkn\u00fcpfen" 17 | } 18 | }, 19 | "title": "" 20 | } 21 | } -------------------------------------------------------------------------------- /homeassistant/components/config/group.py: -------------------------------------------------------------------------------- 1 | """Provide configuration end points for Groups.""" 2 | import asyncio 3 | from homeassistant.const import SERVICE_RELOAD 4 | from homeassistant.components.config import EditKeyBasedConfigView 5 | from homeassistant.components.group import DOMAIN, GROUP_SCHEMA 6 | import homeassistant.helpers.config_validation as cv 7 | 8 | 9 | CONFIG_PATH = 'groups.yaml' 10 | 11 | 12 | @asyncio.coroutine 13 | def async_setup(hass): 14 | """Set up the Group config API.""" 15 | @asyncio.coroutine 16 | def hook(hass): 17 | """post_write_hook for Config View that reloads groups.""" 18 | yield from hass.services.async_call(DOMAIN, SERVICE_RELOAD) 19 | 20 | hass.http.register_view(EditKeyBasedConfigView( 21 | 'group', 'config', CONFIG_PATH, cv.slug, GROUP_SCHEMA, 22 | post_write_hook=hook 23 | )) 24 | return True 25 | -------------------------------------------------------------------------------- /homeassistant/components/nest/.translations/vi.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "error": { 4 | "internal_error": "M\u00e3 x\u00e1c th\u1ef1c l\u1ed7i n\u1ed9i b\u1ed9", 5 | "invalid_code": "M\u00e3 kh\u00f4ng h\u1ee3p l\u1ec7", 6 | "timeout": "M\u00e3 x\u00e1c th\u1ef1c h\u1ebft th\u1eddi gian ch\u1edd", 7 | "unknown": "M\u00e3 x\u00e1c th\u1ef1c l\u1ed7i kh\u00f4ng x\u00e1c \u0111\u1ecbnh" 8 | }, 9 | "step": { 10 | "init": { 11 | "data": { 12 | "flow_impl": "Nh\u00e0 cung c\u1ea5p" 13 | }, 14 | "title": "Nh\u00e0 cung c\u1ea5p x\u00e1c th\u1ef1c" 15 | }, 16 | "link": { 17 | "title": "Li\u00ean k\u1ebft t\u00e0i kho\u1ea3n Nest" 18 | } 19 | }, 20 | "title": "Nest" 21 | } 22 | } -------------------------------------------------------------------------------- /homeassistant/components/sonos/__init__.py: -------------------------------------------------------------------------------- 1 | """Component to embed Sonos.""" 2 | from homeassistant.helpers import config_entry_flow 3 | 4 | 5 | DOMAIN = 'sonos' 6 | REQUIREMENTS = ['SoCo==0.14'] 7 | 8 | 9 | async def async_setup(hass, config): 10 | """Set up the Sonos component.""" 11 | hass.data[DOMAIN] = config.get(DOMAIN, {}) 12 | return True 13 | 14 | 15 | async def async_setup_entry(hass, entry): 16 | """Set up Sonos from a config entry.""" 17 | hass.async_add_job(hass.config_entries.async_forward_entry_setup( 18 | entry, 'media_player')) 19 | return True 20 | 21 | 22 | async def _async_has_devices(hass): 23 | """Return if there are devices that can be discovered.""" 24 | import soco 25 | 26 | return await hass.async_add_job(soco.discover) 27 | 28 | 29 | config_entry_flow.register_discovery_flow(DOMAIN, 'Sonos', _async_has_devices) 30 | -------------------------------------------------------------------------------- /homeassistant/components/switch/qwikswitch.py: -------------------------------------------------------------------------------- 1 | """ 2 | Support for Qwikswitch relays. 3 | 4 | For more details about this platform, please refer to the documentation at 5 | https://home-assistant.io/components/switch.qwikswitch/ 6 | """ 7 | from homeassistant.components.qwikswitch import ( 8 | QSToggleEntity, DOMAIN as QWIKSWITCH) 9 | from homeassistant.components.switch import SwitchDevice 10 | 11 | DEPENDENCIES = [QWIKSWITCH] 12 | 13 | 14 | async def async_setup_platform(hass, _, add_devices, discovery_info=None): 15 | """Add switches from the main Qwikswitch component.""" 16 | if discovery_info is None: 17 | return 18 | 19 | qsusb = hass.data[QWIKSWITCH] 20 | devs = [QSSwitch(qsid, qsusb) for qsid in discovery_info[QWIKSWITCH]] 21 | add_devices(devs) 22 | 23 | 24 | class QSSwitch(QSToggleEntity, SwitchDevice): 25 | """Switch based on a Qwikswitch relay module.""" 26 | -------------------------------------------------------------------------------- /homeassistant/components/rainmachine/services.yaml: -------------------------------------------------------------------------------- 1 | # Describes the format for available RainMachine services 2 | 3 | --- 4 | start_program: 5 | description: Start a program. 6 | fields: 7 | program_id: 8 | description: The program to start. 9 | example: 3 10 | start_zone: 11 | description: Start a zone for a set number of seconds. 12 | fields: 13 | zone_id: 14 | description: The zone to start. 15 | example: 3 16 | zone_run_time: 17 | description: The number of seconds to run the zone. 18 | example: 120 19 | stop_all: 20 | description: Stop all watering activities. 21 | stop_program: 22 | description: Stop a program. 23 | fields: 24 | program_id: 25 | description: The program to stop. 26 | example: 3 27 | stop_zone: 28 | description: Stop a zone. 29 | fields: 30 | zone_id: 31 | description: The zone to stop. 32 | example: 3 33 | -------------------------------------------------------------------------------- /tests/fixtures/ring_ding_active.json: -------------------------------------------------------------------------------- 1 | [{ 2 | "audio_jitter_buffer_ms": 0, 3 | "device_kind": "lpd_v1", 4 | "doorbot_description": "Front Door", 5 | "doorbot_id": 987652, 6 | "expires_in": 180, 7 | "id": 123456789, 8 | "id_str": "123456789", 9 | "kind": "ding", 10 | "motion": false, 11 | "now": 1490949469.5498993, 12 | "optimization_level": 1, 13 | "protocol": "sip", 14 | "sip_ding_id": "123456789", 15 | "sip_endpoints": null, 16 | "sip_from": "sip:abc123@ring.com", 17 | "sip_server_ip": "192.168.0.1", 18 | "sip_server_port": "15063", 19 | "sip_server_tls": "false", 20 | "sip_session_id": "28qdvjh-2043", 21 | "sip_to": "sip:28qdvjh-2043@192.168.0.1:15063;transport=tcp", 22 | "sip_token": "adecc24a428ed704b2d80adb621b5775755915529639e", 23 | "snapshot_url": "", 24 | "state": "ringing", 25 | "video_jitter_buffer_ms": 0 26 | }] 27 | -------------------------------------------------------------------------------- /script/lint: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Execute lint to spot code mistakes. 3 | 4 | cd "$(dirname "$0")/.." 5 | 6 | export files="$(git diff $(git merge-base upstream/dev HEAD) --diff-filter=d --name-only | grep -e '\.py$')" 7 | echo '=================================================' 8 | echo '= FILES CHANGED =' 9 | echo '=================================================' 10 | if [ -z "$files" ] ; then 11 | echo "No python file changed. Rather use: tox -e lint\n" 12 | exit 13 | fi 14 | printf "%s\n" $files 15 | echo "================" 16 | echo "LINT with flake8" 17 | echo "================" 18 | flake8 --doctests $files 19 | echo "================" 20 | echo "LINT with pylint" 21 | echo "================" 22 | pylint_files=$(echo "$files" | grep -v '^tests.*') 23 | if [ -z "$pylint_files" ] ; then 24 | echo "Only test files changed. Skipping\n" 25 | exit 26 | fi 27 | pylint $pylint_files 28 | echo 29 | -------------------------------------------------------------------------------- /homeassistant/components/remember_the_milk/services.yaml: -------------------------------------------------------------------------------- 1 | # Describes the format for available Remember The Milk services 2 | 3 | create_task: 4 | description: > 5 | Create (or update) a new task in your Remember The Milk account. If you want to update a task 6 | later on, you have to set an "id" when creating the task. 7 | Note: Updating a tasks does not support the smart syntax. 8 | 9 | fields: 10 | name: 11 | description: name of the new task, you can use the smart syntax here 12 | example: 'do this ^today #from_hass' 13 | 14 | id: 15 | description: (optional) identifier for the task you're creating, can be used to update or complete the task later on 16 | example: myid 17 | 18 | complete_task: 19 | description: Complete a tasks that was privously created. 20 | 21 | fields: 22 | id: 23 | description: identifier that was defined when creating the task 24 | example: myid -------------------------------------------------------------------------------- /homeassistant/components/mycroft.py: -------------------------------------------------------------------------------- 1 | """ 2 | Support for Mycroft AI. 3 | 4 | For more details about this component, please refer to the documentation at 5 | https://home-assistant.io/components/mycroft 6 | """ 7 | 8 | import logging 9 | 10 | import voluptuous as vol 11 | 12 | from homeassistant.const import CONF_HOST 13 | from homeassistant.helpers import discovery 14 | import homeassistant.helpers.config_validation as cv 15 | 16 | REQUIREMENTS = ['mycroftapi==2.0'] 17 | 18 | _LOGGER = logging.getLogger(__name__) 19 | 20 | 21 | DOMAIN = 'mycroft' 22 | 23 | 24 | CONFIG_SCHEMA = vol.Schema({ 25 | DOMAIN: vol.Schema({ 26 | vol.Required(CONF_HOST): cv.string 27 | }) 28 | }, extra=vol.ALLOW_EXTRA) 29 | 30 | 31 | def setup(hass, config): 32 | """Set up the Mycroft component.""" 33 | hass.data[DOMAIN] = config[DOMAIN][CONF_HOST] 34 | discovery.load_platform(hass, 'notify', DOMAIN, {}, config) 35 | return True 36 | -------------------------------------------------------------------------------- /homeassistant/components/telegram_bot/broadcast.py: -------------------------------------------------------------------------------- 1 | """ 2 | Telegram bot implementation to send messages only. 3 | 4 | For more details about this platform, please refer to the documentation at 5 | https://home-assistant.io/components/telegram_bot.broadcast/ 6 | """ 7 | import asyncio 8 | import logging 9 | 10 | from homeassistant.components.telegram_bot import ( 11 | initialize_bot, 12 | PLATFORM_SCHEMA as TELEGRAM_PLATFORM_SCHEMA) 13 | 14 | _LOGGER = logging.getLogger(__name__) 15 | 16 | PLATFORM_SCHEMA = TELEGRAM_PLATFORM_SCHEMA 17 | 18 | 19 | @asyncio.coroutine 20 | def async_setup_platform(hass, config): 21 | """Set up the Telegram broadcast platform.""" 22 | # Check the API key works 23 | 24 | bot = initialize_bot(config) 25 | 26 | bot_config = yield from hass.async_add_job(bot.getMe) 27 | _LOGGER.debug("Telegram broadcast platform setup with bot %s", 28 | bot_config['username']) 29 | return True 30 | -------------------------------------------------------------------------------- /virtualization/Docker/scripts/openalpr: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Sets up openalpr. 3 | 4 | # Stop on errors 5 | set -e 6 | 7 | PACKAGES=( 8 | # homeassistant.components.image_processing.openalpr_local 9 | libopencv-dev libtesseract-dev libleptonica-dev liblog4cplus-dev 10 | ) 11 | 12 | apt-get install -y --no-install-recommends ${PACKAGES[@]} 13 | 14 | cd /usr/src/app/ 15 | mkdir -p build && cd build 16 | 17 | # Clone the latest code from GitHub 18 | git clone --depth 1 https://github.com/openalpr/openalpr.git openalpr 19 | 20 | # Setup the build directory 21 | cd openalpr/src/ 22 | mkdir -p build 23 | cd build 24 | 25 | # Setup the compile environment 26 | cmake -DWITH_TEST=FALSE -DWITH_BINDING_JAVA=FALSE --DWITH_BINDING_PYTHON=FALSE --DWITH_BINDING_GO=FALSE -DWITH_DAEMON=FALSE -DCMAKE_INSTALL_PREFIX:PATH=/usr/local .. 27 | 28 | # compile the library 29 | make 30 | 31 | # Install the binaries/libraries to your local system (prefix is /usr/local) 32 | make install -------------------------------------------------------------------------------- /homeassistant/components/cast/__init__.py: -------------------------------------------------------------------------------- 1 | """Component to embed Google Cast.""" 2 | from homeassistant.helpers import config_entry_flow 3 | 4 | 5 | DOMAIN = 'cast' 6 | REQUIREMENTS = ['pychromecast==2.1.0'] 7 | 8 | 9 | async def async_setup(hass, config): 10 | """Set up the Cast component.""" 11 | hass.data[DOMAIN] = config.get(DOMAIN, {}) 12 | return True 13 | 14 | 15 | async def async_setup_entry(hass, entry): 16 | """Set up Cast from a config entry.""" 17 | hass.async_add_job(hass.config_entries.async_forward_entry_setup( 18 | entry, 'media_player')) 19 | return True 20 | 21 | 22 | async def _async_has_devices(hass): 23 | """Return if there are devices that can be discovered.""" 24 | from pychromecast.discovery import discover_chromecasts 25 | 26 | return await hass.async_add_job(discover_chromecasts) 27 | 28 | 29 | config_entry_flow.register_discovery_flow( 30 | DOMAIN, 'Google Cast', _async_has_devices) 31 | -------------------------------------------------------------------------------- /tests/components/cast/test_init.py: -------------------------------------------------------------------------------- 1 | """Tests for the Cast config flow.""" 2 | from unittest.mock import patch 3 | 4 | from homeassistant import data_entry_flow 5 | from homeassistant.components import cast 6 | 7 | from tests.common import MockDependency, mock_coro 8 | 9 | 10 | async def test_creating_entry_sets_up_media_player(hass): 11 | """Test setting up Cast loads the media player.""" 12 | with patch('homeassistant.components.media_player.cast.async_setup_entry', 13 | return_value=mock_coro(True)) as mock_setup, \ 14 | MockDependency('pychromecast', 'discovery'), \ 15 | patch('pychromecast.discovery.discover_chromecasts', 16 | return_value=True): 17 | result = await hass.config_entries.flow.async_init(cast.DOMAIN) 18 | assert result['type'] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY 19 | 20 | await hass.async_block_till_done() 21 | 22 | assert len(mock_setup.mock_calls) == 1 23 | -------------------------------------------------------------------------------- /tests/components/http/__init__.py: -------------------------------------------------------------------------------- 1 | """Tests for the HTTP component.""" 2 | from ipaddress import ip_address 3 | 4 | from aiohttp import web 5 | 6 | from homeassistant.components.http.const import KEY_REAL_IP 7 | 8 | 9 | def mock_real_ip(app): 10 | """Inject middleware to mock real IP. 11 | 12 | Returns a function to set the real IP. 13 | """ 14 | ip_to_mock = None 15 | 16 | def set_ip_to_mock(value): 17 | nonlocal ip_to_mock 18 | ip_to_mock = value 19 | 20 | @web.middleware 21 | async def mock_real_ip(request, handler): 22 | """Mock Real IP middleware.""" 23 | nonlocal ip_to_mock 24 | 25 | request[KEY_REAL_IP] = ip_address(ip_to_mock) 26 | 27 | return (await handler(request)) 28 | 29 | async def real_ip_startup(app): 30 | """Startup of real ip.""" 31 | app.middlewares.insert(0, mock_real_ip) 32 | 33 | app.on_startup.append(real_ip_startup) 34 | 35 | return set_ip_to_mock 36 | -------------------------------------------------------------------------------- /homeassistant/components/automation/services.yaml: -------------------------------------------------------------------------------- 1 | # Describes the format for available automation services 2 | 3 | turn_on: 4 | description: Enable an automation. 5 | fields: 6 | entity_id: 7 | description: Name of the automation to turn on. 8 | example: 'automation.notify_home' 9 | 10 | turn_off: 11 | description: Disable an automation. 12 | fields: 13 | entity_id: 14 | description: Name of the automation to turn off. 15 | example: 'automation.notify_home' 16 | 17 | toggle: 18 | description: Toggle an automation. 19 | fields: 20 | entity_id: 21 | description: Name of the automation to toggle on/off. 22 | example: 'automation.notify_home' 23 | 24 | trigger: 25 | description: Trigger the action of an automation. 26 | fields: 27 | entity_id: 28 | description: Name of the automation to trigger. 29 | example: 'automation.notify_home' 30 | 31 | reload: 32 | description: Reload the automation configuration. 33 | -------------------------------------------------------------------------------- /homeassistant/components/browser.py: -------------------------------------------------------------------------------- 1 | """ 2 | Provides functionality to launch a web browser on the host machine. 3 | 4 | For more details about this component, please refer to the documentation at 5 | https://home-assistant.io/components/browser/ 6 | """ 7 | import voluptuous as vol 8 | 9 | DOMAIN = "browser" 10 | SERVICE_BROWSE_URL = "browse_url" 11 | 12 | ATTR_URL = 'url' 13 | ATTR_URL_DEFAULT = 'https://www.google.com' 14 | 15 | SERVICE_BROWSE_URL_SCHEMA = vol.Schema({ 16 | # pylint: disable=no-value-for-parameter 17 | vol.Required(ATTR_URL, default=ATTR_URL_DEFAULT): vol.Url(), 18 | }) 19 | 20 | 21 | def setup(hass, config): 22 | """Listen for browse_url events.""" 23 | import webbrowser 24 | 25 | hass.services.register(DOMAIN, SERVICE_BROWSE_URL, 26 | lambda service: 27 | webbrowser.open(service.data[ATTR_URL]), 28 | schema=SERVICE_BROWSE_URL_SCHEMA) 29 | 30 | return True 31 | -------------------------------------------------------------------------------- /homeassistant/components/timer/services.yaml: -------------------------------------------------------------------------------- 1 | # Describes the format for available timer services 2 | 3 | start: 4 | description: Start a timer. 5 | 6 | fields: 7 | entity_id: 8 | description: Entity id of the timer to start. [optional] 9 | example: 'timer.timer0' 10 | duration: 11 | description: Duration the timer requires to finish. [optional] 12 | example: '00:01:00 or 60' 13 | 14 | pause: 15 | description: Pause a timer. 16 | 17 | fields: 18 | entity_id: 19 | description: Entity id of the timer to pause. [optional] 20 | example: 'timer.timer0' 21 | 22 | cancel: 23 | description: Cancel a timer. 24 | 25 | fields: 26 | entity_id: 27 | description: Entity id of the timer to cancel. [optional] 28 | example: 'timer.timer0' 29 | 30 | finish: 31 | description: Finish a timer. 32 | 33 | fields: 34 | entity_id: 35 | description: Entity id of the timer to finish. [optional] 36 | example: 'timer.timer0' -------------------------------------------------------------------------------- /homeassistant/components/config/core.py: -------------------------------------------------------------------------------- 1 | """Component to interact with Hassbian tools.""" 2 | import asyncio 3 | 4 | from homeassistant.components.http import HomeAssistantView 5 | from homeassistant.config import async_check_ha_config_file 6 | 7 | 8 | @asyncio.coroutine 9 | def async_setup(hass): 10 | """Set up the Hassbian config.""" 11 | hass.http.register_view(CheckConfigView) 12 | return True 13 | 14 | 15 | class CheckConfigView(HomeAssistantView): 16 | """Hassbian packages endpoint.""" 17 | 18 | url = '/api/config/core/check_config' 19 | name = 'api:config:core:check_config' 20 | 21 | @asyncio.coroutine 22 | def post(self, request): 23 | """Validate configuration and return results.""" 24 | errors = yield from async_check_ha_config_file(request.app['hass']) 25 | 26 | state = 'invalid' if errors else 'valid' 27 | 28 | return self.json({ 29 | "result": state, 30 | "errors": errors, 31 | }) 32 | -------------------------------------------------------------------------------- /tests/components/camera/test_demo.py: -------------------------------------------------------------------------------- 1 | """The tests for local file camera component.""" 2 | import asyncio 3 | from homeassistant.components import camera 4 | from homeassistant.setup import async_setup_component 5 | 6 | 7 | @asyncio.coroutine 8 | def test_motion_detection(hass): 9 | """Test motion detection services.""" 10 | # Setup platform 11 | yield from async_setup_component(hass, 'camera', { 12 | 'camera': { 13 | 'platform': 'demo' 14 | } 15 | }) 16 | 17 | # Fetch state and check motion detection attribute 18 | state = hass.states.get('camera.demo_camera') 19 | assert not state.attributes.get('motion_detection') 20 | 21 | # Call service to turn on motion detection 22 | camera.enable_motion_detection(hass, 'camera.demo_camera') 23 | yield from hass.async_block_till_done() 24 | 25 | # Check if state has been updated. 26 | state = hass.states.get('camera.demo_camera') 27 | assert state.attributes.get('motion_detection') 28 | -------------------------------------------------------------------------------- /homeassistant/components/cloud/const.py: -------------------------------------------------------------------------------- 1 | """Constants for the cloud component.""" 2 | DOMAIN = 'cloud' 3 | CONFIG_DIR = '.cloud' 4 | REQUEST_TIMEOUT = 10 5 | 6 | SERVERS = { 7 | 'production': { 8 | 'cognito_client_id': '60i2uvhvbiref2mftj7rgcrt9u', 9 | 'user_pool_id': 'us-east-1_87ll5WOP8', 10 | 'region': 'us-east-1', 11 | 'relayer': 'wss://cloud.hass.io:8000/websocket', 12 | 'google_actions_sync_url': ('https://24ab3v80xd.execute-api.us-east-1.' 13 | 'amazonaws.com/prod/smart_home_sync'), 14 | } 15 | } 16 | 17 | MESSAGE_EXPIRATION = """ 18 | It looks like your Home Assistant Cloud subscription has expired. Please check 19 | your [account page](/config/cloud/account) to continue using the service. 20 | """ 21 | 22 | MESSAGE_AUTH_FAIL = """ 23 | You have been logged out of Home Assistant Cloud because we have been unable 24 | to verify your credentials. Please [log in](/config/cloud) again to continue 25 | using the service. 26 | """ 27 | -------------------------------------------------------------------------------- /homeassistant/components/deconz/.translations/cy.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "abort": { 4 | "already_configured": "Pont eisoes wedi'i ffurfweddu", 5 | "no_bridges": "Dim pontydd deCONZ wedi eu darganfod", 6 | "one_instance_only": "Elfen dim ond yn cefnogi enghraifft deCONZ" 7 | }, 8 | "error": { 9 | "no_key": "Methu cael allwedd API" 10 | }, 11 | "step": { 12 | "init": { 13 | "data": { 14 | "host": "Gwesteiwr", 15 | "port": "Port (gwerth diofyn: '80')" 16 | }, 17 | "title": "Diffiniwch porth dad-adeiladu" 18 | }, 19 | "link": { 20 | "description": "Datgloi eich porth deCONZ i gofrestru gyda Cynorthwydd Cartref.\n\n1. Ewch i osodiadau system deCONZ \n2. Bwyso botwm \"Datgloi porth\"", 21 | "title": "Cysylltu \u00e2 deCONZ" 22 | } 23 | }, 24 | "title": "deCONZ" 25 | } 26 | } -------------------------------------------------------------------------------- /homeassistant/components/calendar/services.yaml: -------------------------------------------------------------------------------- 1 | # Describes the format for available calendar services 2 | 3 | todoist_new_task: 4 | description: Create a new task and add it to a project. 5 | fields: 6 | content: 7 | description: The name of the task. 8 | example: Pick up the mail 9 | project: 10 | description: The name of the project this task should belong to. Defaults to Inbox. 11 | example: Errands 12 | labels: 13 | description: Any labels that you want to apply to this task, separated by a comma. 14 | example: Chores,Deliveries 15 | priority: 16 | description: The priority of this task, from 1 (normal) to 4 (urgent). 17 | example: 2 18 | due_date_string: 19 | description: The day this task is due, in natural language. 20 | example: "tomorrow" 21 | due_date_lang: 22 | description: The language of due_date_string. 23 | example: "en" 24 | due_date: 25 | description: The day this task is due, in format YYYY-MM-DD. 26 | example: "2018-04-01" 27 | -------------------------------------------------------------------------------- /tests/fixtures/feedreader3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | RSS Sample 5 | This is an example of an RSS feed 6 | http://www.example.com/main.html 7 | Mon, 30 Apr 2018 12:00:00 +1000 8 | Mon, 30 Apr 2018 15:00:00 +1000 9 | 1800 10 | 11 | 12 | Title 1 13 | Description 1 14 | http://www.example.com/link/1 15 | GUID 1 16 | Mon, 30 Apr 2018 15:10:00 +1000 17 | 18 | 19 | Title 2 20 | Description 2 21 | http://www.example.com/link/2 22 | GUID 2 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /homeassistant/components/deconz/.translations/it.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "abort": { 4 | "already_configured": "Il Bridge \u00e8 gi\u00e0 configurato", 5 | "no_bridges": "Nessun bridge deCONZ rilevato", 6 | "one_instance_only": "Il componente supporto solo un'istanza di deCONZ" 7 | }, 8 | "error": { 9 | "no_key": "Impossibile ottenere una API key" 10 | }, 11 | "step": { 12 | "init": { 13 | "data": { 14 | "host": "Host", 15 | "port": "Porta (valore di default: '80')" 16 | }, 17 | "title": "Definisci il gateway deCONZ" 18 | }, 19 | "link": { 20 | "description": "Sblocca il tuo gateway deCONZ per registrarlo in Home Assistant.\n\n1. Vai nelle impostazioni di sistema di deCONZ\n2. Premi il bottone \"Unlock Gateway\"", 21 | "title": "Collega con deCONZ" 22 | } 23 | }, 24 | "title": "deCONZ" 25 | } 26 | } -------------------------------------------------------------------------------- /homeassistant/components/light/zigbee.py: -------------------------------------------------------------------------------- 1 | """ 2 | Functionality to use a ZigBee device as a light. 3 | 4 | For more details about this platform, please refer to the documentation at 5 | https://home-assistant.io/components/light.zigbee/ 6 | """ 7 | import voluptuous as vol 8 | 9 | from homeassistant.components.light import Light 10 | from homeassistant.components.zigbee import ( 11 | ZigBeeDigitalOut, ZigBeeDigitalOutConfig, PLATFORM_SCHEMA) 12 | 13 | CONF_ON_STATE = 'on_state' 14 | 15 | DEFAULT_ON_STATE = 'high' 16 | DEPENDENCIES = ['zigbee'] 17 | 18 | STATES = ['high', 'low'] 19 | 20 | PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ 21 | vol.Optional(CONF_ON_STATE, default=DEFAULT_ON_STATE): vol.In(STATES), 22 | }) 23 | 24 | 25 | def setup_platform(hass, config, add_devices, discovery_info=None): 26 | """Create and add an entity based on the configuration.""" 27 | add_devices([ZigBeeLight(hass, ZigBeeDigitalOutConfig(config))]) 28 | 29 | 30 | class ZigBeeLight(ZigBeeDigitalOut, Light): 31 | """Use ZigBeeDigitalOut as light.""" 32 | 33 | pass 34 | -------------------------------------------------------------------------------- /tests/components/auth/__init__.py: -------------------------------------------------------------------------------- 1 | """Tests for the auth component.""" 2 | from homeassistant import auth 3 | from homeassistant.setup import async_setup_component 4 | 5 | from tests.common import ensure_auth_manager_loaded 6 | 7 | 8 | BASE_CONFIG = [{ 9 | 'name': 'Example', 10 | 'type': 'insecure_example', 11 | 'users': [{ 12 | 'username': 'test-user', 13 | 'password': 'test-pass', 14 | 'name': 'Test Name' 15 | }] 16 | }] 17 | 18 | 19 | async def async_setup_auth(hass, aiohttp_client, provider_configs=BASE_CONFIG, 20 | setup_api=False): 21 | """Helper to setup authentication and create a HTTP client.""" 22 | hass.auth = await auth.auth_manager_from_config(hass, provider_configs) 23 | ensure_auth_manager_loaded(hass.auth) 24 | await async_setup_component(hass, 'auth', { 25 | 'http': { 26 | 'api_password': 'bla' 27 | } 28 | }) 29 | if setup_api: 30 | await async_setup_component(hass, 'api', {}) 31 | return await aiohttp_client(hass.http.app) 32 | -------------------------------------------------------------------------------- /homeassistant/components/notify/demo.py: -------------------------------------------------------------------------------- 1 | """ 2 | Demo notification service. 3 | 4 | For more details about this platform, please refer to the documentation 5 | https://home-assistant.io/components/demo/ 6 | """ 7 | from homeassistant.components.notify import BaseNotificationService 8 | 9 | EVENT_NOTIFY = "notify" 10 | 11 | 12 | def get_service(hass, config, discovery_info=None): 13 | """Get the demo notification service.""" 14 | return DemoNotificationService(hass) 15 | 16 | 17 | class DemoNotificationService(BaseNotificationService): 18 | """Implement demo notification service.""" 19 | 20 | def __init__(self, hass): 21 | """Initialize the service.""" 22 | self.hass = hass 23 | 24 | @property 25 | def targets(self): 26 | """Return a dictionary of registered targets.""" 27 | return {"test target name": "test target id"} 28 | 29 | def send_message(self, message="", **kwargs): 30 | """Send a message to a user.""" 31 | kwargs['message'] = message 32 | self.hass.bus.fire(EVENT_NOTIFY, kwargs) 33 | -------------------------------------------------------------------------------- /homeassistant/components/hue/strings.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "title": "Philips Hue", 4 | "step": { 5 | "init": { 6 | "title": "Pick Hue bridge", 7 | "data": { 8 | "host": "Host" 9 | } 10 | }, 11 | "link": { 12 | "title": "Link Hub", 13 | "description": "Press the button on the bridge to register Philips Hue with Home Assistant.\n\n![Location of button on bridge](/static/images/config_philips_hue.jpg)" 14 | } 15 | }, 16 | "error": { 17 | "register_failed": "Failed to register, please try again", 18 | "linking": "Unknown linking error occurred." 19 | }, 20 | "abort": { 21 | "discover_timeout": "Unable to discover Hue bridges", 22 | "no_bridges": "No Philips Hue bridges discovered", 23 | "all_configured": "All Philips Hue bridges are already configured", 24 | "unknown": "Unknown error occurred", 25 | "cannot_connect": "Unable to connect to the bridge", 26 | "already_configured": "Bridge is already configured" 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /homeassistant/components/zone/.translations/ru.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "error": { 4 | "name_exists": "\u0418\u043c\u044f \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442" 5 | }, 6 | "step": { 7 | "init": { 8 | "data": { 9 | "icon": "\u0417\u043d\u0430\u0447\u043e\u043a", 10 | "latitude": "\u0428\u0438\u0440\u043e\u0442\u0430", 11 | "longitude": "\u0414\u043e\u043b\u0433\u043e\u0442\u0430", 12 | "name": "\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435", 13 | "passive": "\u041f\u0430\u0441\u0441\u0438\u0432\u043d\u0430\u044f", 14 | "radius": "\u0420\u0430\u0434\u0438\u0443\u0441" 15 | }, 16 | "title": "\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0437\u043e\u043d\u044b" 17 | } 18 | }, 19 | "title": "\u0417\u043e\u043d\u0430" 20 | } 21 | } -------------------------------------------------------------------------------- /homeassistant/components/zone/.translations/bg.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "error": { 4 | "name_exists": "\u0418\u043c\u0435\u0442\u043e \u0432\u0435\u0447\u0435 \u0441\u044a\u0449\u0435\u0441\u0442\u0432\u0443\u0432\u0430" 5 | }, 6 | "step": { 7 | "init": { 8 | "data": { 9 | "icon": "\u0418\u043a\u043e\u043d\u0430", 10 | "latitude": "\u0428\u0438\u0440\u0438\u043d\u0430", 11 | "longitude": "\u0414\u044a\u043b\u0436\u0438\u043d\u0430", 12 | "name": "\u0418\u043c\u0435", 13 | "passive": "\u041f\u0430\u0441\u0438\u0432\u043d\u0430", 14 | "radius": "\u0420\u0430\u0434\u0438\u0443\u0441" 15 | }, 16 | "title": "\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u0442\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0442\u0435 \u043d\u0430 \u0437\u043e\u043d\u0430\u0442\u0430" 17 | } 18 | }, 19 | "title": "\u0417\u043e\u043d\u0430" 20 | } 21 | } -------------------------------------------------------------------------------- /tests/components/camera/test_mqtt.py: -------------------------------------------------------------------------------- 1 | """The tests for mqtt camera component.""" 2 | import asyncio 3 | 4 | from homeassistant.setup import async_setup_component 5 | 6 | from tests.common import ( 7 | async_mock_mqtt_component, async_fire_mqtt_message) 8 | 9 | 10 | @asyncio.coroutine 11 | def test_run_camera_setup(hass, aiohttp_client): 12 | """Test that it fetches the given payload.""" 13 | topic = 'test/camera' 14 | yield from async_mock_mqtt_component(hass) 15 | yield from async_setup_component(hass, 'camera', { 16 | 'camera': { 17 | 'platform': 'mqtt', 18 | 'topic': topic, 19 | 'name': 'Test Camera', 20 | }}) 21 | 22 | url = hass.states.get('camera.test_camera').attributes['entity_picture'] 23 | 24 | async_fire_mqtt_message(hass, topic, 'beer') 25 | yield from hass.async_block_till_done() 26 | 27 | client = yield from aiohttp_client(hass.http.app) 28 | resp = yield from client.get(url) 29 | assert resp.status == 200 30 | body = yield from resp.text() 31 | assert body == 'beer' 32 | -------------------------------------------------------------------------------- /homeassistant/scripts/macos/launchd.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Label 6 | org.homeassistant 7 | 8 | EnvironmentVariables 9 | 10 | PATH 11 | /usr/local/bin/:/usr/bin:/usr/sbin:$PATH 12 | LC_CTYPE 13 | UTF-8 14 | 15 | 16 | Program 17 | $HASS_PATH$ 18 | 19 | AbandonProcessGroup 20 | 21 | 22 | RunAtLoad 23 | 24 | 25 | KeepAlive 26 | 27 | SuccessfulExit 28 | 29 | 30 | 31 | StandardErrorPath 32 | /Users/$USER$/Library/Logs/homeassistant.log 33 | 34 | StandardOutPath 35 | /Users/$USER$/Library/Logs/homeassistant.log 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /homeassistant/components/binary_sensor/tcp.py: -------------------------------------------------------------------------------- 1 | """ 2 | Provides a binary sensor which gets its values from a TCP socket. 3 | 4 | For more details about this platform, please refer to the documentation at 5 | https://home-assistant.io/components/binary_sensor.tcp/ 6 | """ 7 | import logging 8 | 9 | from homeassistant.components.binary_sensor import BinarySensorDevice 10 | from homeassistant.components.sensor.tcp import ( 11 | TcpSensor, CONF_VALUE_ON, PLATFORM_SCHEMA) 12 | 13 | _LOGGER = logging.getLogger(__name__) 14 | 15 | PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({}) 16 | 17 | 18 | def setup_platform(hass, config, add_devices, discovery_info=None): 19 | """Set up the TCP binary sensor.""" 20 | add_devices([TcpBinarySensor(hass, config)]) 21 | 22 | 23 | class TcpBinarySensor(BinarySensorDevice, TcpSensor): 24 | """A binary sensor which is on when its state == CONF_VALUE_ON.""" 25 | 26 | required = (CONF_VALUE_ON,) 27 | 28 | @property 29 | def is_on(self): 30 | """Return true if the binary sensor is on.""" 31 | return self._state == self._config[CONF_VALUE_ON] 32 | -------------------------------------------------------------------------------- /homeassistant/components/switch/zigbee.py: -------------------------------------------------------------------------------- 1 | """ 2 | Contains functionality to use a ZigBee device as a switch. 3 | 4 | For more details about this platform, please refer to the documentation at 5 | https://home-assistant.io/components/switch.zigbee/ 6 | """ 7 | import voluptuous as vol 8 | 9 | from homeassistant.components.switch import SwitchDevice 10 | from homeassistant.components.zigbee import ( 11 | ZigBeeDigitalOut, ZigBeeDigitalOutConfig, PLATFORM_SCHEMA) 12 | 13 | DEPENDENCIES = ['zigbee'] 14 | 15 | CONF_ON_STATE = 'on_state' 16 | 17 | DEFAULT_ON_STATE = 'high' 18 | DEPENDENCIES = ['zigbee'] 19 | 20 | STATES = ['high', 'low'] 21 | 22 | PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ 23 | vol.Optional(CONF_ON_STATE): vol.In(STATES), 24 | }) 25 | 26 | 27 | def setup_platform(hass, config, add_devices, discovery_info=None): 28 | """Set up the ZigBee switch platform.""" 29 | add_devices([ZigBeeSwitch(hass, ZigBeeDigitalOutConfig(config))]) 30 | 31 | 32 | class ZigBeeSwitch(ZigBeeDigitalOut, SwitchDevice): 33 | """Representation of a ZigBee Digital Out device.""" 34 | 35 | pass 36 | -------------------------------------------------------------------------------- /homeassistant/exceptions.py: -------------------------------------------------------------------------------- 1 | """The exceptions used by Home Assistant.""" 2 | import jinja2 3 | 4 | 5 | class HomeAssistantError(Exception): 6 | """General Home Assistant exception occurred.""" 7 | 8 | pass 9 | 10 | 11 | class InvalidEntityFormatError(HomeAssistantError): 12 | """When an invalid formatted entity is encountered.""" 13 | 14 | pass 15 | 16 | 17 | class NoEntitySpecifiedError(HomeAssistantError): 18 | """When no entity is specified.""" 19 | 20 | pass 21 | 22 | 23 | class TemplateError(HomeAssistantError): 24 | """Error during template rendering.""" 25 | 26 | def __init__(self, exception: jinja2.TemplateError) -> None: 27 | """Init the error.""" 28 | super().__init__('{}: {}'.format(exception.__class__.__name__, 29 | exception)) 30 | 31 | 32 | class PlatformNotReady(HomeAssistantError): 33 | """Error to indicate that platform is not ready.""" 34 | 35 | pass 36 | 37 | 38 | class InvalidStateError(HomeAssistantError): 39 | """When an invalid state is encountered.""" 40 | 41 | pass 42 | -------------------------------------------------------------------------------- /homeassistant/components/binary_sensor/tellduslive.py: -------------------------------------------------------------------------------- 1 | """ 2 | Support for binary sensors using Tellstick Net. 3 | 4 | This platform uses the Telldus Live online service. 5 | 6 | For more details about this platform, please refer to the documentation at 7 | https://home-assistant.io/components/binary_sensor.tellduslive/ 8 | 9 | """ 10 | import logging 11 | 12 | from homeassistant.components.tellduslive import TelldusLiveEntity 13 | from homeassistant.components.binary_sensor import BinarySensorDevice 14 | 15 | _LOGGER = logging.getLogger(__name__) 16 | 17 | 18 | def setup_platform(hass, config, add_devices, discovery_info=None): 19 | """Set up Tellstick sensors.""" 20 | if discovery_info is None: 21 | return 22 | add_devices( 23 | TelldusLiveSensor(hass, binary_sensor) 24 | for binary_sensor in discovery_info 25 | ) 26 | 27 | 28 | class TelldusLiveSensor(TelldusLiveEntity, BinarySensorDevice): 29 | """Representation of a Tellstick sensor.""" 30 | 31 | @property 32 | def is_on(self): 33 | """Return true if switch is on.""" 34 | return self.device.is_on 35 | -------------------------------------------------------------------------------- /tests/fixtures/feedreader1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | RSS Sample 5 | This is an example of an RSS feed 6 | http://www.example.com/main.html 7 | Mon, 30 Apr 2018 12:00:00 +1000 8 | Mon, 30 Apr 2018 15:00:00 +1000 9 | 1800 10 | 11 | 12 | Title 1 13 | Description 1 14 | http://www.example.com/link/1 15 | GUID 1 16 | Mon, 30 Apr 2018 15:10:00 +1000 17 | 18 | 19 | Title 2 20 | Description 2 21 | http://www.example.com/link/2 22 | GUID 2 23 | Mon, 30 Apr 2018 15:11:00 +1000 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /homeassistant/components/lock/volvooncall.py: -------------------------------------------------------------------------------- 1 | """ 2 | Support for Volvo On Call locks. 3 | 4 | For more details about this platform, please refer to the documentation at 5 | https://home-assistant.io/components/lock.volvooncall/ 6 | """ 7 | import logging 8 | 9 | from homeassistant.components.lock import LockDevice 10 | from homeassistant.components.volvooncall import VolvoEntity 11 | 12 | _LOGGER = logging.getLogger(__name__) 13 | 14 | 15 | def setup_platform(hass, config, add_devices, discovery_info=None): 16 | """Set up the Volvo On Call lock.""" 17 | if discovery_info is None: 18 | return 19 | 20 | add_devices([VolvoLock(hass, *discovery_info)]) 21 | 22 | 23 | class VolvoLock(VolvoEntity, LockDevice): 24 | """Represents a car lock.""" 25 | 26 | @property 27 | def is_locked(self): 28 | """Return true if lock is locked.""" 29 | return self.vehicle.is_locked 30 | 31 | def lock(self, **kwargs): 32 | """Lock the car.""" 33 | self.vehicle.lock() 34 | 35 | def unlock(self, **kwargs): 36 | """Unlock the car.""" 37 | self.vehicle.unlock() 38 | -------------------------------------------------------------------------------- /tests/components/binary_sensor/test_binary_sensor.py: -------------------------------------------------------------------------------- 1 | """The tests for the Binary sensor component.""" 2 | import unittest 3 | from unittest import mock 4 | 5 | from homeassistant.components import binary_sensor 6 | from homeassistant.const import STATE_ON, STATE_OFF 7 | 8 | 9 | class TestBinarySensor(unittest.TestCase): 10 | """Test the binary_sensor base class.""" 11 | 12 | def test_state(self): 13 | """Test binary sensor state.""" 14 | sensor = binary_sensor.BinarySensorDevice() 15 | self.assertEqual(STATE_OFF, sensor.state) 16 | with mock.patch('homeassistant.components.binary_sensor.' 17 | 'BinarySensorDevice.is_on', 18 | new=False): 19 | self.assertEqual(STATE_OFF, 20 | binary_sensor.BinarySensorDevice().state) 21 | with mock.patch('homeassistant.components.binary_sensor.' 22 | 'BinarySensorDevice.is_on', 23 | new=True): 24 | self.assertEqual(STATE_ON, 25 | binary_sensor.BinarySensorDevice().state) 26 | -------------------------------------------------------------------------------- /homeassistant/helpers/signal.py: -------------------------------------------------------------------------------- 1 | """Signal handling related helpers.""" 2 | import logging 3 | import signal 4 | import sys 5 | 6 | from homeassistant.core import callback 7 | from homeassistant.const import RESTART_EXIT_CODE 8 | from homeassistant.loader import bind_hass 9 | 10 | _LOGGER = logging.getLogger(__name__) 11 | 12 | 13 | @callback 14 | @bind_hass 15 | def async_register_signal_handling(hass): 16 | """Register system signal handler for core.""" 17 | if sys.platform != 'win32': 18 | @callback 19 | def async_signal_handle(exit_code): 20 | """Wrap signal handling.""" 21 | hass.async_add_job(hass.async_stop(exit_code)) 22 | 23 | try: 24 | hass.loop.add_signal_handler( 25 | signal.SIGTERM, async_signal_handle, 0) 26 | except ValueError: 27 | _LOGGER.warning("Could not bind to SIGTERM") 28 | 29 | try: 30 | hass.loop.add_signal_handler( 31 | signal.SIGHUP, async_signal_handle, RESTART_EXIT_CODE) 32 | except ValueError: 33 | _LOGGER.warning("Could not bind to SIGHUP") 34 | -------------------------------------------------------------------------------- /homeassistant/components/binary_sensor/zigbee.py: -------------------------------------------------------------------------------- 1 | """ 2 | Contains functionality to use a ZigBee device as a binary sensor. 3 | 4 | For more details about this platform, please refer to the documentation at 5 | https://home-assistant.io/components/binary_sensor.zigbee/ 6 | """ 7 | import voluptuous as vol 8 | 9 | from homeassistant.components.binary_sensor import BinarySensorDevice 10 | from homeassistant.components.zigbee import ( 11 | ZigBeeDigitalIn, ZigBeeDigitalInConfig, PLATFORM_SCHEMA) 12 | 13 | CONF_ON_STATE = 'on_state' 14 | 15 | DEFAULT_ON_STATE = 'high' 16 | DEPENDENCIES = ['zigbee'] 17 | 18 | STATES = ['high', 'low'] 19 | 20 | PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ 21 | vol.Optional(CONF_ON_STATE): vol.In(STATES), 22 | }) 23 | 24 | 25 | def setup_platform(hass, config, add_devices, discovery_info=None): 26 | """Set up the ZigBee binary sensor platform.""" 27 | add_devices( 28 | [ZigBeeBinarySensor(hass, ZigBeeDigitalInConfig(config))], True) 29 | 30 | 31 | class ZigBeeBinarySensor(ZigBeeDigitalIn, BinarySensorDevice): 32 | """Use ZigBeeDigitalIn as binary sensor.""" 33 | 34 | pass 35 | -------------------------------------------------------------------------------- /tests/fixtures/pushbullet_devices.json: -------------------------------------------------------------------------------- 1 | { 2 | "accounts": [], 3 | "blocks": [], 4 | "channels": [], 5 | "chats": [], 6 | "clients": [], 7 | "contacts": [], 8 | "devices": [{ 9 | "active": true, 10 | "iden": "identity1", 11 | "created": 1.514520333770855e+09, 12 | "modified": 1.5151951594363022e+09, 13 | "type": "windows", 14 | "kind": "windows", 15 | "nickname": "DESKTOP", 16 | "manufacturer": "Microsoft", 17 | "model": "Windows 10 Home", 18 | "app_version": 396, 19 | "fingerprint": "{\"cpu\":\"AMD\",\"computer_name\":\"DESKTOP\"}", 20 | "pushable": true, 21 | "icon": "desktop", 22 | "remote_files": "disabled" 23 | }, { 24 | "active": true, 25 | "iden": "identity2", 26 | "created": 1.5144974875448499e+09, 27 | "modified": 1.514574792288634e+09, 28 | "type": "ios", 29 | "kind": "ios", 30 | "nickname": "My iPhone", 31 | "manufacturer": "Apple", 32 | "model": "iPhone", 33 | "app_version": 8646, 34 | "push_token": "production:mytoken", 35 | "pushable": true, 36 | "icon": "phone" 37 | }], 38 | "grants": [], 39 | "pushes": [], 40 | "profiles": [], 41 | "subscriptions": [], 42 | "texts": [] 43 | } 44 | -------------------------------------------------------------------------------- /homeassistant/components/deconz/.translations/vi.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "abort": { 4 | "already_configured": "C\u1ea7u \u0111\u00e3 \u0111\u01b0\u1ee3c c\u1ea5u h\u00ecnh", 5 | "no_bridges": "Kh\u00f4ng t\u00ecm th\u1ea5y c\u1ea7u deCONZ n\u00e0o", 6 | "one_instance_only": "Th\u00e0nh ph\u1ea7n ch\u1ec9 h\u1ed7 tr\u1ee3 m\u1ed9t c\u00e1 th\u1ec3 deCONZ" 7 | }, 8 | "error": { 9 | "no_key": "Kh\u00f4ng th\u1ec3 l\u1ea5y kh\u00f3a API" 10 | }, 11 | "step": { 12 | "init": { 13 | "data": { 14 | "port": "C\u1ed5ng (gi\u00e1 tr\u1ecb m\u1eb7c \u0111\u1ecbnh: '80')" 15 | } 16 | }, 17 | "options": { 18 | "data": { 19 | "allow_clip_sensor": "Cho ph\u00e9p nh\u1eadp c\u1ea3m bi\u1ebfn \u1ea3o", 20 | "allow_deconz_groups": "Cho ph\u00e9p nh\u1eadp c\u00e1c nh\u00f3m deCONZ" 21 | }, 22 | "title": "T\u00f9y ch\u1ecdn c\u1ea5u h\u00ecnh b\u1ed5 sung cho deCONZ" 23 | } 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to Home Assistant 2 | 3 | Everybody is invited and welcome to contribute to Home Assistant. There is a lot to do...if you are not a developer perhaps you would like to help with the documentation on [home-assistant.io](https://home-assistant.io/)? If you are a developer and have devices in your home which aren't working with Home Assistant yet, why not spent a couple of hours and help to integrate them? 4 | 5 | The process is straight-forward. 6 | 7 | - Read [How to get faster PR reviews](https://github.com/kubernetes/community/blob/master/contributors/guide/pull-requests.md#best-practices-for-faster-reviews) by Kubernetes (but skip step 0) 8 | - Fork the Home Assistant [git repository](https://github.com/home-assistant/home-assistant). 9 | - Write the code for your device, notification service, sensor, or IoT thing. 10 | - Ensure tests work. 11 | - Create a Pull Request against the [**dev**](https://github.com/home-assistant/home-assistant/tree/dev) branch of Home Assistant. 12 | 13 | Still interested? Then you should take a peek at the [developer documentation](https://home-assistant.io/developers/) to get more details. 14 | 15 | -------------------------------------------------------------------------------- /tests/fixtures/bom_weather.json: -------------------------------------------------------------------------------- 1 | { 2 | "observations": { 3 | "data": [ 4 | { 5 | "wmo": 94767, 6 | "name": "Fake", 7 | "history_product": "IDN00000", 8 | "local_date_time_full": "20180422130000", 9 | "apparent_t": 25.0, 10 | "press": 1021.7, 11 | "weather": "-" 12 | }, 13 | { 14 | "wmo": 94767, 15 | "name": "Fake", 16 | "history_product": "IDN00000", 17 | "local_date_time_full": "20180422130000", 18 | "apparent_t": 22.0, 19 | "press": 1019.7, 20 | "weather": "-" 21 | }, 22 | { 23 | "wmo": 94767, 24 | "name": "Fake", 25 | "history_product": "IDN00000", 26 | "local_date_time_full": "20180422130000", 27 | "apparent_t": 20.0, 28 | "press": 1011.7, 29 | "weather": "Fine" 30 | }, 31 | { 32 | "wmo": 94767, 33 | "name": "Fake", 34 | "history_product": "IDN00000", 35 | "local_date_time_full": "20180422130000", 36 | "apparent_t": 18.0, 37 | "press": 1010.0, 38 | "weather": "-" 39 | } 40 | ] 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /homeassistant/scripts/ensure_config.py: -------------------------------------------------------------------------------- 1 | """Script to ensure a configuration file exists.""" 2 | import argparse 3 | import os 4 | 5 | import homeassistant.config as config_util 6 | 7 | 8 | def run(args): 9 | """Handle ensure config commandline script.""" 10 | parser = argparse.ArgumentParser( 11 | description=("Ensure a Home Assistant config exists, " 12 | "creates one if necessary.")) 13 | parser.add_argument( 14 | '-c', '--config', 15 | metavar='path_to_config_dir', 16 | default=config_util.get_default_config_dir(), 17 | help="Directory that contains the Home Assistant configuration") 18 | parser.add_argument( 19 | '--script', 20 | choices=['ensure_config']) 21 | 22 | args = parser.parse_args() 23 | 24 | config_dir = os.path.join(os.getcwd(), args.config) 25 | 26 | # Test if configuration directory exists 27 | if not os.path.isdir(config_dir): 28 | print('Creating directory', config_dir) 29 | os.makedirs(config_dir) 30 | 31 | config_path = config_util.ensure_config_exists(config_dir) 32 | print('Configuration file:', config_path) 33 | return 0 34 | -------------------------------------------------------------------------------- /tests/fixtures/coinmarketcap.json: -------------------------------------------------------------------------------- 1 | { 2 | "cached": false, 3 | "data": { 4 | "id": 1027, 5 | "name": "Ethereum", 6 | "symbol": "ETH", 7 | "website_slug": "ethereum", 8 | "rank": 2, 9 | "circulating_supply": 99619842.0, 10 | "total_supply": 99619842.0, 11 | "max_supply": null, 12 | "quotes": { 13 | "USD": { 14 | "price": 577.019, 15 | "volume_24h": 2839960000.0, 16 | "market_cap": 57482541899.0, 17 | "percent_change_1h": -2.28, 18 | "percent_change_24h": -14.88, 19 | "percent_change_7d": -17.51 20 | }, 21 | "EUR": { 22 | "price": 493.454724572, 23 | "volume_24h": 2428699712.48, 24 | "market_cap": 49158380042.0, 25 | "percent_change_1h": -2.28, 26 | "percent_change_24h": -14.88, 27 | "percent_change_7d": -17.51 28 | } 29 | }, 30 | "last_updated": 1527098658 31 | }, 32 | "metadata": { 33 | "timestamp": 1527098716, 34 | "error": null 35 | } 36 | } -------------------------------------------------------------------------------- /homeassistant/helpers/location.py: -------------------------------------------------------------------------------- 1 | """Location helpers for Home Assistant.""" 2 | 3 | from typing import Sequence 4 | 5 | from homeassistant.const import ATTR_LATITUDE, ATTR_LONGITUDE 6 | from homeassistant.core import State 7 | from homeassistant.util import location as loc_util 8 | 9 | 10 | def has_location(state: State) -> bool: 11 | """Test if state contains a valid location. 12 | 13 | Async friendly. 14 | """ 15 | return (isinstance(state, State) and 16 | isinstance(state.attributes.get(ATTR_LATITUDE), float) and 17 | isinstance(state.attributes.get(ATTR_LONGITUDE), float)) 18 | 19 | 20 | def closest(latitude: float, longitude: float, 21 | states: Sequence[State]) -> State: 22 | """Return closest state to point. 23 | 24 | Async friendly. 25 | """ 26 | with_location = [state for state in states if has_location(state)] 27 | 28 | if not with_location: 29 | return None 30 | 31 | return min( 32 | with_location, 33 | key=lambda state: loc_util.distance( 34 | latitude, longitude, state.attributes.get(ATTR_LATITUDE), 35 | state.attributes.get(ATTR_LONGITUDE)) 36 | ) 37 | -------------------------------------------------------------------------------- /tests/components/google_assistant/test_init.py: -------------------------------------------------------------------------------- 1 | """The tests for google-assistant init.""" 2 | import asyncio 3 | 4 | from homeassistant.setup import async_setup_component 5 | from homeassistant.components import google_assistant as ga 6 | 7 | GA_API_KEY = "Agdgjsj399sdfkosd932ksd" 8 | GA_AGENT_USER_ID = "testid" 9 | 10 | 11 | @asyncio.coroutine 12 | def test_request_sync_service(aioclient_mock, hass): 13 | """Test that it posts to the request_sync url.""" 14 | aioclient_mock.post( 15 | ga.const.REQUEST_SYNC_BASE_URL, status=200) 16 | 17 | yield from async_setup_component(hass, 'google_assistant', { 18 | 'google_assistant': { 19 | 'project_id': 'test_project', 20 | 'client_id': 'r7328kwdsdfsdf03223409', 21 | 'access_token': '8wdsfjsf932492342349234', 22 | 'agent_user_id': GA_AGENT_USER_ID, 23 | 'api_key': GA_API_KEY 24 | }}) 25 | 26 | assert aioclient_mock.call_count == 0 27 | yield from hass.services.async_call(ga.const.DOMAIN, 28 | ga.const.SERVICE_REQUEST_SYNC, 29 | blocking=True) 30 | 31 | assert aioclient_mock.call_count == 1 32 | -------------------------------------------------------------------------------- /homeassistant/components/deconz/.translations/hu.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "abort": { 4 | "already_configured": "A bridge m\u00e1r konfigur\u00e1lva van", 5 | "no_bridges": "Nem tal\u00e1ltam deCONZ bridget", 6 | "one_instance_only": "Ez a komponens csak egy deCONZ egys\u00e9get t\u00e1mogat" 7 | }, 8 | "error": { 9 | "no_key": "API kulcs lek\u00e9r\u00e9se nem siker\u00fclt" 10 | }, 11 | "step": { 12 | "init": { 13 | "data": { 14 | "host": "H\u00e1zigazda (Host)", 15 | "port": "Port (alap\u00e9rtelmezett \u00e9rt\u00e9k: '80')" 16 | }, 17 | "title": "deCONZ \u00e1tj\u00e1r\u00f3 megad\u00e1sa" 18 | }, 19 | "link": { 20 | "description": "Oldja fel a deCONZ \u00e1tj\u00e1r\u00f3t a Home Assistant-ban val\u00f3 regisztr\u00e1l\u00e1shoz.\n\n1. Menjen a deCONZ rendszer be\u00e1ll\u00edt\u00e1sokhoz\n2. Nyomja meg az \"\u00c1tj\u00e1r\u00f3 felold\u00e1sa\" gombot", 21 | "title": "Kapcsol\u00f3d\u00e1s a deCONZ-hoz" 22 | } 23 | }, 24 | "title": "deCONZ" 25 | } 26 | } -------------------------------------------------------------------------------- /homeassistant/components/hue/.translations/en.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "abort": { 4 | "all_configured": "All Philips Hue bridges are already configured", 5 | "already_configured": "Bridge is already configured", 6 | "cannot_connect": "Unable to connect to the bridge", 7 | "discover_timeout": "Unable to discover Hue bridges", 8 | "no_bridges": "No Philips Hue bridges discovered", 9 | "unknown": "Unknown error occurred" 10 | }, 11 | "error": { 12 | "linking": "Unknown linking error occurred.", 13 | "register_failed": "Failed to register, please try again" 14 | }, 15 | "step": { 16 | "init": { 17 | "data": { 18 | "host": "Host" 19 | }, 20 | "title": "Pick Hue bridge" 21 | }, 22 | "link": { 23 | "description": "Press the button on the bridge to register Philips Hue with Home Assistant.\n\n![Location of button on bridge](/static/images/config_philips_hue.jpg)", 24 | "title": "Link Hub" 25 | } 26 | }, 27 | "title": "Philips Hue" 28 | } 29 | } -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | addons: 3 | apt: 4 | packages: 5 | - libudev-dev 6 | matrix: 7 | fast_finish: true 8 | include: 9 | - python: "3.5.3" 10 | env: TOXENV=lint 11 | - python: "3.5.3" 12 | env: TOXENV=pylint 13 | - python: "3.5.3" 14 | env: TOXENV=typing 15 | - python: "3.5.3" 16 | env: TOXENV=py35 17 | - python: "3.6" 18 | env: TOXENV=py36 19 | - python: "3.7" 20 | env: TOXENV=py37 21 | dist: xenial 22 | - python: "3.8-dev" 23 | env: TOXENV=py38 24 | dist: xenial 25 | if: branch = dev AND type = push 26 | allow_failures: 27 | - python: "3.8-dev" 28 | env: TOXENV=py38 29 | dist: xenial 30 | 31 | cache: 32 | directories: 33 | - $HOME/.cache/pip 34 | install: pip install -U tox coveralls 35 | language: python 36 | script: travis_wait 30 tox --develop 37 | services: 38 | - docker 39 | before_deploy: 40 | - docker pull lokalise/lokalise-cli@sha256:2198814ebddfda56ee041a4b427521757dd57f75415ea9693696a64c550cef21 41 | deploy: 42 | skip_cleanup: true 43 | provider: script 44 | script: script/travis_deploy 45 | on: 46 | branch: dev 47 | condition: $TOXENV = lint 48 | after_success: coveralls 49 | -------------------------------------------------------------------------------- /homeassistant/components/scene/velux.py: -------------------------------------------------------------------------------- 1 | """ 2 | Support for VELUX scenes. 3 | 4 | For more details about this platform, please refer to the documentation at 5 | https://home-assistant.io/components/scene.velux/ 6 | """ 7 | 8 | from homeassistant.components.scene import Scene 9 | from homeassistant.components.velux import _LOGGER, DATA_VELUX 10 | 11 | 12 | DEPENDENCIES = ['velux'] 13 | 14 | 15 | async def async_setup_platform(hass, config, async_add_devices, 16 | discovery_info=None): 17 | """Set up the scenes for velux platform.""" 18 | entities = [] 19 | for scene in hass.data[DATA_VELUX].pyvlx.scenes: 20 | entities.append(VeluxScene(scene)) 21 | async_add_devices(entities) 22 | 23 | 24 | class VeluxScene(Scene): 25 | """Representation of a velux scene.""" 26 | 27 | def __init__(self, scene): 28 | """Init velux scene.""" 29 | _LOGGER.info("Adding VELUX scene: %s", scene) 30 | self.scene = scene 31 | 32 | @property 33 | def name(self): 34 | """Return the name of the scene.""" 35 | return self.scene.name 36 | 37 | async def async_activate(self): 38 | """Activate the scene.""" 39 | await self.scene.run() 40 | -------------------------------------------------------------------------------- /tests/components/sensor/test_random.py: -------------------------------------------------------------------------------- 1 | """The test for the random number sensor platform.""" 2 | import unittest 3 | 4 | from homeassistant.setup import setup_component 5 | 6 | from tests.common import get_test_home_assistant 7 | 8 | 9 | class TestRandomSensor(unittest.TestCase): 10 | """Test the Random number sensor.""" 11 | 12 | def setup_method(self, method): 13 | """Set up things to be run when tests are started.""" 14 | self.hass = get_test_home_assistant() 15 | 16 | def teardown_method(self, method): 17 | """Stop everything that was started.""" 18 | self.hass.stop() 19 | 20 | def test_random_sensor(self): 21 | """Test the Random number sensor.""" 22 | config = { 23 | 'sensor': { 24 | 'platform': 'random', 25 | 'name': 'test', 26 | 'minimum': 10, 27 | 'maximum': 20, 28 | } 29 | } 30 | 31 | assert setup_component(self.hass, 'sensor', config) 32 | 33 | state = self.hass.states.get('sensor.test') 34 | 35 | self.assertLessEqual(int(state.state), config['sensor']['maximum']) 36 | self.assertGreaterEqual(int(state.state), config['sensor']['minimum']) 37 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # Notice: 2 | # When updating this file, please also update virtualization/Docker/Dockerfile.dev 3 | # This way, the development image and the production image are kept in sync. 4 | 5 | FROM python:3.6 6 | LABEL maintainer="Paulus Schoutsen " 7 | 8 | # Uncomment any of the following lines to disable the installation. 9 | #ENV INSTALL_TELLSTICK no 10 | #ENV INSTALL_OPENALPR no 11 | #ENV INSTALL_FFMPEG no 12 | #ENV INSTALL_LIBCEC no 13 | #ENV INSTALL_PHANTOMJS no 14 | #ENV INSTALL_SSOCR no 15 | #ENV INSTALL_IPERF3 no 16 | 17 | VOLUME /config 18 | 19 | RUN mkdir -p /usr/src/app 20 | WORKDIR /usr/src/app 21 | 22 | # Copy build scripts 23 | COPY virtualization/Docker/ virtualization/Docker/ 24 | RUN virtualization/Docker/setup_docker_prereqs 25 | 26 | # Install hass component dependencies 27 | COPY requirements_all.txt requirements_all.txt 28 | # Uninstall enum34 because some dependencies install it but breaks Python 3.4+. 29 | # See PR #8103 for more info. 30 | RUN pip3 install --no-cache-dir -r requirements_all.txt && \ 31 | pip3 install --no-cache-dir mysqlclient psycopg2 uvloop cchardet cython 32 | 33 | # Copy source 34 | COPY . . 35 | 36 | CMD [ "python", "-m", "homeassistant", "--config", "/config" ] 37 | -------------------------------------------------------------------------------- /tests/components/fan/__init__.py: -------------------------------------------------------------------------------- 1 | """Tests for fan platforms.""" 2 | 3 | import unittest 4 | 5 | from homeassistant.components.fan import FanEntity 6 | 7 | 8 | class BaseFan(FanEntity): 9 | """Implementation of the abstract FanEntity.""" 10 | 11 | def __init__(self): 12 | """Initialize the fan.""" 13 | pass 14 | 15 | 16 | class TestFanEntity(unittest.TestCase): 17 | """Test coverage for base fan entity class.""" 18 | 19 | def setUp(self): 20 | """Set up test data.""" 21 | self.fan = BaseFan() 22 | 23 | def tearDown(self): 24 | """Tear down unit test data.""" 25 | self.fan = None 26 | 27 | def test_fanentity(self): 28 | """Test fan entity methods.""" 29 | self.assertIsNone(self.fan.state) 30 | self.assertEqual(0, len(self.fan.speed_list)) 31 | self.assertEqual(0, self.fan.supported_features) 32 | self.assertEqual({}, self.fan.state_attributes) 33 | # Test set_speed not required 34 | self.fan.set_speed() 35 | self.fan.oscillate() 36 | with self.assertRaises(NotImplementedError): 37 | self.fan.turn_on() 38 | with self.assertRaises(NotImplementedError): 39 | self.fan.turn_off() 40 | -------------------------------------------------------------------------------- /homeassistant/components/homematicip_cloud/strings.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "title": "HomematicIP Cloud", 4 | "step": { 5 | "init": { 6 | "title": "Pick HomematicIP Accesspoint", 7 | "data": { 8 | "hapid": "Accesspoint ID (SGTIN)", 9 | "pin": "Pin Code (optional)", 10 | "name": "Name (optional, used as name prefix for all devices)" 11 | } 12 | }, 13 | "link": { 14 | "title": "Link Accesspoint", 15 | "description": "Press the blue button on the accesspoint and the submit button to register HomematicIP with Home Assistant.\n\n![Location of button on bridge](/static/images/config_flows/config_homematicip_cloud.png)" 16 | } 17 | }, 18 | "error": { 19 | "register_failed": "Failed to register, please try again.", 20 | "invalid_pin": "Invalid PIN, please try again.", 21 | "press_the_button": "Please press the blue button.", 22 | "timeout_button": "Blue button press timeout, please try again." 23 | }, 24 | "abort": { 25 | "unknown": "Unknown error occurred.", 26 | "conection_aborted": "Could not connect to HMIP server", 27 | "already_configured": "Accesspoint is already configured" 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /tests/testing_config/custom_components/device_tracker/test.py: -------------------------------------------------------------------------------- 1 | """Provide a mock device scanner.""" 2 | 3 | from homeassistant.components.device_tracker import DeviceScanner 4 | 5 | 6 | def get_scanner(hass, config): 7 | """Return a mock scanner.""" 8 | return SCANNER 9 | 10 | 11 | class MockScanner(DeviceScanner): 12 | """Mock device scanner.""" 13 | 14 | def __init__(self): 15 | """Initialize the MockScanner.""" 16 | self.devices_home = [] 17 | 18 | def come_home(self, device): 19 | """Make a device come home.""" 20 | self.devices_home.append(device) 21 | 22 | def leave_home(self, device): 23 | """Make a device leave the house.""" 24 | self.devices_home.remove(device) 25 | 26 | def reset(self): 27 | """Reset which devices are home.""" 28 | self.devices_home = [] 29 | 30 | def scan_devices(self): 31 | """Return a list of fake devices.""" 32 | return list(self.devices_home) 33 | 34 | def get_device_name(self, device): 35 | """Return a name for a mock device. 36 | 37 | Return None for dev1 for testing. 38 | """ 39 | return None if device == 'DEV1' else device.lower() 40 | 41 | 42 | SCANNER = MockScanner() 43 | -------------------------------------------------------------------------------- /homeassistant/components/hue/.translations/no.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "abort": { 4 | "all_configured": "Alle Philips Hue Bridger er allerede konfigurert", 5 | "already_configured": "Bridge er allerede konfigurert", 6 | "cannot_connect": "Kan ikke koble til Bridge", 7 | "discover_timeout": "Kunne ikke oppdage Hue Bridger", 8 | "no_bridges": "Ingen Philips Hue Bridger oppdaget", 9 | "unknown": "Ukjent feil oppstod" 10 | }, 11 | "error": { 12 | "linking": "Ukjent koblingsfeil oppstod.", 13 | "register_failed": "Registrering feilet, vennligst pr\u00f8v igjen" 14 | }, 15 | "step": { 16 | "init": { 17 | "data": { 18 | "host": "Vert" 19 | }, 20 | "title": "Velg Hue Bridge" 21 | }, 22 | "link": { 23 | "description": "Trykk p\u00e5 knappen p\u00e5 Bridgen for \u00e5 registrere Philips Hue med Home Assistant. \n\n ![Knappens plassering p\u00e5 Bridgen](/static/images/config_philips_hue.jpg)", 24 | "title": "Link Hub" 25 | } 26 | }, 27 | "title": "Philips Hue Bridge" 28 | } 29 | } -------------------------------------------------------------------------------- /homeassistant/components/sensor/insteon_plm.py: -------------------------------------------------------------------------------- 1 | """ 2 | Support for INSTEON dimmers via PowerLinc Modem. 3 | 4 | For more details about this component, please refer to the documentation at 5 | https://home-assistant.io/components/sensor.insteon_plm/ 6 | """ 7 | import asyncio 8 | import logging 9 | 10 | from homeassistant.components.insteon_plm import InsteonPLMEntity 11 | from homeassistant.helpers.entity import Entity 12 | 13 | DEPENDENCIES = ['insteon_plm'] 14 | 15 | _LOGGER = logging.getLogger(__name__) 16 | 17 | 18 | @asyncio.coroutine 19 | def async_setup_platform(hass, config, async_add_devices, discovery_info=None): 20 | """Set up the INSTEON PLM device class for the hass platform.""" 21 | plm = hass.data['insteon_plm'].get('plm') 22 | 23 | address = discovery_info['address'] 24 | device = plm.devices[address] 25 | state_key = discovery_info['state_key'] 26 | 27 | _LOGGER.debug('Adding device %s entity %s to Sensor platform', 28 | device.address.hex, device.states[state_key].name) 29 | 30 | new_entity = InsteonPLMSensorDevice(device, state_key) 31 | 32 | async_add_devices([new_entity]) 33 | 34 | 35 | class InsteonPLMSensorDevice(InsteonPLMEntity, Entity): 36 | """A Class for an Insteon device.""" 37 | -------------------------------------------------------------------------------- /homeassistant/components/homematicip_cloud/.translations/en.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "title": "HomematicIP Cloud", 4 | "step": { 5 | "init": { 6 | "title": "Pick HomematicIP Accesspoint", 7 | "data": { 8 | "hapid": "Accesspoint ID (SGTIN)", 9 | "pin": "Pin Code (optional)", 10 | "name": "Name (optional, used as name prefix for all devices)" 11 | } 12 | }, 13 | "link": { 14 | "title": "Link Accesspoint", 15 | "description": "Press the blue button on the accesspoint and the submit button to register HomematicIP with Home Assistant.\n\n![Location of button on bridge](/static/images/config_flows/config_homematicip_cloud.png)" 16 | } 17 | }, 18 | "error": { 19 | "register_failed": "Failed to register, please try again.", 20 | "invalid_pin": "Invalid PIN, please try again.", 21 | "press_the_button": "Please press the blue button.", 22 | "timeout_button": "Blue button press timeout, please try again." 23 | }, 24 | "abort": { 25 | "unknown": "Unknown error occurred.", 26 | "conection_aborted": "Could not connect to HMIP server", 27 | "already_configured": "Accesspoint is already configured" 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /homeassistant/components/hue/.translations/cy.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "abort": { 4 | "all_configured": "Mae holl bontydd Philips Hue eisoes wedi eu ffurfweddu", 5 | "already_configured": "Pont eisoes wedi'i ffurfweddu", 6 | "cannot_connect": "Methu cysylltu i'r bont", 7 | "discover_timeout": "Methu darganfod pontydd Hue", 8 | "no_bridges": "Dim pontydd Philips Hue wedi'i ddarganfod", 9 | "unknown": "Digwyddodd gwall anhysbys" 10 | }, 11 | "error": { 12 | "linking": "Digwyddodd gwall cysylltu anhysbys.", 13 | "register_failed": "Wedi methu \u00e2 chofrestru, pl\u00eds ceisiwch eto" 14 | }, 15 | "step": { 16 | "init": { 17 | "data": { 18 | "host": "Gwesteiwr" 19 | }, 20 | "title": "Dewiswch bont Hue" 21 | }, 22 | "link": { 23 | "description": "Pwyswch y botwm ar y bont i gofrestru Philips Hue gyda Cynorthwydd Cartref.\n\n![Lleoliad botwm ar bont](/static/images/config_philips_hue.jpg)", 24 | "title": "Hwb cyswllt" 25 | } 26 | }, 27 | "title": "Pont Phillips Hue" 28 | } 29 | } -------------------------------------------------------------------------------- /homeassistant/components/velbus.py: -------------------------------------------------------------------------------- 1 | """ 2 | Support for Velbus platform. 3 | 4 | For more details about this platform, please refer to the documentation at 5 | https://home-assistant.io/components/velbus/ 6 | """ 7 | import logging 8 | import voluptuous as vol 9 | 10 | import homeassistant.helpers.config_validation as cv 11 | from homeassistant.const import EVENT_HOMEASSISTANT_STOP, CONF_PORT 12 | 13 | REQUIREMENTS = ['python-velbus==2.0.11'] 14 | 15 | _LOGGER = logging.getLogger(__name__) 16 | 17 | DOMAIN = 'velbus' 18 | 19 | 20 | VELBUS_MESSAGE = 'velbus.message' 21 | 22 | CONFIG_SCHEMA = vol.Schema({ 23 | DOMAIN: vol.Schema({ 24 | vol.Required(CONF_PORT): cv.string, 25 | }) 26 | }, extra=vol.ALLOW_EXTRA) 27 | 28 | 29 | def setup(hass, config): 30 | """Set up the Velbus platform.""" 31 | import velbus 32 | port = config[DOMAIN].get(CONF_PORT) 33 | connection = velbus.VelbusUSBConnection(port) 34 | controller = velbus.Controller(connection) 35 | hass.data[DOMAIN] = controller 36 | 37 | def stop_velbus(event): 38 | """Disconnect from serial port.""" 39 | _LOGGER.debug("Shutting down ") 40 | connection.stop() 41 | 42 | hass.bus.listen_once(EVENT_HOMEASSISTANT_STOP, stop_velbus) 43 | return True 44 | -------------------------------------------------------------------------------- /homeassistant/components/hue/.translations/nl.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "abort": { 4 | "all_configured": "Alle Philips Hue bridges zijn al geconfigureerd", 5 | "already_configured": "Bridge is al geconfigureerd", 6 | "cannot_connect": "Kan geen verbinding maken met bridge", 7 | "discover_timeout": "Hue bridges kunnen niet worden gevonden", 8 | "no_bridges": "Geen Philips Hue bridges ontdekt", 9 | "unknown": "Onbekende fout opgetreden" 10 | }, 11 | "error": { 12 | "linking": "Er is een onbekende verbindingsfout opgetreden.", 13 | "register_failed": "Registratie is mislukt, probeer het opnieuw" 14 | }, 15 | "step": { 16 | "init": { 17 | "data": { 18 | "host": "Host" 19 | }, 20 | "title": "Kies Hue bridge" 21 | }, 22 | "link": { 23 | "description": "Druk op de knop van de bridge om Philips Hue te registreren met Home Assistant. ![Locatie van de knop op bridge] (/static/images/config_philips_hue.jpg)", 24 | "title": "Link Hub" 25 | } 26 | }, 27 | "title": "Philips Hue Bridge" 28 | } 29 | } -------------------------------------------------------------------------------- /homeassistant/components/hue/.translations/pt.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "abort": { 4 | "all_configured": "Todas os Philips Hue j\u00e1 est\u00e3o configuradas", 5 | "already_configured": "Hue j\u00e1 est\u00e1 configurado", 6 | "cannot_connect": "N\u00e3o foi poss\u00edvel se conectar", 7 | "discover_timeout": "Nenhum Hue bridge descoberto", 8 | "no_bridges": "Nenhum Philips Hue descoberto", 9 | "unknown": "Ocorreu um erro desconhecido" 10 | }, 11 | "error": { 12 | "linking": "Ocorreu um erro de liga\u00e7\u00e3o desconhecido.", 13 | "register_failed": "Falha ao registrar, por favor, tente novamente" 14 | }, 15 | "step": { 16 | "init": { 17 | "data": { 18 | "host": "Servidor" 19 | }, 20 | "title": "Hue bridge" 21 | }, 22 | "link": { 23 | "description": "Pressione o bot\u00e3o no Philips Hue para registrar com o Home Assistant. \n\n ! [Localiza\u00e7\u00e3o do bot\u00e3o] (/ static / images / config_philips_hue.jpg)", 24 | "title": "Link Hub" 25 | } 26 | }, 27 | "title": "" 28 | } 29 | } -------------------------------------------------------------------------------- /homeassistant/components/light/qwikswitch.py: -------------------------------------------------------------------------------- 1 | """ 2 | Support for Qwikswitch Relays and Dimmers. 3 | 4 | For more details about this platform, please refer to the documentation at 5 | https://home-assistant.io/components/light.qwikswitch/ 6 | """ 7 | from homeassistant.components.qwikswitch import ( 8 | QSToggleEntity, DOMAIN as QWIKSWITCH) 9 | from homeassistant.components.light import SUPPORT_BRIGHTNESS, Light 10 | 11 | DEPENDENCIES = [QWIKSWITCH] 12 | 13 | 14 | async def async_setup_platform(hass, _, add_devices, discovery_info=None): 15 | """Add lights from the main Qwikswitch component.""" 16 | if discovery_info is None: 17 | return 18 | 19 | qsusb = hass.data[QWIKSWITCH] 20 | devs = [QSLight(qsid, qsusb) for qsid in discovery_info[QWIKSWITCH]] 21 | add_devices(devs) 22 | 23 | 24 | class QSLight(QSToggleEntity, Light): 25 | """Light based on a Qwikswitch relay/dimmer module.""" 26 | 27 | @property 28 | def brightness(self): 29 | """Return the brightness of this light (0-255).""" 30 | return self.device.value if self.device.is_dimmer else None 31 | 32 | @property 33 | def supported_features(self): 34 | """Flag supported features.""" 35 | return SUPPORT_BRIGHTNESS if self.device.is_dimmer else 0 36 | -------------------------------------------------------------------------------- /tests/components/sensor/test_worldclock.py: -------------------------------------------------------------------------------- 1 | """The test for the World clock sensor platform.""" 2 | import unittest 3 | 4 | from homeassistant.setup import setup_component 5 | from tests.common import get_test_home_assistant 6 | import homeassistant.util.dt as dt_util 7 | 8 | 9 | class TestWorldClockSensor(unittest.TestCase): 10 | """Test the World clock sensor.""" 11 | 12 | def setUp(self): 13 | """Set up things to be run when tests are started.""" 14 | self.hass = get_test_home_assistant() 15 | self.time_zone = dt_util.get_time_zone('America/New_York') 16 | 17 | config = { 18 | 'sensor': { 19 | 'platform': 'worldclock', 20 | 'time_zone': 'America/New_York', 21 | } 22 | } 23 | 24 | self.assertTrue(setup_component(self.hass, 'sensor', config)) 25 | 26 | def tearDown(self): 27 | """Stop everything that was started.""" 28 | self.hass.stop() 29 | 30 | def test_time(self): 31 | """Test the time at a different location.""" 32 | state = self.hass.states.get('sensor.worldclock_sensor') 33 | assert state is not None 34 | 35 | assert state.state == dt_util.now( 36 | time_zone=self.time_zone).strftime('%H:%M') 37 | --------------------------------------------------------------------------------