Apollon77 / daikin-controller-cloud

Connect and Control Daikin Cloud devices
MIT License
96 stars 26 forks source link

Error when trying to set data on a cached class #145

Closed ThibautTrarbach closed 1 week ago

ThibautTrarbach commented 1 week ago

Describe the bug
Hello, To greatly reduce the number of requests needed to use the API. I would like to cache my Daikin device classes to use them within a certain time limit.

However I receive several errors because it does not cache private variables and functions. Which prevents me from caching the devices and therefore reducing the number of calls to the API.

To Reproduce
Steps to reproduce the behavior: Cache the class in a lib like cache-manager or node-cache. Then retrieved this cache and wanted to send an action on the devices.

Expected behavior
I would like to be able to use my cached class to send new actions to the cloud. And this without having to make a request to have to request all the devices from the cloud

Screenshots & Logfiles
`node_modules\daikin-controller-cloud\dist\device.js:212 this.#validateData(dataPointDef, value); ^

TypeError: Receiver must be an instance of class DaikinCloudDevice at DaikinCloudDevice.setData (node_modules\daikin-controller-cloud\dist\device.js:212:14) at validateData (build\modules\gateway\BaseModules.js:136:18) at build\modules\gateway\BaseModules.js:108:21 at Array.forEach () at updateDaikinDevice (build\modules\gateway\BaseModules.js:100:26) at eventValue (build\modules\gateway\BaseModules.js:96:11) at MqttClient. (build\modules\daikin.js:74:48) at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Node.js v22.2.0 error Command failed with exit code 1. `

Versions:

ThibautTrarbach commented 1 week ago

Sorry, I just realized that I wanted to modify my code to support it