Skip to content

Commit 21fbf64

Browse files
committed
fix: Send transition when IKEA bulb is turned OFF when not already OFF Koenkk/zigbee2mqtt#23825
1 parent 831dd1b commit 21fbf64

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

src/converters/toZigbee.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -1088,8 +1088,12 @@ const converters2 = {
10881088
// 'MoveToLevelWithOnOff' despite not supporting the cluster; others, like the LEDVANCE SMART+
10891089
// plug, do not.)
10901090
brightness = transition.specified || brightness === 0 ? 0 : undefined;
1091-
if (brightness !== undefined && utils.getMetaValue(entity, meta.mapped, 'noOffTransition', {atLeastOnce: true}, false)) {
1092-
logger.debug(`Supressing OFF transition since entity has noOffTransition=true`, NS);
1091+
if (
1092+
brightness !== undefined &&
1093+
meta.state.state === 'OFF' &&
1094+
utils.getMetaValue(entity, meta.mapped, 'noOffTransitionWhenOff', {atLeastOnce: true}, false)
1095+
) {
1096+
logger.debug(`Supressing OFF transition since entity is OFF and has noOffTransitionWhenOff=true`, NS);
10931097
brightness = undefined;
10941098
}
10951099
if (meta.state.brightness !== undefined && meta.state.state === 'ON') {

src/lib/ikea.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ export function ikeaLight(args?: Omit<LightArgs, 'colorTemp'> & {colorTemp?: tru
107107
// https://github.com/Koenkk/zigbee2mqtt/issues/23863
108108
result.meta = {
109109
...result.meta,
110-
noOffTransition: (entity) => {
110+
noOffTransitionWhenOff: (entity) => {
111111
const softwareBuildID = entity.getDevice().softwareBuildID;
112112
return softwareBuildID && !softwareBuildID.includes('-') && semver.gt(softwareBuildID ?? '0.0.0', '1.0.021', true);
113113
},

src/lib/types.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ export interface DefinitionMeta {
222222
/**
223223
* Never use a transition when transitioning to off (even when specified)
224224
*/
225-
noOffTransition?: boolean | ((entity: Zh.Endpoint) => boolean);
225+
noOffTransitionWhenOff?: boolean | ((entity: Zh.Endpoint) => boolean);
226226
}
227227

228228
export type Configure = (device: Zh.Device, coordinatorEndpoint: Zh.Endpoint, definition: Definition) => Promise<void>;

0 commit comments

Comments
 (0)