zwave-js / zwave-js-ui

Full featured Z-Wave Control Panel UI and MQTT gateway. Built using Nodejs, and Vue/Vuetify
https://zwave-js.github.io/zwave-js-ui
MIT License
988 stars 206 forks source link

Lock Schedule Cache isn't being read correctly #3159

Closed kdknigga closed 1 year ago

kdknigga commented 1 year ago

Is your problem within Home Assistant (Core or Z-Wave JS Integration)?

NO, my problem is NOT within Home Assistant or the ZWave JS integration

Is your problem within Z-Wave JS UI (formerly ZwaveJS2MQTT)?

YES, BUT a Z-Wave JS UI developer has told me to come here

Checklist

Describe the bug

Refreshing a node's lock schedule from cache loads nothing.

Peek 2023-05-19 13-55

What did you expect to happen? I expected to see the schedule I had created.

Device information

Manufacturer: Model name: Node ID in your network:

How are you using node-zwave-js?

Which branches or versions?

version: zwave-js-ui: 8.16.1 zwave-js: 10.20.0

Did you change anything?

no

If yes, what did you change?

No response

Did this work before?

Don't know, this is a new device

If yes, where did it work?

No response

Attach Driver Logfile

zwavejs_2023-05-19.log

AlCalzone commented 1 year ago

I finally had the possibility to debug this again - and I think this is a UI issue. If I query the cached information using a driver function, I do get the correct values:

2023-07-10 11:21:28.607 DEBUG SOCKET: Event ZWAVE_API emitted to pyddaTiXAJ-G7uIAAAAB
2023-07-10 11:21:28.611 INFO Z-WAVE: Calling api driverFunction with args: [
  'const {require} = this;\n' +
    'const {ScheduleEntryLockCC} = require("zwave-js");\n' +
    'const node = driver.controller.nodes.get(2);\n' +
    'const enabled = ScheduleEntryLockCC.getUserCodeScheduleEnabledCached(\n' +
    '  driver,\n' +
    '  node,\n' +
    '  1\n' +
    ');\n' +
    '\n' +
    'console.log("enabled:", enabled);',
  [length]: 1
]

enabled: true

2023-07-10 11:21:28.612 INFO Z-WAVE: Success zwave api call driverFunction undefined
2023-07-10 11:21:58.573 DEBUG SOCKET: Event ZWAVE_API emitted to pyddaTiXAJ-G7uIAAAAB
2023-07-10 11:21:58.575 INFO Z-WAVE: Calling api driverFunction with args: [
  'const {require} = this;\n' +
    'const {ScheduleEntryLockCC} = require("zwave-js");\n' +
    'const node = driver.controller.nodes.get(2);\n' +
    'const kind = ScheduleEntryLockCC.getUserCodeScheduleKindCached(\n' +
    '  driver,\n' +
    '  node,\n' +
    '  1\n' +
    ');\n' +
    '\n' +
    'console.log("kind:", kind);',
  [length]: 1
]

kind: 2

2023-07-10 11:21:58.577 INFO Z-WAVE: Success zwave api call driverFunction undefined
023-07-10 11:22:35.411 DEBUG SOCKET: Event ZWAVE_API emitted to pyddaTiXAJ-G7uIAAAAB
2023-07-10 11:22:35.413 INFO Z-WAVE: Calling api driverFunction with args: [
  'const {require} = this;\n' +
    'const {ScheduleEntryLockCC} = require("zwave-js");\n' +
    'const node = driver.controller.nodes.get(2);\n' +
    'const schedule = ScheduleEntryLockCC.getScheduleCached(\n' +
    '  driver,\n' +
    '  node,\n' +
    '  2,\n' +
    '  1,\n' +
    '  1\n' +
    ');\n' +
    '\n' +
    'console.log("schedule:", schedule);',
  [length]: 1
]

schedule: {
  weekdays: [ 0, 6 ],
  startHour: 2,
  startMinute: 0,
  durationHour: 4,
  durationMinute: 0
}

2023-07-10 11:22:35.417 INFO Z-WAVE: Success zwave api call driverFunction undefined
2023-07-10 11:25:47.699 DEBUG SOCKET: Event ZWAVE_API emitted to pyddaTiXAJ-G7uIAAAAB
2023-07-10 11:25:47.701 INFO Z-WAVE: Calling api driverFunction with args: [
  'const {require} = this;\n' +
    'const {ScheduleEntryLockCC} = require("zwave-js");\n' +
    'const node = driver.controller.nodes.get(2);\n' +
    'const numSlots = ScheduleEntryLockCC.getNumDailyRepeatingSlotsCached(\n' +
    '  driver,\n' +
    '  node\n' +
    ');\n' +
    '\n' +
    'console.log("numSlots:", numSlots);',
  [length]: 1
]

numSlots: 20

The UI however does not show this: grafik

AlCalzone commented 1 year ago

Update: The information does get requested:

2023-07-10 12:12:18.548 INFO Z-WAVE: Calling api getSchedules with args: [ 2, { mode: 'daily', fromCache: false }, [length]: 2 ]
2023-07-10 12:12:21.028 INFO Z-WAVE: Success zwave api call getSchedules {
  daily: {
    numSlots: 1,
    slots: [
      {
        userId: 1,
        slotId: 1,
        weekdays: [ 0, 6, [length]: 2 ],
        startHour: 2,
        startMinute: 0,
        durationHour: 4,
        durationMinute: 0,
        enabled: false
      },
      [length]: 1
    ]
  },
  weekly: { numSlots: 0, slots: [ [length]: 0 ] },
  yearly: { numSlots: 0, slots: [ [length]: 0 ] }
}

but it still isn't shown: grafik

AlCalzone commented 1 year ago

Another update: After reloading the entire page, the information is now there: grafik

AlCalzone commented 1 year ago

The enabled state isn't correct though, even after pressing "ENABLE" a few times. The information from cache is correct:

2023-07-10 12:16:52.417 INFO Z-WAVE: Calling api driverFunction with args: [
  'const { logger, zwaveClient, require } = this\n' +
    'const {ScheduleEntryLockCC} = require("zwave-js");\n' +
    'const node = driver.controller.nodes.get(2);\n' +
    'const enabled = ScheduleEntryLockCC.getUserCodeScheduleEnabledCached(\n' +
    '  driver, node, 1\n' +
    ');\n' +
    'console.log("enabled:", enabled);',
  [length]: 1
]

enabled: true

but the UI doesn't think so: grafik