donavanbecker / homebridge-meater

The Homebridge Meater plugin allows you to access your Meater Device(s) from HomeKit with Homebridge.
https://meater.com
ISC License
5 stars 0 forks source link

Bug: Plugin not saving data retrieved from the API to the config #12

Closed asclepiadae closed 2 weeks ago

asclepiadae commented 1 month ago

Describe the Bug

The plugin does not save to the config when after connecting to the API

iOS app v4.3.1 (found under main screen > meatballs menu > "My Connections") on iOS 17.5.1 Plugin v1.1.2-beta.0 Homebridge v1.8.4 with NodeJS v20.10.0

To Reproduce

  1. Install plugin, enter username & password in provided config fields
  2. Using app, have Meater probe connected in cook mode
  3. Save plugin config and restart bridge/child bridge
  4. The API token appears in the logs in DEBUG mode, but is not written to the config
  5. Manually copying the token to the config and then restarting the bridge then allows the plugin to get the device IDs, but again they are not saved to the config.

Expected Behavior

  1. The plugin posts the username and password to the API
  2. The API key is retrieved, and saved to the plugin config
  3. The API key is used to retrieve the currently connected device IDs
  4. The device IDs are saved to the plugin config

Relevant Log Output

-------------------------[Connecting to API with username/password]-------------------------
26/07/2024, 20:48:11] [Meater] Launched child bridge with PID 527
[26/07/2024, 20:48:12] [Meater] Loaded homebridge-meater v1.1.2-beta.0 child bridge successfully
[26/07/2024, 20:48:12] [Meater] [DEBUG] Finished initializing platform: Meater
[26/07/2024, 20:48:12] [Meater] [DEBUG] Executed didFinishLaunching callback
[26/07/2024, 20:48:12] [Meater] [DEBUG] Config OK
[26/07/2024, 20:48:12] [Meater] [DEBUG] Using Config Logging: debug
[26/07/2024, 20:48:12] [Meater] [DEBUG] statusCode: 200
[26/07/2024, 20:48:12] [Meater] [DEBUG] Login: {"status":"OK","statusCode":200,"data":{"token":"HEYLOOKITSTHETOKENIVEJUSTERASEDIT","userId":"ANOTHERIDIVEREMOVED"},"meta":{}}
[26/07/2024, 20:48:12] [Meater] [DEBUG] Login Token: "HEYLOOKITSTHETOKENIVEJUSTERASEDIT"
[26/07/2024, 20:48:12] [Meater] [DEBUG] Login StatusCode: 200
[26/07/2024, 20:48:12] [Meater] Update Token: Error: New token not provided
[26/07/2024, 20:48:12] [Meater] [DEBUG] statusCode: 200 & devicesAPI StatusCode: 200
[26/07/2024, 20:48:12] [Meater] [DEBUG] Device statusCode: 401
[26/07/2024, 20:48:12] [Meater] [DEBUG] Device: {"status":"Unauthorized","statusCode":401,"message":"","help":"https://github.com/apption-labs/meater-cloud-public-rest-api"}
[26/07/2024, 20:48:12] [Meater] [DEBUG] Device StatusCode: 401
[26/07/2024, 20:48:12] [Meater] Unauthorized, statusCode: 401
[26/07/2024, 20:48:12] [Meater] Unauthorized, statusCode: 401

-------------------------[After manually copying the API token to plugin config]-------------------------
[26/07/2024, 21:04:39] [Meater] Launched child bridge with PID 1120
[26/07/2024, 21:04:40] Registering platform 'homebridge-meater.Meater'
[26/07/2024, 21:04:40] [Meater] Loaded homebridge-meater v1.1.2-beta.0 child bridge successfully
[26/07/2024, 21:04:40] Loaded 0 cached accessories from cachedAccessories.0E78D797B899.
[26/07/2024, 21:04:41] [Meater] [DEBUG] Finished initializing platform: Meater
[26/07/2024, 21:04:41] [Meater] [DEBUG] Executed didFinishLaunching callback
[26/07/2024, 21:04:41] [Meater] [DEBUG] Config OK
[26/07/2024, 21:04:41] [Meater] [DEBUG] Using Config Logging: debug
[26/07/2024, 21:04:41] [Meater] [DEBUG] Device statusCode: 200
[26/07/2024, 21:04:41] [Meater] [DEBUG] Device: {"status":"OK","statusCode":200,"data":{"devices":[{"id":"ITSADEVICEIDTHATIVEERASED","temperature":{"internal":79,"ambient":115},"cook":{"id":"IGUESSTHISISACTUALLYTHEIDFORTHECOOKSESSION","name":"Whole Chicken","state":"Ready For Resting","temperature":{"target":75,"peak":79},"time":{"elapsed":3883,"remaining":315}},"updated_at":1722049449}]},"meta":{}}
[26/07/2024, 21:04:41] [Meater] [DEBUG] Device StatusCode: 200
[26/07/2024, 21:04:41] [Meater] Found 1 Devices
[26/07/2024, 21:04:41] [Meater] [DEBUG] No Meater Device Config: undefined
[26/07/2024, 21:04:41] [Meater] [DEBUG] Plugin Version: 1.1.2-beta.0
[Meater Thermometer (e1a6)@@Hardware Revision] characteristic value expected string and received undefined
[Meater Thermometer (e1a6)@@Firmware Revision] characteristic value expected string and received undefined
[26/07/2024, 21:04:41] [Meater] Adding new accessory, Meater: Meater Thermometer (e1a6), id: e1a6e37355afa10e5f2da1de2cc5874a94580e04029f4f42ccffb0d8bcc892ab
[26/07/2024, 21:04:41] [Meater] [DEBUG] Meater Thermometer (e1a6) Using Platform Config Logging: debug
[26/07/2024, 21:04:41] [Meater] [DEBUG] Meater Thermometer (e1a6) Using Default refreshRate: 1800
[26/07/2024, 21:04:41] [Meater] [DEBUG] Plugin Version: 1.1.2-beta.0
[26/07/2024, 21:04:41] [Meater] [DEBUG] Meater Thermometer (e1a6) Meater Thermometer (e1a6) Internal Temperature Service
[26/07/2024, 21:04:41] [Meater] [DEBUG] Meater Thermometer (e1a6) Meater Thermometer (e1a6) Ambient Temperature Service
[26/07/2024, 21:04:41] [Meater] Failed to Discover Devices, Error Message: "Cannot read properties of undefined (reading 'setCharacteristic')", Submit Bugs Here: https://bit.ly/homebridge-meater-bug-report
[26/07/2024, 21:04:41] [Meater] Failed to Discover Devices, Error: TypeError: Cannot read properties of undefined (reading 'setCharacteristic')

-------------------------[After manually copying the device ID to plugin config]-------------------------
[26/07/2024, 21:13:44] [Meater] Launched child bridge with PID 1386
[26/07/2024, 21:13:45] Registering platform 'homebridge-meater.Meater'
[26/07/2024, 21:13:45] [Meater] Loaded homebridge-meater v1.1.2-beta.0 child bridge successfully
[26/07/2024, 21:13:45] Loaded 0 cached accessories from cachedAccessories.0E78D797B899.
[26/07/2024, 21:13:46] [Meater] [DEBUG] Finished initializing platform: Meater
[26/07/2024, 21:13:46] [Meater] [DEBUG] Executed didFinishLaunching callback
[26/07/2024, 21:13:46] [Meater] [DEBUG] Config OK
[26/07/2024, 21:13:46] [Meater] [DEBUG] Using Config Logging: debug
[26/07/2024, 21:13:46] [Meater] [DEBUG] Device statusCode: 200
[26/07/2024, 21:13:46] [Meater] [DEBUG] Device: {"status":"OK","statusCode":200,"data":{"devices":[{"id":"ITSADEVICEIDTHATIVEERASED","temperature":{"internal":28.1,"ambient":35.2},"cook":null,"updated_at":1722050021}]},"meta":{}}
[26/07/2024, 21:13:46] [Meater] [DEBUG] Device StatusCode: 200
[26/07/2024, 21:13:46] [Meater] Found 1 Devices
[26/07/2024, 21:13:46] [Meater] [DEBUG] Meater Device Config Set: [{"id":"ITSADEVICEIDTHATIVEERASED","configDeviceName":"Meater+"}]
[26/07/2024, 21:13:46] [Meater] [DEBUG] Meater Devices: [{"id":"ITSADEVICEIDTHATIVEERASED","configDeviceName":"Meater+","temperature":{"internal":28.1,"ambient":35.2},"cook":null,"updated_at":1722050021}]
[26/07/2024, 21:13:46] [Meater] [DEBUG] Plugin Version: 1.1.2-beta.0
[Meater+@@Hardware Revision] characteristic value expected string and received undefined
[Meater+@@Firmware Revision] characteristic value expected string and received undefined
[26/07/2024, 21:13:46] [Meater] Adding new accessory, Meater: Meater+, id: ITSADEVICEIDTHATIVEERASED
[26/07/2024, 21:13:46] [Meater] [DEBUG] Meater+ Using Platform Config Logging: debug
[26/07/2024, 21:13:46] [Meater] [DEBUG] Meater+ Using Default refreshRate: 1800
[26/07/2024, 21:13:46] [Meater] [DEBUG] Plugin Version: 1.1.2-beta.0
[26/07/2024, 21:13:46] [Meater] [DEBUG] Meater+ Meater+ Internal Temperature Service
[26/07/2024, 21:13:46] [Meater] [DEBUG] Meater+ Meater+ Ambient Temperature Service
[26/07/2024, 21:13:46] [Meater] Failed to Discover Devices, Error Message: "Cannot read properties of undefined (reading 'setCharacteristic')", Submit Bugs Here: https://bit.ly/homebridge-meater-bug-report
[26/07/2024, 21:13:46] [Meater] Failed to Discover Devices, Error: TypeError: Cannot read properties of undefined (reading 'setCharacteristic')

Config for homebridge-meater

-------------------------[After manually copying token and ID from DEBUG logs]-------------------------
{
    "name": "Meater",
    "credentials": {
        "email": "notgonnagiveitout",
        "password": "notgonnaletyouknow",
        "token": "",
        "notice": "Keep your tokens a secret!"
    },
    "options": {
        "devices": [
            {
                "id": "nevergonnatellyouthis",
                "configDeviceName": "Meater+"
            }
        ],
        "logging": "debug"
    },
    "_bridge": {
        "username": "00:00:00:00:00:00"
    },
    "platform": "Meater"
}

Screenshots

No response

Device and Model

iOS app v4.3.1

Node.js Version

v20.10.0

Homebridge Version

v1.8.4

Homebridge Meater Plugin Version

v1.1.2-beta.0

Homebridge UI Version

v4.56.5-beta.20

Operating System

Raspbian GNU/Linux Bullseye (11)

asclepiadae commented 1 month ago

This is connected to #11 - enabling DEBUG allowed me to see that the API token (and later the device ID) was being retrieved, just not saved to the config.

donavanbecker commented 1 month ago

Can you try the latest beta:

npm version

Click here to find out how to install Beta

asclepiadae commented 1 month ago

I'll see if I get a chance to try this tonight - if not, I'm away from home for a few days and won't be able to test until Thursday.

github-actions[bot] commented 3 weeks ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] commented 2 weeks ago

This issue has been closed as no further activity has occurred.