From fabc49d17e650d8c24b67d36d3241a98c8c21da8 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Tue, 16 Jul 2019 20:36:40 -0700 Subject: [PATCH 01/11] Fix theme color in dev index.html --- build-scripts/gulp/entry-html.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-scripts/gulp/entry-html.js b/build-scripts/gulp/entry-html.js index eb26093925..c322aac4ec 100644 --- a/build-scripts/gulp/entry-html.js +++ b/build-scripts/gulp/entry-html.js @@ -86,7 +86,7 @@ gulp.task("gen-index-app-dev", (done) => { es5CoreJS: "/frontend_es5/core.js", es5CustomPanelJS: "/frontend_es5/custom-panel.js", es5HassIconsJS: "/frontend_es5/hass-icons.js", - }); + }).replace(/#THEMEC/g, "{{ theme_color }}"); fs.outputFileSync(path.resolve(config.root, "index.html"), content); done(); From 09a19d2e7f0812f4c51691adb0c32df2019d91a6 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Tue, 16 Jul 2019 20:38:35 -0700 Subject: [PATCH 02/11] Allow scrolling notification drawer. Fixes 3366 --- src/dialogs/notifications/notification-drawer.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/dialogs/notifications/notification-drawer.js b/src/dialogs/notifications/notification-drawer.js index 0b1255a762..2b574b13d9 100644 --- a/src/dialogs/notifications/notification-drawer.js +++ b/src/dialogs/notifications/notification-drawer.js @@ -34,6 +34,8 @@ export class HuiNotificationDrawer extends EventsMixin( .notifications { overflow-y: auto; padding-top: 16px; + height: calc(100% - 65px); + box-sizing: border-box; } .notification { From 3ebb30bd4819df4e5a7dd9be8d6fb7b5b6bc4949 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Tue, 16 Jul 2019 20:43:00 -0700 Subject: [PATCH 03/11] Only show advanced mode toggle for admins. Fixes #3369 --- src/panels/profile/ha-panel-profile.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/panels/profile/ha-panel-profile.js b/src/panels/profile/ha-panel-profile.js index 1cefa17524..47577bc73c 100644 --- a/src/panels/profile/ha-panel-profile.js +++ b/src/panels/profile/ha-panel-profile.js @@ -104,10 +104,12 @@ class HaPanelProfile extends EventsMixin(LocalizeMixin(PolymerElement)) { mfa-modules="[[hass.user.mfa_modules]]" > - + cred.auth_provider_type === "homeassistant" ); } + + _isAdmin(user) { + return user.is_admin; + } } customElements.define("ha-panel-profile", HaPanelProfile); From 567769be5a834b16197266346b16ecb5af44cd89 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Tue, 16 Jul 2019 21:33:09 -0700 Subject: [PATCH 04/11] Use hass icons for search input --- src/common/search/search-input.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/search/search-input.ts b/src/common/search/search-input.ts index deb36885b7..65b29881e9 100644 --- a/src/common/search/search-input.ts +++ b/src/common/search/search-input.ts @@ -26,7 +26,7 @@ class SearchInput extends LitElement { @value-changed=${this._filterInputChanged} > @@ -36,7 +36,7 @@ class SearchInput extends LitElement { slot="suffix" class="suffix" @click=${this._clearSearch} - icon="mdi:close" + icon="hass:close" alt="Clear" title="Clear" > From eaaeb10c6d7b99998d503899b40b6b7887020d50 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Tue, 16 Jul 2019 21:34:12 -0700 Subject: [PATCH 05/11] Store width before searching to avoid jumping --- .../config-flow/step-flow-pick-handler.ts | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/dialogs/config-flow/step-flow-pick-handler.ts b/src/dialogs/config-flow/step-flow-pick-handler.ts index 0fbe0ba597..8599155837 100644 --- a/src/dialogs/config-flow/step-flow-pick-handler.ts +++ b/src/dialogs/config-flow/step-flow-pick-handler.ts @@ -18,6 +18,7 @@ import * as Fuse from "fuse.js"; import "../../components/ha-icon-next"; import "../../common/search/search-input"; +import { styleMap } from "lit-html/directives/style-map"; interface HandlerObj { name: string; @@ -29,6 +30,7 @@ class StepFlowPickHandler extends LitElement { @property() public hass!: HomeAssistant; @property() public handlers!: string[]; @property() private filter?: string; + private _width?: Number; private _getHandlers = memoizeOne((h: string[], filter?: string) => { const handlers: HandlerObj[] = h.map((handler) => { @@ -58,11 +60,11 @@ class StepFlowPickHandler extends LitElement { return html`

${this.hass.localize("ui.panel.config.integrations.new")}

-
- + +
${handlers.map( (handler: HandlerObj) => html` @@ -80,6 +82,11 @@ class StepFlowPickHandler extends LitElement { private async _filterChanged(e) { this.filter = e.detail.value; + + // Store the width so that when we search, box doesn't jump + if (this._width === undefined) { + this._width = this.shadowRoot!.querySelector("div")!.clientWidth; + } } private async _handlerPicked(ev) { From 55aa5a0d1212322cc186c894e5a56ef754add3a1 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Tue, 16 Jul 2019 21:39:38 -0700 Subject: [PATCH 06/11] Scroll device list when goes out of screen. Fixes #3343 --- src/dialogs/config-flow/step-flow-create-entry.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/dialogs/config-flow/step-flow-create-entry.ts b/src/dialogs/config-flow/step-flow-create-entry.ts index ac38ba95ed..5ecc457a40 100644 --- a/src/dialogs/config-flow/step-flow-create-entry.ts +++ b/src/dialogs/config-flow/step-flow-create-entry.ts @@ -69,9 +69,10 @@ class StepFlowCreateEntry extends LitElement { (device) => html`
- ${device.name}
- ${device.model} (${device.manufacturer}) - +
+ ${device.name}
+ ${device.model} (${device.manufacturer}) +
Date: Tue, 16 Jul 2019 22:41:47 -0700 Subject: [PATCH 07/11] Fix typing --- src/dialogs/config-flow/step-flow-pick-handler.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dialogs/config-flow/step-flow-pick-handler.ts b/src/dialogs/config-flow/step-flow-pick-handler.ts index 8599155837..3305c258d7 100644 --- a/src/dialogs/config-flow/step-flow-pick-handler.ts +++ b/src/dialogs/config-flow/step-flow-pick-handler.ts @@ -30,7 +30,7 @@ class StepFlowPickHandler extends LitElement { @property() public hass!: HomeAssistant; @property() public handlers!: string[]; @property() private filter?: string; - private _width?: Number; + private _width?: number; private _getHandlers = memoizeOne((h: string[], filter?: string) => { const handlers: HandlerObj[] = h.map((handler) => { From 42c3e3e46c5c68722eca4b639cfb6aa184540277 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Tue, 16 Jul 2019 23:51:15 -0700 Subject: [PATCH 08/11] Differentiate Heat/Cool (#3371) --- src/panels/lovelace/cards/hui-thermostat-card.ts | 2 +- src/translations/en.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/panels/lovelace/cards/hui-thermostat-card.ts b/src/panels/lovelace/cards/hui-thermostat-card.ts index 6b1c07a549..abd6a98ab7 100644 --- a/src/panels/lovelace/cards/hui-thermostat-card.ts +++ b/src/panels/lovelace/cards/hui-thermostat-card.ts @@ -37,7 +37,7 @@ const thermostatConfig = { }; const modeIcons: { [mode in HvacMode]: string } = { - auto: "hass:autorenew", + auto: "hass:calendar-repeat", heat_cool: "hass:autorenew", heat: "hass:fire", cool: "hass:snowflake", diff --git a/src/translations/en.json b/src/translations/en.json index 76a38048e3..84ed63da12 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -173,7 +173,7 @@ "off": "[%key:state::default::off%]", "heat": "Heat", "cool": "Cool", - "heat_cool": "Auto", + "heat_cool": "Heat/Cool", "auto": "Auto", "dry": "Dry", "fan_only": "Fan only" From 84df2bd531983ed48448daff9835e73b6d5b5f86 Mon Sep 17 00:00:00 2001 From: Joakim Plate Date: Wed, 17 Jul 2019 20:32:23 +0200 Subject: [PATCH 09/11] Make sure slider type updates with changes to temperatures (#3374) --- .../lovelace/cards/hui-thermostat-card.ts | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/panels/lovelace/cards/hui-thermostat-card.ts b/src/panels/lovelace/cards/hui-thermostat-card.ts index abd6a98ab7..4049549649 100644 --- a/src/panels/lovelace/cards/hui-thermostat-card.ts +++ b/src/panels/lovelace/cards/hui-thermostat-card.ts @@ -204,10 +204,13 @@ export class HuiThermostatCard extends LitElement implements LovelaceCard { !changedProps.has("_jQuery") && (!oldHass || oldHass.states[this._config.entity] !== stateObj) ) { - const [sliderValue, uiValue] = this._genSliderValue(stateObj); + const [sliderValue, uiValue, _sliderType] = this._genSliderValue( + stateObj + ); this._jQuery("#thermostat", this.shadowRoot).roundSlider({ value: sliderValue, + sliderType: _sliderType, }); this._updateSetTemp(uiValue); } @@ -250,13 +253,7 @@ export class HuiThermostatCard extends LitElement implements LovelaceCard { this._roundSliderStyle = loaded.roundSliderStyle; this._jQuery = loaded.jQuery; - const _sliderType = - stateObj.attributes.target_temp_low && - stateObj.attributes.target_temp_high - ? "range" - : "min-range"; - - const [sliderValue, uiValue] = this._genSliderValue(stateObj); + const [sliderValue, uiValue, _sliderType] = this._genSliderValue(stateObj); this._jQuery("#thermostat", this.shadowRoot).roundSlider({ ...thermostatConfig, @@ -272,7 +269,10 @@ export class HuiThermostatCard extends LitElement implements LovelaceCard { this._updateSetTemp(uiValue); } - private _genSliderValue(stateObj: ClimateEntity): [string | number, string] { + private _genSliderValue( + stateObj: ClimateEntity + ): [string | number, string, string] { + let sliderType: string; let sliderValue: string | number; let uiValue: string; @@ -280,6 +280,7 @@ export class HuiThermostatCard extends LitElement implements LovelaceCard { stateObj.attributes.target_temp_low && stateObj.attributes.target_temp_high ) { + sliderType = "range"; sliderValue = `${stateObj.attributes.target_temp_low}, ${ stateObj.attributes.target_temp_high }`; @@ -291,6 +292,7 @@ export class HuiThermostatCard extends LitElement implements LovelaceCard { false ); } else { + sliderType = "min-range"; sliderValue = stateObj.attributes.temperature; uiValue = stateObj.attributes.temperature !== null @@ -298,7 +300,7 @@ export class HuiThermostatCard extends LitElement implements LovelaceCard { : ""; } - return [sliderValue, uiValue]; + return [sliderValue, uiValue, sliderType]; } private _updateSetTemp(value: string): void { From ddf2c6cc0fb6f0e805d4d0832b4ff3fd2354886b Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Wed, 17 Jul 2019 11:48:50 -0700 Subject: [PATCH 10/11] Add Azure pipelines for release --- azure-pipelines-release.yml | 68 +++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 azure-pipelines-release.yml diff --git a/azure-pipelines-release.yml b/azure-pipelines-release.yml new file mode 100644 index 0000000000..64daaaa5a0 --- /dev/null +++ b/azure-pipelines-release.yml @@ -0,0 +1,68 @@ +# https://dev.azure.com/home-assistant + +trigger: + batch: true + tags: + include: + - "*" +pr: none +variables: + - name: versionBuilder + value: "5.2" + - group: docker + - group: github + - group: twine + +stages: + - stage: "Validate" + jobs: + - job: "VersionValidate" + pool: + vmImage: "ubuntu-latest" + steps: + - task: UsePythonVersion@0 + displayName: "Use Python 3.7" + inputs: + versionSpec: "3.7" + - script: | + setup_version="$(python setup.py -V)" + branch_version="$(Build.SourceBranchName)" + + if [ "${setup_version}" != "${branch_version}" ]; then + echo "Version of tag ${branch_version} don't match with ${setup_version}!" + exit 1 + fi + displayName: "Check version of branch/tag" + - script: | + sudo apt-get install -y --no-install-recommends \ + jq curl + + release="$(Build.SourceBranchName)" + created_by="$(curl -s https://api.github.com/repos/home-assistant/home-assistant/releases/tags/${release} | jq --raw-output '.author.login')" + + if [[ "${created_by}" =~ ^(balloob)$ ]]; then + exit 0 + fi + + echo "${created_by} is not allowed to create an release!" + exit 1 + displayName: "Check rights" + + - stage: "Build" + jobs: + - job: "ReleasePython" + pool: + vmImage: "ubuntu-latest" + steps: + - task: UsePythonVersion@0 + displayName: "Use Python 3.7" + inputs: + versionSpec: "3.7" + - task: NodeTool@0 + displayName: "Use Node 12.1" + inputs: + versionSpec: "12.1" + - script: pip install twine wheel + displayName: "Install tools" + - script: script/release + displayName: "Build and release package" From 56745b372328d62b2793f5e5da28f4013785e89d Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Wed, 17 Jul 2019 11:50:07 -0700 Subject: [PATCH 11/11] Set up CI with Azure Pipelines [skip ci] --- azure-pipelines-release.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/azure-pipelines-release.yml b/azure-pipelines-release.yml index 64daaaa5a0..26dbc41ddd 100644 --- a/azure-pipelines-release.yml +++ b/azure-pipelines-release.yml @@ -9,7 +9,6 @@ pr: none variables: - name: versionBuilder value: "5.2" - - group: docker - group: github - group: twine