From 729233300c7e904cca6ae67c8fd76c18a098031c Mon Sep 17 00:00:00 2001 From: Johann Richard <189003+johannrichard@users.noreply.github.com> Date: Sat, 28 Nov 2020 14:38:20 +0100 Subject: [PATCH] fix(lightbulb): don't encode values --- src/myStromLightbulbAccessory.ts | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/myStromLightbulbAccessory.ts b/src/myStromLightbulbAccessory.ts index 2957d80..cffb9dc 100644 --- a/src/myStromLightbulbAccessory.ts +++ b/src/myStromLightbulbAccessory.ts @@ -212,15 +212,16 @@ export class MyStromLightbulbAccessory extends DingzDaBaseAccessory { const color = `${state.hue};${state.saturation};${state.value}`; const setDimmerUrl = `${this.baseUrl}/api/v1/device/${this.device.mac}`; + const data = qs.stringify( + { + action: state.on ? 'on' : 'off', + color: color ?? undefined, + mode: color ? 'hsv' : undefined, + }, + { encode: false }, + ); return this.request - .post( - setDimmerUrl, - qs.stringify({ - action: state.on ? 'on' : 'off', - color: color ?? undefined, - mode: color ? 'hsv' : undefined, - }), - ) + .post(setDimmerUrl, data) .catch(this.handleRequestErrors.bind(this)) .finally(() => { // make sure we callback