From f354e1eb0f7d673ea7fb95c1b4c012b843c2276e Mon Sep 17 00:00:00 2001 From: Robert Chmielowiec Date: Thu, 28 May 2020 16:24:22 +0200 Subject: [PATCH] Invert whitelist logic in deviceAutomationsEqual (#6032) --- src/data/device_automation.ts | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/data/device_automation.ts b/src/data/device_automation.ts index 03c58c36c1..38b808fd3b 100644 --- a/src/data/device_automation.ts +++ b/src/data/device_automation.ts @@ -65,14 +65,15 @@ export const fetchDeviceTriggerCapabilities = ( trigger, }); -const whitelist = [ - "above", - "below", - "brightness_pct", - "code", - "for", - "position", - "set_brightness", +const deviceAutomationIdentifiers = [ + "device_id", + "domain", + "entity_id", + "type", + "subtype", + "event", + "condition", + "platform", ]; export const deviceAutomationsEqual = ( @@ -84,7 +85,7 @@ export const deviceAutomationsEqual = ( } for (const property in a) { - if (whitelist.includes(property)) { + if (!deviceAutomationIdentifiers.includes(property)) { continue; } if (!Object.is(a[property], b[property])) { @@ -92,7 +93,7 @@ export const deviceAutomationsEqual = ( } } for (const property in b) { - if (whitelist.includes(property)) { + if (!deviceAutomationIdentifiers.includes(property)) { continue; } if (!Object.is(a[property], b[property])) {