Skip to content

Commit

Permalink
Fix incompatible object/array property types (1 of 3) (#19450)
Browse files Browse the repository at this point in the history
  • Loading branch information
steverep authored Jan 19, 2024
1 parent 45398f8 commit dcb3acc
Show file tree
Hide file tree
Showing 45 changed files with 62 additions and 62 deletions.
2 changes: 1 addition & 1 deletion gallery/src/components/demo-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export interface DemoCardConfig {
class DemoCard extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;

@property() public config!: DemoCardConfig;
@property({ attribute: false }) public config!: DemoCardConfig;

@property({ type: Boolean }) public showConfig = false;

Expand Down
2 changes: 1 addition & 1 deletion src/components/device/ha-device-automation-picker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export abstract class HaDeviceAutomationPicker<

@property() public deviceId?: string;

@property() public value?: T;
@property({ type: Object }) public value?: T;

@state() private _automations: T[] = [];

Expand Down
4 changes: 2 additions & 2 deletions src/components/ha-file-upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ export class HaFileUpload extends LitElement {

@property() public supports?: string;

@property() public value?: File | File[] | FileList | string;
@property({ type: Object }) public value?: File | File[] | FileList | string;

@property({ type: Boolean }) public multiple = false;

@property({ type: Boolean, reflect: true }) public disabled: boolean = false;
@property({ type: Boolean, reflect: true }) public disabled = false;

@property({ type: Boolean }) public uploading = false;

Expand Down
2 changes: 1 addition & 1 deletion src/components/ha-selector/ha-selector-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class HaActionSelector extends LitElement {

@property({ attribute: false }) public selector!: ActionSelector;

@property() public value?: Action;
@property({ attribute: false }) public value?: Action;

@property() public label?: string;

Expand Down
2 changes: 1 addition & 1 deletion src/components/ha-selector/ha-selector-condition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class HaConditionSelector extends LitElement {

@property({ attribute: false }) public selector!: ConditionSelector;

@property() public value?: Condition;
@property({ attribute: false }) public value?: Condition;

@property() public label?: string;

Expand Down
2 changes: 1 addition & 1 deletion src/components/ha-selector/ha-selector-location.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class HaLocationSelector extends LitElement {

@property({ attribute: false }) public selector!: LocationSelector;

@property() public value?: LocationSelectorValue;
@property({ type: Object }) public value?: LocationSelectorValue;

@property() public label?: string;

Expand Down
2 changes: 1 addition & 1 deletion src/components/ha-selector/ha-selector-target.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class HaTargetSelector extends LitElement {

@property({ attribute: false }) public selector!: TargetSelector;

@property() public value?: HassServiceTarget;
@property({ type: Object }) public value?: HassServiceTarget;

@property() public label?: string;

Expand Down
2 changes: 1 addition & 1 deletion src/components/ha-selector/ha-selector-trigger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class HaTriggerSelector extends LitElement {

@property({ attribute: false }) public selector!: TriggerSelector;

@property() public value?: Trigger;
@property({ attribute: false }) public value?: Trigger;

@property() public label?: string;

Expand Down
2 changes: 1 addition & 1 deletion src/components/ha-selector/ha-selector-ui-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export class HaSelectorUiAction extends LitElement {

@property({ attribute: false }) public selector!: UiActionSelector;

@property() public value?: ActionConfig;
@property({ attribute: false }) public value?: ActionConfig;

@property() public label?: string;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,15 @@ const preventDefault = (ev) => ev.preventDefault();
export default class HaAutomationActionRow extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;

@property() public action!: Action;
@property({ attribute: false }) public action!: Action;

@property({ type: Boolean }) public narrow = false;

@property({ type: Boolean }) public disabled = false;

@property({ type: Boolean }) public hideMenu = false;

@property() public path?: ItemPath;
@property({ type: Array }) public path?: ItemPath;

@storage({
key: "automationClipboard",
Expand Down
4 changes: 2 additions & 2 deletions src/panels/config/automation/action/ha-automation-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ export default class HaAutomationAction extends LitElement {

@property({ type: Boolean }) public disabled = false;

@property() public path?: ItemPath;
@property({ type: Array }) public path?: ItemPath;

@property() public actions!: Action[];
@property({ attribute: false }) public actions!: Action[];

@state()
@consume({ context: reorderModeContext, subscribe: true })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class HaRepeatAction extends LitElement implements ActionElement {

@property({ attribute: false }) public action!: RepeatAction;

@property() public path?: ItemPath;
@property({ type: Array }) public path?: ItemPath;

public static get defaultConfig() {
return { repeat: { count: 2, sequence: [] } };
Expand Down
4 changes: 2 additions & 2 deletions src/panels/config/automation/blueprint-automation-editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ export class HaBlueprintAutomationEditor extends ReorderModeMixin(LitElement) {

@property({ type: Boolean }) public disabled = false;

@property({ reflect: true, type: Boolean }) public narrow = false;
@property({ type: Boolean, reflect: true }) public narrow = false;

@property() public config!: BlueprintAutomationConfig;
@property({ attribute: false }) public config!: BlueprintAutomationConfig;

@property({ attribute: false }) public stateObj?: HassEntity;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default class HaAutomationConditionEditor extends LitElement {

@property({ type: Boolean }) public yamlMode = false;

@property() public path?: ItemPath;
@property({ type: Array }) public path?: ItemPath;

private _processedCondition = memoizeOne((condition) =>
expandConditionWithShorthand(condition)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ export const handleChangeEvent = (
export default class HaAutomationConditionRow extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;

@property() public condition!: Condition;
@property({ attribute: false }) public condition!: Condition;

@property({ type: Boolean }) public hideMenu = false;

@property({ type: Boolean }) public disabled = false;

@property() public path?: ItemPath;
@property({ type: Array }) public path?: ItemPath;

@storage({
key: "automationClipboard",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ import type HaAutomationConditionRow from "./ha-automation-condition-row";
export default class HaAutomationCondition extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;

@property() public conditions!: Condition[];
@property({ attribute: false }) public conditions!: Condition[];

@property({ type: Boolean }) public disabled = false;

@property() public path?: ItemPath;
@property({ type: Array }) public path?: ItemPath;

@state()
@consume({ context: reorderModeContext, subscribe: true })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export default class HaAutomationTriggerRow extends LitElement {

@property({ type: Boolean }) public disabled = false;

@property() public path?: ItemPath;
@property({ type: Array }) public path?: ItemPath;

@state() private _warnings?: string[];

Expand Down
4 changes: 2 additions & 2 deletions src/panels/config/automation/trigger/ha-automation-trigger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ import type HaAutomationTriggerRow from "./ha-automation-trigger-row";
export default class HaAutomationTrigger extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;

@property() public triggers!: Trigger[];
@property({ attribute: false }) public triggers!: Trigger[];

@property({ type: Boolean }) public disabled = false;

@property() public path?: ItemPath;
@property({ type: Array }) public path?: ItemPath;

@state()
@consume({ context: reorderModeContext, subscribe: true })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
export class HaEventTrigger extends LitElement implements TriggerElement {
@property({ attribute: false }) public hass!: HomeAssistant;

@property() public trigger!: EventTrigger;
@property({ attribute: false }) public trigger!: EventTrigger;

@property({ type: Boolean }) public disabled = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ export class HaPersistentNotificationTrigger
{
@property({ attribute: false }) public hass!: HomeAssistant;

@property() public trigger!: PersistentNotificationTrigger;
@property({ attribute: false })
public trigger!: PersistentNotificationTrigger;

@property({ type: Boolean }) public disabled = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { TriggerElement } from "../ha-automation-trigger-row";
export class HaTagTrigger extends LitElement implements TriggerElement {
@property({ attribute: false }) public hass!: HomeAssistant;

@property() public trigger!: TagTrigger;
@property({ attribute: false }) public trigger!: TagTrigger;

@property({ type: Boolean }) public disabled = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const DEFAULT_WEBHOOK_ID = "";
export class HaWebhookTrigger extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;

@property() public trigger!: WebhookTrigger;
@property({ attribute: false }) public trigger!: WebhookTrigger;

@property({ type: Boolean }) public disabled = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const includeDomains = ["zone"];
export class HaZoneTrigger extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;

@property() public trigger!: ZoneTrigger;
@property({ attribute: false }) public trigger!: ZoneTrigger;

@property({ type: Boolean }) public disabled = false;

Expand Down
2 changes: 1 addition & 1 deletion src/panels/config/cloud/account/cloud-remote-pref.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { showCloudCertificateDialog } from "../dialog-cloud-certificate/show-dia
export class CloudRemotePref extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;

@property() public cloudStatus?: CloudStatusLoggedIn;
@property({ attribute: false }) public cloudStatus?: CloudStatusLoggedIn;

protected render() {
if (!this.cloudStatus) {
Expand Down
2 changes: 1 addition & 1 deletion src/panels/config/cloud/account/cloud-tts-pref.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { showTryTtsDialog } from "./show-dialog-cloud-tts-try";
export class CloudTTSPref extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;

@property() public cloudStatus?: CloudStatusLoggedIn;
@property({ attribute: false }) public cloudStatus?: CloudStatusLoggedIn;

@state() private savingPreferences = false;

Expand Down
2 changes: 1 addition & 1 deletion src/panels/config/cloud/ha-config-cloud.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class HaConfigCloud extends HassRouterPage {

@property({ attribute: false }) public route!: Route;

@property() public cloudStatus!: CloudStatus;
@property({ attribute: false }) public cloudStatus!: CloudStatus;

protected routerOptions: RouterOptions = {
defaultPage: "login",
Expand Down
2 changes: 1 addition & 1 deletion src/panels/config/dashboard/ha-config-dashboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class HaConfigDashboard extends SubscribeMixin(LitElement) {

@property({ type: Boolean }) public isWide = false;

@property() public cloudStatus?: CloudStatus;
@property({ attribute: false }) public cloudStatus?: CloudStatus;

@property({ type: Boolean }) public showAdvanced = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { HomeAssistant } from "../../../../types";
export class HaDeviceCard extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;

@property() public device!: DeviceRegistryEntry;
@property({ attribute: false }) public device!: DeviceRegistryEntry;

@property({ type: Boolean }) public narrow = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { formatAsPaddedHex } from "../../../../integrations/integration-panels/z
export class HaDeviceInfoZha extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;

@property() public device!: DeviceRegistryEntry;
@property({ attribute: false }) public device!: DeviceRegistryEntry;

@state() private _zhaDevice?: ZHADevice;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ import { ItemSelectedEvent, SetAttributeServiceData } from "./types";
export class ZHAClusterAttributes extends LitElement {
@property({ attribute: false }) public hass?: HomeAssistant;

@property() public device?: ZHADevice;
@property({ attribute: false }) public device?: ZHADevice;

@property() public selectedCluster?: Cluster;
@property({ type: Object }) public selectedCluster?: Cluster;

@state() private _attributes: Attribute[] | undefined;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ export class ZHAClusterCommands extends LitElement {

@property({ type: Boolean }) public isWide = false;

@property() public device?: ZHADevice;
@property({ attribute: false }) public device?: ZHADevice;

@property() public selectedCluster?: Cluster;
@property({ type: Object }) public selectedCluster?: Cluster;

@state() private _commands: Command[] | undefined;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { ItemSelectedEvent } from "./types";
export class ZHADeviceBindingControl extends LitElement {
@property({ attribute: false }) public hass?: HomeAssistant;

@property() public device?: ZHADevice;
@property({ attribute: false }) public device?: ZHADevice;

@state() private _bindTargetIndex = -1;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { getIeeeTail } from "./functions";
class ZHADeviceCard extends SubscribeMixin(LitElement) {
@property({ attribute: false }) public hass!: HomeAssistant;

@property() public device?: ZHADevice;
@property({ attribute: false }) public device?: ZHADevice;

@property({ type: Boolean }) public narrow = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class ZHADeviceNeighbors extends LitElement {

@property({ type: Boolean }) public narrow = false;

@property() public device: ZHADevice | undefined;
@property({ attribute: false }) public device?: ZHADevice;

@state() private _devices: Map<string, ZHADevice> | undefined;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import "./zha-device-card";
class ZHADevicePairingStatusCard extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;

@property() public device?: ZHADevice;
@property({ attribute: false }) public device?: ZHADevice;

@property({ type: Boolean }) public narrow = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { HomeAssistant } from "../../../../../types";
class ZHADeviceZigbeeInfo extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;

@property() public device: ZHADevice | undefined;
@property({ attribute: false }) public device?: ZHADevice;

@state() private _signature: any;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import "@material/mwc-list/mwc-list-item";
export class ZHAGroupBindingControl extends LitElement {
@property({ attribute: false }) public hass?: HomeAssistant;

@property() public device?: ZHADevice;
@property({ attribute: false }) public device?: ZHADevice;

@state() private _bindTargetIndex = -1;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class ZHAManageClusters extends LitElement {

@property({ type: Boolean }) public isWide = false;

@property() public device?: ZHADevice;
@property({ attribute: false }) public device?: ZHADevice;

@state() private _selectedClusterIndex = -1;

Expand Down
Loading

0 comments on commit dcb3acc

Please sign in to comment.