Add HTTP Basic auth to RESTful Switch (#9162)
* Add HTTP Basic auth to RESTful Switch * Remove redundant hass passing * Initialize to current state The state used to be None until the first periodic poll. This commit refactors async_update so it can be used during setup as well, allowing the state to start out with the correct value. * Refactor turn_on/turn_off device communication * Remove lint * Fix Travis errors
This commit is contained in:
parent
313a9e3984
commit
160c7fc685
2 changed files with 57 additions and 43 deletions
|
@ -99,11 +99,13 @@ class TestRestSwitch:
|
|||
self.name = 'foo'
|
||||
self.method = 'post'
|
||||
self.resource = 'http://localhost/'
|
||||
self.auth = None
|
||||
self.body_on = Template('on', self.hass)
|
||||
self.body_off = Template('off', self.hass)
|
||||
self.switch = rest.RestSwitch(
|
||||
self.hass, self.name, self.resource, self.method, self.body_on,
|
||||
self.name, self.resource, self.method, self.auth, self.body_on,
|
||||
self.body_off, None, 10)
|
||||
self.switch.hass = self.hass
|
||||
|
||||
def teardown_method(self):
|
||||
"""Stop everything that was started."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue