Skip to content

Commit

Permalink
add resetEnergyConsumption outlet function
Browse files Browse the repository at this point in the history
  • Loading branch information
lpgera committed Oct 2, 2024
1 parent 667ede0 commit a325183
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -350,13 +350,17 @@ await client.outlets.setStartupOnOff({

await client.outlet.setStatusLight({
id: 'YOUR_DEVICE_ID',
statusLight: false,
statusLight: true, // true disables the status light, false enables it ¯\_(ツ)_/¯

This comment has been minimized.

Copy link
@reneroth

reneroth Oct 9, 2024

FUCK this was driving me insane when I tried reverse engineering the api myself 😀 thanks for noticing and fixing/documenting!! should've just used your lib from the beginning

This comment has been minimized.

Copy link
@lpgera

lpgera Oct 9, 2024

Author Owner

Yeah, I was lucky I discovered this quite quickly once I had a device in my hands. 😅 I don't know the reason for the backward logic though, I couldn't find an explanation so far.

I'm happy that my library helps you!

})

await client.outlet.setChildLock({
id: 'YOUR_DEVICE_ID',
childLock: true,
})

await client.outlet.resetEnergyConsumption({
id: 'YOUR_DEVICE_ID',
})
```

#### [Open/close sensors](./src/api/openCloseSensors.ts)
Expand Down
14 changes: 14 additions & 0 deletions src/api/outlets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,19 @@ export default (got: Got) => {
})
.json()
},

async resetEnergyConsumption({ id }: { id: string }) {
await got
.patch(`devices/${id}`, {
json: [
{
attributes: {
energyConsumedAtLastReset: 0,
},
},
],
})
.json()
},
}
}

0 comments on commit a325183

Please sign in to comment.