Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chiptool temp sensor UI stops updating proper temperature values even when reports are being sent properly #16198

Closed
vinay-apple opened this issue Mar 14, 2022 · 1 comment · Fixed by #16253

Comments

@vinay-apple
Copy link

Problem

Chiptool temp sensor UI stops updating proper temperature values even when reports are being sent properly

SHA: d86a7d4

Steps to reproduce

  1. Pair M5 with chip tool and verify toggle light works.
  2. Go to temperature sensor and setup reporting with Min: 1s, Max: 2s, Delta 1 deg and send reporting settings.
  3. Verify reporting works correctly and changing temp values on M5 are correctly reflected.
  4. Exit the temp sensor screen and come back into temp sensor screen.
  5. Change temp values on M5 board and see that proper temp values are not being reflected on the UI, shows stale value.

on chip tool logs we see reports for 40 deg C which is what M5 is set to, but the UI shows 33 deg C, see screenshot.

2022-03-14 13:14:59.461601-0700 localhost CHIPTool[1741]: Status: Updated temp in UI to 40 °C
2022-03-14 13:14:59.572229-0700 localhost CHIPTool[1741]: (CHIP) [com.zigbee.chip:all] � [1647288899572] [1741:53443] CHIP: [EM] Received message of type 0x10 with protocolId (0, 0) and MessageCounter:8364337 on exchange 30862r
2022-03-14 13:14:59.572445-0700 localhost CHIPTool[1741]: (CHIP) [com.zigbee.chip:all] � [1647288899572] [1741:53443] CHIP: [EM] Found matching exchange: 30862r, Delegate: 0x0
2022-03-14 13:14:59.572684-0700 localhost CHIPTool[1741]: (CHIP) [com.zigbee.chip:all] � [1647288899572] [1741:53443] CHIP: [EM] Rxd Ack; Removing MessageCounter:8373832 from Retrans Table on exchange 30862r
2022-03-14 13:14:59.572818-0700 localhost CHIPTool[1741]: (CHIP) [com.zigbee.chip:all] � [1647288899572] [1741:53443] CHIP: [EM] Removed CHIP MessageCounter

chiptool-logs-temp-sensor-UI-stops-updating.txt
chiptool-temp-sensor-UI-stops-updating
M5-logs-temp-sensor-UI-stops-updating.txt

@bzbarsky-apple
Copy link
Contributor

The relevant code in the temperature controller is:

                [chipDevice subscribeWithQueue:dispatch_get_main_queue()
                                   minInterval:minIntervalSeconds
                                   maxInterval:maxIntervalSeconds
                                 reportHandler:^(NSArray<CHIPAttributeReport *> * _Nullable reports, NSError * _Nullable error) {
...
                                                 [self updateTempInUI:((NSNumber *) report.value).shortValue];

where self is the TemperatureSensorViewController instance.

But every time we load the temp sensor screen that creates a new TemperatureSensorViewController. So the reports are being delivered, we are calling updateTempInUI on the TemperatureSensorViewController instance that was being shown when we set up the subscription, and it's updating its state, but it's not bound to the view we're actually showing.

If we want this to work, we could probably fix this code to call some class-static thing on TemperatureSensorViewController to get the current one instead of using self.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants