Bump waterfurnace to 1.0

This bumps to the new version of the waterfurnace API. In the new
version the unit id is no longer manually set by the user, instead it
is retrieved from the service after login. This is less error prone as
it turns out discovering the correct unit id is hard from an end user
perspective.

Breaking change on the config, as the unit parameter is removed from
config. However I believe the number of users is very low (possibly
only 2), so adaptation should be easy.
This commit is contained in:
Sean Dague 2018-12-05 07:03:27 -05:00
parent 2680bf8a61
commit 8c0b50b5df
2 changed files with 5 additions and 8 deletions

View File

@ -19,13 +19,12 @@ from homeassistant.helpers import config_validation as cv
from homeassistant.helpers import discovery from homeassistant.helpers import discovery
REQUIREMENTS = ["waterfurnace==0.7.0"] REQUIREMENTS = ["waterfurnace==1.0.0"]
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
DOMAIN = "waterfurnace" DOMAIN = "waterfurnace"
UPDATE_TOPIC = DOMAIN + "_update" UPDATE_TOPIC = DOMAIN + "_update"
CONF_UNIT = "unit"
SCAN_INTERVAL = timedelta(seconds=10) SCAN_INTERVAL = timedelta(seconds=10)
ERROR_INTERVAL = timedelta(seconds=300) ERROR_INTERVAL = timedelta(seconds=300)
MAX_FAILS = 10 MAX_FAILS = 10
@ -36,8 +35,7 @@ NOTIFICATION_TITLE = 'WaterFurnace website status'
CONFIG_SCHEMA = vol.Schema({ CONFIG_SCHEMA = vol.Schema({
DOMAIN: vol.Schema({ DOMAIN: vol.Schema({
vol.Required(CONF_PASSWORD): cv.string, vol.Required(CONF_PASSWORD): cv.string,
vol.Required(CONF_USERNAME): cv.string, vol.Required(CONF_USERNAME): cv.string
vol.Required(CONF_UNIT): cv.string,
}), }),
}, extra=vol.ALLOW_EXTRA) }, extra=vol.ALLOW_EXTRA)
@ -49,9 +47,8 @@ def setup(hass, base_config):
username = config.get(CONF_USERNAME) username = config.get(CONF_USERNAME)
password = config.get(CONF_PASSWORD) password = config.get(CONF_PASSWORD)
unit = config.get(CONF_UNIT)
wfconn = wf.WaterFurnace(username, password, unit) wfconn = wf.WaterFurnace(username, password)
# NOTE(sdague): login will throw an exception if this doesn't # NOTE(sdague): login will throw an exception if this doesn't
# work, which will abort the setup. # work, which will abort the setup.
try: try:
@ -83,7 +80,7 @@ class WaterFurnaceData(threading.Thread):
super().__init__() super().__init__()
self.hass = hass self.hass = hass
self.client = client self.client = client
self.unit = client.unit self.unit = self.client.gwid
self.data = None self.data = None
self._shutdown = False self._shutdown = False
self._fails = 0 self._fails = 0

View File

@ -1617,7 +1617,7 @@ warrant==0.6.1
watchdog==0.8.3 watchdog==0.8.3
# homeassistant.components.waterfurnace # homeassistant.components.waterfurnace
waterfurnace==0.7.0 waterfurnace==1.0.0
# homeassistant.components.media_player.gpmdp # homeassistant.components.media_player.gpmdp
websocket-client==0.37.0 websocket-client==0.37.0