diff --git a/src/components/ha-form/ha-form-integer.ts b/src/components/ha-form/ha-form-integer.ts
index f4877386e0..155132c28c 100644
--- a/src/components/ha-form/ha-form-integer.ts
+++ b/src/components/ha-form/ha-form-integer.ts
@@ -5,6 +5,8 @@ import {
property,
TemplateResult,
query,
+ CSSResult,
+ css,
} from "lit-element";
import {
HaFormElement,
@@ -19,13 +21,14 @@ import "@polymer/paper-input/paper-input";
// tslint:disable-next-line
import { PaperInputElement } from "@polymer/paper-input/paper-input";
import { PaperSliderElement } from "@polymer/paper-slider/paper-slider";
+import { HaCheckbox } from "../ha-checkbox";
@customElement("ha-form-integer")
export class HaFormInteger extends LitElement implements HaFormElement {
@property() public schema!: HaFormIntegerSchema;
- @property() public data!: HaFormIntegerData;
- @property() public label!: string;
- @property() public suffix!: string;
+ @property() public data?: HaFormIntegerData;
+ @property() public label?: string;
+ @property() public suffix?: string;
@query("paper-input ha-paper-slider") private _input?: HTMLElement;
public focus() {
@@ -39,20 +42,31 @@ export class HaFormInteger extends LitElement implements HaFormElement {
? html`
${this.label}
-
+
+ ${this.schema.optional && this.schema.default === undefined
+ ? html`
+
+ `
+ : ""}
+
+
`
: html`
.slider-knob > .slider-knob-inner {
+ background-color: var(--paper-slider-disabled-knob-color, var(--paper-grey-400));
+ border: 2px solid var(--paper-slider-disabled-knob-color, var(--paper-grey-400));
+ }
+
.pin > .slider-knob > .slider-knob-inner::before {
top: unset;
margin-left: unset;
diff --git a/src/data/device_automation.ts b/src/data/device_automation.ts
index f23222f2ac..61b87d8852 100644
--- a/src/data/device_automation.ts
+++ b/src/data/device_automation.ts
@@ -66,7 +66,7 @@ export const fetchDeviceTriggerCapabilities = (
trigger,
});
-const whitelist = ["above", "below", "code", "for"];
+const whitelist = ["above", "below", "brightness", "code", "for"];
export const deviceAutomationsEqual = (
a: DeviceAutomation,
diff --git a/src/panels/config/automation/action/types/ha-automation-action-device_id.ts b/src/panels/config/automation/action/types/ha-automation-action-device_id.ts
index 003ddd55c0..a3b0290f84 100644
--- a/src/panels/config/automation/action/types/ha-automation-action-device_id.ts
+++ b/src/panels/config/automation/action/types/ha-automation-action-device_id.ts
@@ -10,6 +10,7 @@ import {
import { LitElement, customElement, property, html } from "lit-element";
import { fireEvent } from "../../../../../common/dom/fire_event";
import { HomeAssistant } from "../../../../../types";
+import memoizeOne from "memoize-one";
@customElement("ha-automation-action-device_id")
export class HaDeviceAction extends LitElement {
@@ -27,14 +28,20 @@ export class HaDeviceAction extends LitElement {
};
}
+ private _extraFieldsData = memoizeOne((capabilities, action: DeviceAction) =>
+ capabilities && capabilities.extra_fields
+ ? capabilities.extra_fields.map((item) => {
+ return { [item.name]: action[item.name] };
+ })
+ : undefined
+ );
+
protected render() {
const deviceId = this._deviceId || this.action.device_id;
- const extraFieldsData =
- this._capabilities && this._capabilities.extra_fields
- ? this._capabilities.extra_fields.map((item) => {
- return { [item.name]: this.action[item.name] };
- })
- : undefined;
+ const extraFieldsData = this._extraFieldsData(
+ this._capabilities,
+ this.action
+ );
return html`