fjs21 / homebridge-kumo

Control your Kumo cloud devices using Homebridge.
https://www.npmjs.com/package/homebridge-kumo
Apache License 2.0
35 stars 8 forks source link

Number of devices found: 0 #8

Closed staxmood closed 3 years ago

staxmood commented 3 years ago

Hi there,

I'm submitting an issue similar to a pervious closed one but unsure of the issue. I'm running v1.2.1 but am receiving the 0 devices found error but running two devices within the account. My debug log is below with a couple of redacted lines indicated by "-". Any thoughts on what could be going on would be greatly appreciated.

[9/26/2020, 12:42:20] [Kumo] [ { device: null, token: '-----------------------------', username: '-------------------------' }, { lastUpdate: 1601133007057, sendAnalytics: 1 }, { children: [ { '$$hashKey': 'object:651', children: [ { '$$hashKey': 'object:1131', children: [], id: '1601133489008-1466128932', isSystemChangeoverGroup: true, label: 'Sunroom', lastScheduleChange: 0, lastUpdate: 1601137281065, level: 3, reportedCondition: [Object], zoneTable: [Object] } ], id: '1601133295148-436628055', label: 'Home', lastScheduleChange: 0, lastUpdate: 1601137248705, level: 2, network: { name: '----------', password: '' }, reportedCondition: { _created: 1601134479756, more: {}, operation_mode: 3, power: 1 }, zoneTable: {} } ], id: '1601133007051-2072407725', label: 'Home', lastScheduleChange: 0, lastUpdate: 1601224939922, level: 1, version: 31, zoneTable: {} }, 'no device token' ] [9/26/2020, 12:42:20] [Kumo] Kumo API: Successfully connected to the Kumo API. [9/26/2020, 12:42:20] [Kumo] Number of devices found: 0 [9/26/2020, 12:42:20] [Kumo] Token: --------------------------- INFO: INFO: Your plugin version is up-to-date

fjs21 commented 3 years ago

I'll take a look.

fjs21 commented 3 years ago

So this is the code that searches for the devices in the JSON response you got.

for (const child of data[2].children) {
        const zoneTable = child.zoneTable;
        for (const serial in zoneTable) {
          this.log.debug(`Serial: ${serial}`);
          this.log.debug(`Label: ${zoneTable[serial].label}`);
          const device = {
            serial: serial,
            label: zoneTable[serial].label,
            zoneTable: zoneTable[serial],
          };
          this.devices.push(device);
        }
      }  
fjs21 commented 3 years ago

Looks like your info is nested in another "children" level. I'll need to rewrite this code to allow both formats to work. Shouldn't be too hard but I will need your help to debug.

fjs21 commented 3 years ago

Please try v1.2.3 this has modified code to recursively look 'children' through for 'zoneTable' (i.e. devices). Hopefully should work on your devices. Let me know. I'll close this issue for now but please reopen if you still have issues.

staxmood commented 3 years ago

Just got a chance to update to v1.2.4. No change as of yet with the amount of devices available.

Providing a current debug to hopefully help.

[10/3/2020, 13:05:20] [Kumo] [ { device: null, token: '---------', username: '---------' }, { lastUpdate: 1601133007057, sendAnalytics: 1 }, { children: [ { '$$hashKey': 'object:651', children: [ { '$$hashKey': 'object:1131', children: [], id: '---------', isSystemChangeoverGroup: true, label: 'Sunroom', lastScheduleChange: 0, lastUpdate: 1601137281065, level: 3, reportedCondition: [Object], zoneTable: [Object] } ], id: '---------', label: 'Home', lastScheduleChange: 0, lastUpdate: 1601137248705, level: 2, network: { name: '---------', password: '' }, program: { deactivated: null, events: [ [Object], [Object] ] }, reportedCondition: { _created: 1601729266225, air_direction: 7, fan_speed: 0, more: {}, operation_mode: 1, power: 1, sp_heat: 22 }, zoneTable: {} } ], id: '---------', label: 'Home', lastScheduleChange: 0, lastUpdate: 1601831120483, level: 1, version: 67, zoneTable: {} }, 'no device token' ] [10/3/2020, 13:05:20] [Kumo] Kumo API: Successfully connected to the Kumo API. [10/3/2020, 13:05:20] [Kumo] Parsing child: { lastScheduleChange: 0, zoneTable: {}, children: [Array], level: 2, label: 'Home', id: '---------', lastUpdate: 1601137248705, network: [Object], reportedCondition: [Object], '$$hashKey': 'object:651', program: [Object] } [10/3/2020, 13:05:20] [Kumo] Parsing child: [ [Object] ] [10/3/2020, 13:05:20] [Kumo] Number of devices found: 0 [10/3/2020, 13:05:20] [Kumo] Token: ---------

fjs21 commented 3 years ago

I found a bug in the code I had added to parse devices nested inside the "children". Please could you try v1.2.5 which I think should resolve this issue. If you have any issues, please post the results of your log (the same parts as above). I will close for now.