Commit Graph

250 Commits (77d55a3b155ee82c0f70bca229fe24b04bd9cf9f)

Author SHA1 Message Date
Paulus Schoutsen 7bb5344942
Remove homeassistant.remote (#16099)
* Remove homeassistant.remote

* Use direct import for API

* Fix docstring
2018-08-21 15:49:58 +02:00
Paulus Schoutsen 121abb450a Use aiohttp web.AppRunner (#16020)
* Use aiohttp web.AppRunner

* Stop site
2018-08-20 14:03:35 +02:00
Ville Skyttä dbd0763f83 Grammar and spelling fixes (#16065) 2018-08-19 22:29:08 +02:00
Paulus Schoutsen e776f88eec
Use JWT for access tokens (#15972)
* Use JWT for access tokens

* Update requirements

* Improvements
2018-08-14 21:14:12 +02:00
Paulus Schoutsen 6540d2e073
Switch to intermediate Mozilla cert profile (#15957)
* Allow choosing intermediate SSL profile

* Fix tests
2018-08-14 08:20:17 +02:00
Jason Hu da8f93dca2 Add trusted networks auth provider (#15812)
* Add context to login flow

* Add trusted networks auth provider

* source -> context
2018-08-13 12:40:06 +02:00
Jason Hu 272be7cdae Remove remote.API from core.Config (#15951)
* Use core.ApiConfig replace remote.API in core.Config

* Move ApiConfig to http
2018-08-13 09:26:20 +02:00
Jason Hu 6f2000f5e2 Make sure use_x_forward_for and trusted_proxies must config together (#15804)
* Make sure use_x_forward_for and trusted_proxies must config together

* Fix unit test
2018-08-03 13:52:34 +02:00
Paulus Schoutsen c7f4bdafc0 Context (#15674)
* Add context

* Add context to switch/light services

* Test set_state API

* Lint

* Fix tests

* Do not include context yet in comparison

* Do not pass in loop

* Fix Z-Wave tests

* Add websocket test without user
2018-07-28 17:53:37 -07:00
Jason Hu b2f4bbf93b Only log change to use access token warning once (#15690) 2018-07-27 15:53:46 +02:00
Paulus Schoutsen 169c8d793a
Fix CORS duplicate registration (#15670) 2018-07-25 11:36:44 +02:00
Jason Hu d7690c5fda Add ipban for failed login attempt in new login flow (#15551)
* Add ipban for failed login attempt in new login flow

* Address review comment

* Use decorator to clean up code
2018-07-24 10:09:52 +02:00
Ville Skyttä b7c336a687 Pylint cleanups (#15626)
* Pylint 2 no-else-return fixes

* Remove unneeded abstract-class-not-used pylint disable
2018-07-23 10:16:05 +02:00
Jason Hu f1286f8e6b Reset failed login attempts counter when login success (#15564) 2018-07-20 12:09:48 +02:00
Ville Skyttä 2f7b79764a More pylint 2 fixes (#15565)
## Description:

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

## Checklist:
  - [ ] The code change is tested and works locally.
  - [x] Local tests pass with `tox`. **Your PR cannot be merged unless tests pass**
2018-07-20 11:45:20 +03:00
Paulus Schoutsen 2a76a0852f
Allow CORS requests to token endpoint (#15519)
* Allow CORS requests to token endpoint

* Tests

* Fuck emulated hue

* Clean up

* Only cors existing methods
2018-07-19 08:37:00 +02:00
Paulus Schoutsen ad4cba70a0
Extract SSL context creation to helper (#15483)
* Extract SSL context creation to helper

* Lint
2018-07-16 10:32:07 +02:00
Paulus Schoutsen ed0cfc4f31
Add user via cmd line creates owner (#15470)
* Add user via cmd line creates owner

* Ensure access tokens are not verified for inactive users

* Stale print

* Lint
2018-07-15 20:46:15 +02:00
Paulus Schoutsen 70fe463ef0
User management (#15420)
* User management

* Lint

* Fix dict

* Reuse data instance

* OrderedDict all the way
2018-07-13 15:31:20 +02:00
Jason Hu 6e3ec97acf Include request.path in legacy api password warning message (#15438) 2018-07-13 09:19:13 +02:00
Jason Hu f874efb224 By default to use access_token if hass.auth.active (#15212)
* Force to use access_token if hass.auth.active

* Not allow Basic auth with api_password if hass.auth.active

* Block websocket api_password auth when hass.auth.active

* Add legacy_api_password auth provider

* lint

* lint
2018-06-30 22:31:36 -04:00
Hmmbob 94b55efef3 Stop supporting deprecated TLS ciphers (#15217)
* Stop supporting deprecated TLS ciphers

* Lint
2018-06-29 17:18:44 -04:00
Colin O'Dell fd38caa287 X-Forwarded-For improvements and bug fixes (#15204)
* Use new trusted_proxies setting for X-Forwarded-For whitelist

* Only use the last IP in the header

Per Wikipedia (https://en.wikipedia.org/wiki/X-Forwarded-For#Format):

 > The last IP address is always the IP address that connects to the last proxy,
 > which means it is the most reliable source of information.

* Add two additional tests

* Ignore nonsense header values instead of failing
2018-06-29 16:27:06 -04:00
Colin O'Dell 19f2bbf52f Only use the X-Forwarded-For header if connection is from a trusted network (#15182)
See https://github.com/home-assistant/home-assistant/issues/14345#issuecomment-400854569
2018-06-28 09:16:11 -04:00
Robert Kiss 3921dc77a6 Add SSL peer certificate support to HTTP server (#15043)
* adding SSL peer certificate support to HTTP server

* remove unnecessary exception block
2018-06-26 11:44:08 -04:00
Ville Skyttä b92350fb55 Lint cleanup (#15103)
* Remove unneeded inline pylint disables

* Remove unneeded noqa's

* Use symbol names instead of message ids in inline pylint disables
2018-06-25 13:05:07 -04:00
Paulus Schoutsen 5ec7fc7ddb Backend tweaks to make authorization work (#14339)
* Backend tweaks to make authorization work

* Lint

* Add test

* Validate redirect uris

* Fix tests

* Fix tests

* Lint
2018-05-10 10:38:11 +02:00
Paulus Schoutsen cdd45e7878 Foundation for users (#13968)
* Add initial user foundation to Home Assistant

* Address comments

* Address comments

* Allow non-ascii passwords

* One more utf-8 hmac compare digest

* Add new line
2018-05-01 18:20:41 +02:00
Fabian Affolter e01a0f91d6 Upgrade aiohttp_cors to 0.7.0 (#13289) 2018-03-17 17:37:53 +01:00
Paulus Schoutsen 0a2e949e0a Remove crazy JSON encoding things that are no longer used (#13029)
Catch JSON encoding errors in HTTP view
2018-03-12 23:22:08 +01:00
Boyi C 321eb2ec6f Move HomeAssistantView to separate file. Convert http to async syntax. [skip ci] (#12982)
* Move HomeAssistantView to separate file. Convert http to async syntax.

* pylint

* websocket api

* update emulated_hue for async/await

* Lint
2018-03-08 17:51:49 -08:00
Paulus Schoutsen 6a5c7ef43f
Upgrade to aiohttp 3 (#12921)
* Upgrade aiohttp to 3.0.6

* Fix tests

* Fix aiohttp client stream test

* Lint

* Remove drain
2018-03-05 13:28:41 -08:00
Joakim Plate 92aeef82ef Enable compression when sending json to client (#11165)
* Enable compression when sending json to client

Make server compress json content when transmitting to client. Json is quite verbose and compresses well.

A real world example is history_graph requested data for in my case 4 temperature sensors updating every half a second for a graph over 10 days lead to 6MB json which compressed to 200KB using deflate compression.

* Rename variable to request

* Name the variable response instead of request
2018-02-17 21:32:08 -08:00
Paulus Schoutsen 3fd61d8f45 Update voluputous (#12463)
* Update voluputous

* Fix http config

* Fix optional with default=None

* Optional, default=none

* Fix defaults in voluptuous schemas

* Fix tests

* Fix update error

* Lint
2018-02-17 10:29:14 +01:00
Paulus Schoutsen f32911d036 Cleanup http (#12424)
* Clean up HTTP component

* Clean up HTTP mock

* Remove unused import

* Fix test

* Lint
2018-02-15 22:06:14 +01:00
Paulus Schoutsen 78c44180f4 Extract data validator to own file and add tests (#12401) 2018-02-14 21:06:03 +01:00
Otto Winter 678f284015 Upgrade pylint to 1.8.2 (#12274)
* Upgrade pylint to 1.8.1

* Fix no-else-return

* Fix bad-whitespace

* Fix too-many-nested-blocks

* Fix raising-format-tuple

See https://github.com/PyCQA/pylint/blob/master/doc/whatsnew/1.8.rst

* Fix len-as-condition

* Fix logging-not-lazy

Not sure about that TEMP_CELSIUS though, but internally it's probably just like if you concatenated any other (variable) string

* Fix stop-iteration-return

* Fix useless-super-delegation

* Fix trailing-comma-tuple

Both of these seem to simply be bugs:
 * Nest: The value of self._humidity never seems to be used anywhere
 * Dovado: The called API method seems to expect a "normal" number

* Fix redefined-argument-from-local

* Fix consider-using-enumerate

* Fix wrong-import-order

* Fix arguments-differ

* Fix missed no-else-return

* Fix no-member and related

* Fix signatures-differ

* Revert "Upgrade pylint to 1.8.1"

This reverts commit af78aa00f125a7d34add97b9d50c14db48412211.

* Fix arguments-differ

* except for device_tracker

* Cleanup

* Fix test using positional argument

* Fix line too long

I forgot to run flake8 - shame on me... 🙃

* Fix bad-option-value for 1.6.5

* Fix arguments-differ for device_tracker

* Upgrade pylint to 1.8.2

* 👕 Fix missed no-member
2018-02-11 09:20:28 -08:00
Pascal Vizeli e4874fd7c7 Update aiohttp 2.3.10 / yarl 1.1.0 (#12244)
* Update aiohttp 2.3.10 / yarl 1.1.0

* Update setup.py

* Update package_constraints.txt

* Update google.py

* Update static.py
2018-02-08 20:57:05 -08:00
Phil Elson 40af9f2676 Correct use of middleware async handling. (#12078) 2018-01-31 09:04:32 -08:00
Fabian Affolter 5be949f00f Upgrade aiohttp_cors to 0.6.0 (#11310) 2017-12-27 09:17:03 +01:00
Andrey 5e92fa3404 Add an option to serve ES6 JS to clients (#10474)
* Add an option to serve ES6 JS to clients

* Rename es6 to latest

* Fixes

* Serve JS vrsions from separate dirs

* Revert websocket API change

* Update frontend to 20171110.0

* websocket: move request to constructor
2017-11-10 23:02:06 -08:00
Pascal Vizeli a9a3e24bde Update aiohttp to 2.3.1 (#10139)
* Update aiohttp to 2.3.1

* set timeout 10sec

* fix freeze with new middleware handling

* Convert middleware auth

* Convert mittleware ipban

* convert middleware static

* fix lint

* Update ban.py

* Update auth.py

* fix lint

* Fix tests
2017-11-05 18:42:31 -08:00
Fabian Affolter de9d19d6f4 Use constants for HTTP headers (#10313)
* Use constants for HTTP headers

* Fix ordering

* Move 'no-cache' to platform
2017-11-04 12:04:05 -07:00
Paulus Schoutsen 4dc9ac820f Remove http.development (#10267)
* Remove http.development

* Remove development

* Remove development from tests

* Remove constant
2017-11-01 13:07:16 +01:00
Phil Kates 9d20a53d63 Google Actions for Assistant (#9632)
* http: Add headers key to json[_message]

* Add google_assistant component

This component provides API endpoints for the Actions on Google Smart
Home API to interact with Google Assistant.

* google_assistant: Re-add fan support

* google_assistant: Fix Scene handling

- The way I originally wrote the MAPPING_COMPONENT and the way it's actual
  used changed so the comment was updated to match that.
- Use const's in more places
- Handle the ActivateScene command correctly

* google_assistant: Fix flakey compare test

Was failing on 3.4.2 and 3.5, this is more correct anyway.

* google_assistant: Use volume attr for media_player
2017-10-17 22:00:59 -07:00
Paulus Schoutsen 6fb55b363a Add OwnTracks over HTTP (#9582)
* Add OwnTracks over HTTP

* Fix tests
2017-09-28 09:49:35 +02:00
Paulus Schoutsen c9fc3fae6e Update cloud auth (#9357)
* Update cloud logic

* Lint

* Update test requirements

* Address commments, fix tests

* Add credentials
2017-09-12 18:47:04 +02:00
Fabian Affolter 0863d50210 Fix typos (#7957)
Add an optional extended description…
2017-06-08 15:53:12 +02:00
Paulus Schoutsen e68bd0457c Fix more deprecation warnings (#7778)
* Remove setting up an hbmqtt broker

* Don't pass loop to web.Application in tests

* Use .query instead of deprecated .GET for aiohttp requests

* Fix closing file resource

* Do not use asyncio mark

* Notify.html5 - PyJWT: Use options to disable verify

* Yamaha: Test was still using deprecated ip

* Remove pytest-asyncio
2017-05-26 13:12:17 -07:00
Paulus Schoutsen f43db3c615 Replace executor with async_add_job (#7658)
* Remove executor

* Lint

* Lint

* Fix tests
2017-05-26 08:28:07 -07:00
Fabian Affolter 3ee4d1060f Update docstrings (#7361)
* Update docstrings

* Update docstrings

* Update docstrings

* Update docstrings

* update docstrings

* Update docstrings

* Update docstrings

* Update docstrings

* Update docstrings

* Update docstrings

* Update tomato.py

* Update isy994.py

* Lint + fix tests

* Lint
2017-04-29 22:04:49 -07:00
Fabian Affolter 209da6f338 Upgrade aiohttp_cors to 0.5.3 (#7213) 2017-04-23 09:25:58 +02:00
Fabian Affolter 7afe694cc7 Upgrade aiohttp_cors to 0.5.2 (#6874) 2017-04-01 12:36:35 +02:00
Paulus Schoutsen 714b516176 aiohttp 2 (#6835)
* Upgrade aiohttp2

* Fix resource caching

* Fix helpers.aiohttp_client

* Lint

* Use static path for api error_log

* Fix ClientErrors import

* Remove not needed DisconnectError

* Remove releasing responses code

* Add timeout if stream starts non responding

* More async_aiohttp_proxy_stream cleanup

* Fix references to ClientError

* Fix fingerprinting

* Fix aiohttp stream tests

* Rename aiohttp_proxy_stream

* Remove impossible darksky test

* Fix sleepiq requests escaping mocker

* Lint

* Remove deprecated parameter

* Break up aiohttp_proxy_stream in 2 methods

* Lint

* Upgrade to aiohttp 2.0.4

* Convert connector close to a callback

* Fix static fingerprinted links
2017-03-30 00:50:53 -07:00
Paulus Schoutsen 10bf659773 Fix unnecessary warning for ip bans.yaml (#6417) 2017-03-05 10:53:21 +01:00
Paulus Schoutsen d6818c7015 Fix reporting on bad login (#6201) 2017-02-24 16:33:58 -08:00
Paulus Schoutsen e68e29e03e Upgrade to aiohttp 1.2 (#4964)
* Upgrade to aiohttp 1.2

* Clean up emulated_hue tests
2017-01-11 21:25:02 +01:00
Paulus Schoutsen ed0d14c902 Base url: Fix external port different from internal port (#4990)
* Base url: Fix external port different from internal port

* Add base_url example to new config
2016-12-18 14:59:45 -08:00
Paulus Schoutsen f8af6e7863 Allow setting base url (#4985) 2016-12-18 12:56:07 -08:00
Erik Eriksson 6da3e23436 Update __init__.py (#4877)
Cleaner exit by not throwing exception if server was not set during initialization of component (ref https://github.com/home-assistant/home-assistant/pull/4866)
2016-12-13 08:57:33 -08:00
Erik Eriksson 12f790c7cf Display error message instead of exception (#4866)
* Display error message instead of exception

Display error message in log instead of stack trace.
(Usually happens when a server is already running at the same port.)

* Update __init__.py

Better error handling when reading SSL certificate

* Update __init__.py

* Update __init__.py
2016-12-12 22:02:24 -08:00
Adam Mills c40ddf18c7 Fix incorrect caching of /api/error_log (#4789) 2016-12-06 21:03:49 -08:00
Paulus Schoutsen 1b35f0878e Fix CORS when static resources registered (#4727) 2016-12-04 10:57:24 -08:00
Paulus Schoutsen 0d734303a4 HTTP: Fix registering views after start (#4604) 2016-11-27 14:01:12 -08:00
Paulus Schoutsen 914a868fbd Add websocket API (#4582)
* Add websocket API

* Add identifiers to interactions

* Allow unsubscribing event listeners

* Add support for fetching data

* Clean up handling code websockets api

* Lint

* Add Home Assistant version to auth messages

* Py.test be less verbose in tox
2016-11-26 18:23:28 -08:00
Paulus Schoutsen 32ffd006fa Reorganize HTTP component (#4575)
* Move HTTP to own folder

* Break HTTP into middlewares

* Lint

* Split tests per middleware

* Clean up HTTP tests

* Make HomeAssistantViews more stateless

* Lint

* Make HTTP setup async
2016-11-25 13:04:06 -08:00
Paulus Schoutsen 9616a2292e Add manifest.json 2015-03-03 21:15:15 -08:00
Paulus Schoutsen 3f26fc3b06 Move more HTTP stuff into constant file 2015-02-13 18:27:13 -08:00
Paulus Schoutsen cddeddac8d For backwards compat, have http load frontend/api 2015-01-31 09:55:26 -08:00
Paulus Schoutsen 13ac71bdf0 Clean up http related components 2015-01-30 08:26:06 -08:00
Paulus Schoutsen 61f6aff056 Upgrade to Polymer 0.5.4 2015-01-30 00:00:19 -08:00
Paulus Schoutsen 8feeafd8a3 Refactor http into frontend and api component 2015-01-29 23:56:21 -08:00
Geoff Norton 8b947e2fab Merge remote-tracking branch 'origin/dev' into dev
Conflicts:
	homeassistant/components/http/frontend.py
	homeassistant/components/http/www_static/frontend.html
2015-01-22 05:27:26 +00:00
Geoff Norton ead5d99394 Update the frontend with the new icon for sensor 2015-01-22 05:23:12 +00:00
Paulus Schoutsen ff230cefe3 Disable pylint unused-argument check 2015-01-19 23:40:51 -08:00
Paulus Schoutsen 2016da984a Tweaks to the configurator UI 2015-01-19 22:40:30 -08:00
Paulus Schoutsen cdbcc844cf Add tests, fix styling 2015-01-19 21:40:54 -08:00
Paulus Schoutsen 980ecdaacb Add initial version of configurator component 2015-01-19 21:40:54 -08:00
Paulus Schoutsen 0c5f1234da Fix tabs being selectable by clicking on header 2015-01-19 21:39:44 -08:00
Paulus Schoutsen 35094a1667 Data binding fix: Update instead of replace states 2015-01-19 21:39:44 -08:00
Paulus Schoutsen 9d933f517b Merge pull request #22 from kangaroo/wink-sensors
Wink sensor support
2015-01-19 21:30:44 -08:00
Geoff Norton c224b91945 Merge branch 'wink-sensors' into dev 2015-01-20 05:22:39 +00:00
Geoff Norton abfaca3bfb Update sensor icon for now 2015-01-20 04:55:12 +00:00
Paulus Schoutsen dd38621352 Frontend: show message if no states 2015-01-17 23:29:46 -08:00
Paulus Schoutsen ed05ff6fd9 Allow for running Home Assistant without password 2015-01-17 21:55:33 -08:00
Paulus Schoutsen 50eecd11c1 Added command line toggle to open UI on start 2015-01-17 21:13:02 -08:00
Paulus Schoutsen c116cb095d Better positioning of dialogs 2015-01-14 23:57:23 -08:00
Paulus Schoutsen ced3d595cc Added error handling in frontend debug forms 2015-01-14 23:56:53 -08:00
Paulus Schoutsen 3e4c0261b1 Conditionally show widgets on light more info 2015-01-14 23:10:56 -08:00
Paulus Schoutsen fd6ff4c8d3 Rename the edit state button in more info to debug 2015-01-14 22:15:27 -08:00
Paulus Schoutsen d1ad6f3e65 Show state attributes in default more info dialog 2015-01-12 23:57:57 -08:00
Paulus Schoutsen aea6042fe1 Getting thermostat component ready for release 2015-01-11 21:21:18 -08:00
Paulus Schoutsen 6943a3bc14 Add a Nest specific card to frontend 2015-01-06 00:11:03 -08:00
Paulus Schoutsen b10b75b7fe Reorganized frontend files 2015-01-05 21:41:15 -08:00
Paulus Schoutsen 4fec2dcb28 Add notification component and PushBullet platform 2015-01-04 01:14:18 -08:00
Paulus Schoutsen a6ec071244 ps: dialogs on small screens only take needed height 2015-01-03 09:52:47 -08:00
Paulus Schoutsen 1ebaf7fd36 Tweaked the default 'more info' component text 2015-01-02 08:47:11 -08:00
Paulus Schoutsen 67d62a1723 New compiled version of frontend 2015-01-01 22:06:55 -08:00
Paulus Schoutsen edb01b6bb4 Moved dialog logic to base class. 2015-01-01 22:06:39 -08:00
Paulus Schoutsen 5e9303dbf2 Create cards and more-info elements dynamically 2015-01-01 22:02:28 -08:00