fix for dimmable ligth

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

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