From 031d729af07ec3a677b2a841fda4443d43c36c92 Mon Sep 17 00:00:00 2001 From: Jatus Date: Tue, 30 Jan 2024 15:37:57 +0100 Subject: [PATCH] fix for dimmable ligth --- matter-bridge/config.yml | 2 +- .../src/mapper/devices/lights/DimmableLightDevice.ts | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/matter-bridge/config.yml b/matter-bridge/config.yml index 87de988..ec4faba 100644 --- a/matter-bridge/config.yml +++ b/matter-bridge/config.yml @@ -1,6 +1,6 @@ --- name: 'HA Matter Bridge' -version: '0.0.2-alpha' +version: '0.0.3-alpha' slug: ha-matter-bridge description: This project serves as a proof of concept to connect HomeAssistant devices to Voice Assistants through the Matter Protocol. init: false diff --git a/matter-bridge/src/mapper/devices/lights/DimmableLightDevice.ts b/matter-bridge/src/mapper/devices/lights/DimmableLightDevice.ts index 1412828..45e1214 100644 --- a/matter-bridge/src/mapper/devices/lights/DimmableLightDevice.ts +++ b/matter-bridge/src/mapper/devices/lights/DimmableLightDevice.ts @@ -56,10 +56,14 @@ export const addDimmableLightDevice: AddHaDeviceToBridge = ( LOGGER.debug( `CurrentLevel Event for device ${haEntity.entity_id} value: ${value}` ); + let extraArgs = { entity_id: haEntity.entity_id } as object; + if (Number(value) > 0) { + extraArgs = { ...extraArgs, brightness: Number(value) }; + } haMiddleware.callAService( 'light', Number(value) > 0 ? 'turn_on' : 'turn_off', - { entity_id: haEntity.entity_id, brightness: Number(value) } + extraArgs ); });