From 3ad2f35f29d4e409e4322446ba0c1671dfe0d421 Mon Sep 17 00:00:00 2001 From: Aarni Koskela Date: Sun, 2 Nov 2025 18:54:40 +0200 Subject: [PATCH] Add support for PM4 sensor state (#27754) --- gallery/src/pages/misc/entity-state.ts | 1 + src/common/entity/get_states.ts | 1 + src/fake_data/entity_component_icons.ts | 6 ++++++ test/common/entity/get_states.test.ts | 3 ++- 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/gallery/src/pages/misc/entity-state.ts b/gallery/src/pages/misc/entity-state.ts index 8d1fa8a020..832fdaba02 100644 --- a/gallery/src/pages/misc/entity-state.ts +++ b/gallery/src/pages/misc/entity-state.ts @@ -39,6 +39,7 @@ const SENSOR_DEVICE_CLASSES = [ "pm1", "pm10", "pm25", + "pm4", "power_factor", "power", "precipitation", diff --git a/src/common/entity/get_states.ts b/src/common/entity/get_states.ts index 9fb55b02a2..8f6f6c8fd8 100644 --- a/src/common/entity/get_states.ts +++ b/src/common/entity/get_states.ts @@ -214,6 +214,7 @@ const FIXED_DOMAIN_ATTRIBUTE_STATES = { "pm1", "pm10", "pm25", + "pm4", "power_factor", "power", "pressure", diff --git a/src/fake_data/entity_component_icons.ts b/src/fake_data/entity_component_icons.ts index ab59081d8c..2b669ca191 100644 --- a/src/fake_data/entity_component_icons.ts +++ b/src/fake_data/entity_component_icons.ts @@ -97,6 +97,9 @@ export const ENTITY_COMPONENT_ICONS: Record = { pm25: { default: "mdi:molecule", }, + pm4: { + default: "mdi:molecule", + }, power: { default: "mdi:flash", }, @@ -674,6 +677,9 @@ export const ENTITY_COMPONENT_ICONS: Record = { pm25: { default: "mdi:molecule", }, + pm4: { + default: "mdi:molecule", + }, power: { default: "mdi:flash", }, diff --git a/test/common/entity/get_states.test.ts b/test/common/entity/get_states.test.ts index ba3a8c0f71..0f3b60fd4d 100644 --- a/test/common/entity/get_states.test.ts +++ b/test/common/entity/get_states.test.ts @@ -201,6 +201,7 @@ describe("getStates", () => { "pm1", "pm10", "pm25", + "pm4", "power_factor", "power", "pressure", @@ -215,7 +216,7 @@ describe("getStates", () => { "volume_flow_rate", ]) ); - expect(result.length).toBe(34); + expect(result.length).toBe(35); }); it("should return empty array for unknown attribute", () => {