-
-
Notifications
You must be signed in to change notification settings - Fork 37.1k
Add support for Stretch product to Plugwise integration #40108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
65e8c06
Initial switch-group/stretch with failing wk_lisa_battery test
CoMPaTech 17fe125
Adding switch tests, but TypeErrors, needs more investigation
CoMPaTech f4c638e
Fixes and tests aligned
CoMPaTech 91bce62
Review updates
CoMPaTech 925722c
Use const
CoMPaTech 1569943
Comments
CoMPaTech bf8fcaa
Add stretch hostname for testing part
CoMPaTech 383472b
Remove unused consts
CoMPaTech dda777b
Revert guardings in line with -beta
CoMPaTech 6c16da1
Catchup with dev (mostly with ourselves from #41201)
CoMPaTech 217eb2f
Update docstring
CoMPaTech 31c588f
Remove debug logging
CoMPaTech d7f12b0
Fix for #42725 (incorrect entity namingi)
CoMPaTech 428f039
Fix naming for gas interval
CoMPaTech d935577
Add missing CONF_USERNAME and use of it
bouwew 2f5e6df
Change "dummy" to "class"
bouwew 985de32
Don't use "class"
bouwew 028b489
Fix CONF_USERNAME default, dummy and other consts
CoMPaTech File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,53 +1,53 @@ | ||
| """Constant for Plugwise component.""" | ||
| DOMAIN = "plugwise" | ||
|
|
||
| SENSOR_PLATFORMS = ["sensor"] | ||
| SENSOR_PLATFORMS = ["sensor", "switch"] | ||
| ALL_PLATFORMS = ["binary_sensor", "climate", "sensor", "switch"] | ||
|
|
||
| # Sensor mapping | ||
| SENSOR_MAP_DEVICE_CLASS = 2 | ||
| SENSOR_MAP_ICON = 3 | ||
| SENSOR_MAP_MODEL = 0 | ||
| SENSOR_MAP_UOM = 1 | ||
| SENSOR_MAP_DEVICE_CLASS = 2 | ||
|
|
||
| # Default directives | ||
| DEFAULT_NAME = "Smile" | ||
| DEFAULT_USERNAME = "smile" | ||
| DEFAULT_TIMEOUT = 10 | ||
| DEFAULT_PORT = 80 | ||
| DEFAULT_MIN_TEMP = 4 | ||
| DEFAULT_MAX_TEMP = 30 | ||
| DEFAULT_SCAN_INTERVAL = {"thermostat": 60, "power": 10} | ||
| DEFAULT_NAME = "Smile" | ||
| DEFAULT_PORT = 80 | ||
| DEFAULT_USERNAME = "smile" | ||
| DEFAULT_SCAN_INTERVAL = {"power": 10, "stretch": 60, "thermostat": 60} | ||
| DEFAULT_TIMEOUT = 60 | ||
|
|
||
| # Configuration directives | ||
| CONF_MIN_TEMP = "min_temp" | ||
| CONF_BASE = "base" | ||
| CONF_GAS = "gas" | ||
| CONF_MAX_TEMP = "max_temp" | ||
| CONF_THERMOSTAT = "thermostat" | ||
| CONF_MIN_TEMP = "min_temp" | ||
| CONF_POWER = "power" | ||
| CONF_HEATER = "heater" | ||
| CONF_SOLAR = "solar" | ||
| CONF_GAS = "gas" | ||
| CONF_THERMOSTAT = "thermostat" | ||
|
|
||
| ATTR_ILLUMINANCE = "illuminance" | ||
| UNIT_LUMEN = "lm" | ||
|
|
||
| CURRENT_HVAC_DHW = "hot_water" | ||
| UNIT_LUMEN = "lm" | ||
|
|
||
| DEVICE_STATE = "device_state" | ||
|
|
||
| SCHEDULE_ON = "true" | ||
| SCHEDULE_OFF = "false" | ||
| SCHEDULE_ON = "true" | ||
|
|
||
| COOL_ICON = "mdi:snowflake" | ||
| FLAME_ICON = "mdi:fire" | ||
| IDLE_ICON = "mdi:circle-off-outline" | ||
| FLOW_OFF_ICON = "mdi:water-pump-off" | ||
| FLOW_ON_ICON = "mdi:water-pump" | ||
| IDLE_ICON = "mdi:circle-off-outline" | ||
| SWITCH_ICON = "mdi:electric-switch" | ||
|
|
||
| UNDO_UPDATE_LISTENER = "undo_update_listener" | ||
| COORDINATOR = "coordinator" | ||
|
|
||
| UNDO_UPDATE_LISTENER = "undo_update_listener" | ||
| ZEROCONF_MAP = { | ||
| "smile": "P1", | ||
| "smile_thermo": "Anna", | ||
| "smile_open_therm": "Adam", | ||
| "stretch": "Stretch", | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,7 +10,13 @@ | |
| import voluptuous as vol | ||
|
|
||
| from homeassistant.config_entries import ConfigEntry | ||
| from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_PORT, CONF_SCAN_INTERVAL | ||
| from homeassistant.const import ( | ||
| CONF_HOST, | ||
| CONF_PASSWORD, | ||
| CONF_PORT, | ||
| CONF_SCAN_INTERVAL, | ||
| CONF_USERNAME, | ||
| ) | ||
| from homeassistant.core import HomeAssistant, callback | ||
| from homeassistant.exceptions import ConfigEntryNotReady | ||
| from homeassistant.helpers import device_registry as dr | ||
|
|
@@ -26,6 +32,8 @@ | |
| COORDINATOR, | ||
| DEFAULT_PORT, | ||
| DEFAULT_SCAN_INTERVAL, | ||
| DEFAULT_TIMEOUT, | ||
| DEFAULT_USERNAME, | ||
| DOMAIN, | ||
| SENSOR_PLATFORMS, | ||
| UNDO_UPDATE_LISTENER, | ||
|
|
@@ -42,6 +50,7 @@ async def async_setup_entry_gw(hass: HomeAssistant, entry: ConfigEntry) -> bool: | |
|
|
||
| api = Smile( | ||
| host=entry.data[CONF_HOST], | ||
| username=entry.data.get(CONF_USERNAME, DEFAULT_USERNAME), | ||
| password=entry.data[CONF_PASSWORD], | ||
| port=entry.data.get(CONF_PORT, DEFAULT_PORT), | ||
| timeout=30, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should the default timeout be used here as well? can be done in new PR if so.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We'll have a look at this, thanks! |
||
|
|
@@ -56,15 +65,15 @@ async def async_setup_entry_gw(hass: HomeAssistant, entry: ConfigEntry) -> bool: | |
| raise ConfigEntryNotReady | ||
|
|
||
| except Smile.InvalidAuthentication: | ||
| _LOGGER.error("Invalid Smile ID") | ||
| _LOGGER.error("Invalid username or Smile ID") | ||
| return False | ||
|
|
||
| except Smile.PlugwiseError as err: | ||
| _LOGGER.error("Error while communicating to device") | ||
| _LOGGER.error("Error while communicating to device %s", api.smile_name) | ||
| raise ConfigEntryNotReady from err | ||
|
|
||
| except asyncio.TimeoutError as err: | ||
| _LOGGER.error("Timeout while connecting to Smile") | ||
| _LOGGER.error("Timeout while connecting to Smile %s", api.smile_name) | ||
| raise ConfigEntryNotReady from err | ||
|
|
||
| update_interval = timedelta( | ||
|
|
@@ -76,7 +85,7 @@ async def async_setup_entry_gw(hass: HomeAssistant, entry: ConfigEntry) -> bool: | |
| async def async_update_data(): | ||
| """Update data via API endpoint.""" | ||
| try: | ||
| async with async_timeout.timeout(10): | ||
| async with async_timeout.timeout(DEFAULT_TIMEOUT): | ||
| await api.full_update_device() | ||
| return True | ||
| except Smile.XMLDataMissingError as err: | ||
|
|
@@ -85,7 +94,7 @@ async def async_update_data(): | |
| coordinator = DataUpdateCoordinator( | ||
| hass, | ||
| _LOGGER, | ||
| name="Smile", | ||
| name=f"Smile {api.smile_name}", | ||
| update_method=async_update_data, | ||
| update_interval=update_interval, | ||
| ) | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.