mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-28 11:46:42 +00:00
Don't filter attributes when saving scene (#4278)
* Add cover attributes to scene editor * Add more * Remove filtering of attributes * Update ha-scene-editor.ts
This commit is contained in:
parent
bd5fe302eb
commit
b8a026397b
@ -18,38 +18,6 @@ export const SCENE_IGNORED_DOMAINS = [
|
|||||||
"zone",
|
"zone",
|
||||||
];
|
];
|
||||||
|
|
||||||
export const SCENE_SAVED_ATTRIBUTES = {
|
|
||||||
light: [
|
|
||||||
"brightness",
|
|
||||||
"color_temp",
|
|
||||||
"effect",
|
|
||||||
"rgb_color",
|
|
||||||
"xy_color",
|
|
||||||
"hs_color",
|
|
||||||
],
|
|
||||||
media_player: [
|
|
||||||
"is_volume_muted",
|
|
||||||
"volume_level",
|
|
||||||
"sound_mode",
|
|
||||||
"source",
|
|
||||||
"media_content_id",
|
|
||||||
"media_content_type",
|
|
||||||
],
|
|
||||||
climate: [
|
|
||||||
"target_temperature",
|
|
||||||
"target_temperature_high",
|
|
||||||
"target_temperature_low",
|
|
||||||
"target_humidity",
|
|
||||||
"fan_mode",
|
|
||||||
"swing_mode",
|
|
||||||
"hvac_mode",
|
|
||||||
"preset_mode",
|
|
||||||
],
|
|
||||||
vacuum: ["cleaning_mode"],
|
|
||||||
fan: ["speed", "current_direction"],
|
|
||||||
water_heather: ["temperature", "operation_mode"],
|
|
||||||
};
|
|
||||||
|
|
||||||
export interface SceneEntity extends HassEntityBase {
|
export interface SceneEntity extends HassEntityBase {
|
||||||
attributes: HassEntityAttributeBase & { id?: string };
|
attributes: HassEntityAttributeBase & { id?: string };
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,6 @@ import {
|
|||||||
saveScene,
|
saveScene,
|
||||||
SCENE_IGNORED_DOMAINS,
|
SCENE_IGNORED_DOMAINS,
|
||||||
SceneEntities,
|
SceneEntities,
|
||||||
SCENE_SAVED_ATTRIBUTES,
|
|
||||||
applyScene,
|
applyScene,
|
||||||
activateScene,
|
activateScene,
|
||||||
} from "../../../data/scene";
|
} from "../../../data/scene";
|
||||||
@ -617,17 +616,7 @@ export class HaSceneEditor extends SubscribeMixin(LitElement) {
|
|||||||
if (!stateObj) {
|
if (!stateObj) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const domain = computeDomain(entityId);
|
return { ...stateObj.attributes, state: stateObj.state };
|
||||||
const attributes = {};
|
|
||||||
for (const attribute in stateObj.attributes) {
|
|
||||||
if (
|
|
||||||
SCENE_SAVED_ATTRIBUTES[domain] &&
|
|
||||||
SCENE_SAVED_ATTRIBUTES[domain].includes(attribute)
|
|
||||||
) {
|
|
||||||
attributes[attribute] = stateObj.attributes[attribute];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return { ...attributes, state: stateObj.state };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async _saveScene(): Promise<void> {
|
private async _saveScene(): Promise<void> {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user