Apollon77 / daikin-controller-cloud

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

Question #70

Closed MichB2 closed 2 years ago

MichB2 commented 2 years ago

Hi

i would like to use daikin-controller-cloud with ip-symcon i installed your devlopment on a linux sytem:

with you example file i can remotly change some of the parameters.

       await dev.setData('gateway', 'ledEnabled', true);
      await dev.setData('climateControl', 'onOffMode', 'on');
      await dev.setData('climateControl', 'temperatureControl', '/operationModes/auto/setpoints/roomTemperature', 20);
      await dev.updateData();

This seems to work fine now i tried on my own add some commands like this

         await dev.setData('operationMode', 'fanOnly');

but i get an error message TypeError: Cannot read properties of undefined (reading 'fanOnly') at DaikinCloudDevice.setData (/opt/Daikin/node_modules/daikin-controller-cloud/lib/device.js:212:52) at main (/opt/Daikin/node_modules/daikin-controller-cloud/example/example.js:89:24) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async /opt/Daikin/node_modules/daikin-controller-cloud/example/example.js:105:5

do i something wrong or is it normal that this dont work

Thank you very much in advanced.

regards

Apollon77 commented 2 years ago

In fact call "getData()" and print the JSON structure ... in fact the colmmands follow exactly that structure

In a evice of mine it would be

setData('climateControl', 'operationMode', 'fanOnly')

In fact you need to provide at least two parameters plus value ... sometimes also a thuird parametr and then value

Next version will prevent the crash :-)

MichB2 commented 2 years ago

Great thank you very much it works :-)

MichB2 commented 2 years ago

Hello,

Sorry I have another question if I run the example file I get the values on all the devices how to say just update on of them ?

Thank you

Apollon77 commented 2 years ago

I did not had time to really figure out how this could be done with the API (hence no time), so right now you can only reload the full device ... but effectively this also makes sense in some cases because e.g. when turning the device on several opther states also change their values like the temperature sensors

Apollon77 commented 2 years ago

Ahhh ok stop ... dev.updateData() is your friend ... I thought you mean to update just one datapoint

MichB2 commented 2 years ago

i have 4 devices Living room Kids 1 Kids 2 Bedroom

my question is how to identify the device which is in the living room and just send the new parameters only to this device. Is that possible?

Apollon77 commented 2 years ago

https://github.com/Apollon77/daikin-controller-cloud/blob/main/example/example.js#L81

Apollon77 commented 2 years ago

devices is an array of device objects. each represent one device with getId() and updateData() which then only is done on this device

MichB2 commented 2 years ago

Thank you for your help I am novice in programming .... i tried to find out but i don t know how to do :-( can you show me an example please?

Apollon77 commented 2 years ago

XYou run example.js.... right?? it is exactly in there that way variable "dev" is the device object ... "dev.updateData()" will update it

MichB2 commented 2 years ago

yes i run example.js dev.updateData() update all units not just one of them

Apollon77 commented 2 years ago

No, this can't be ... ok IF you put a dev.UupdateData() in that loop over all devices then yes it will be that way because all are updated after each other.

So in fact you get an array with devices back as getCloudDevices(). So if you only want to have one you need to find this device, e.g.

const myDevice = devices.find(dev => return dev.getId() === 'the-deviceid-you-need');
myDevice.updateData();