fix for dimmable ligth

This commit is contained in:
Jatus 2024-01-30 15:37:57 +01:00
parent fa3cd39674
commit 031d729af0
2 changed files with 6 additions and 2 deletions

View File

@ -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

View File

@ -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
);
});