Skip to content

Commit

Permalink
fix(lightbulb): don't encode values
Browse files Browse the repository at this point in the history
  • Loading branch information
johannrichard committed Nov 28, 2020
1 parent 70e88aa commit 7292333
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/myStromLightbulbAccessory.ts
Expand Up @@ -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
Expand Down

0 comments on commit 7292333

Please sign in to comment.