robinjhector / homebridge-tibber-price

Homebridge plugin for tibber price data
Apache License 2.0
7 stars 1 forks source link

Unhandled error thrown inside read handler #29

Closed osthoren closed 1 year ago

osthoren commented 2 years ago

Hi, I got this error after the update of version v1.0.2, and it was working flawlessly before that.

[11/16/2022, 1:20:20 PM] [homebridge-tibber-price] This plugin threw an error from the characteristic 'Current Ambient Light Level': Unhandled error thrown inside read handler for characteristic: undefined. See https://homebridge.io/w/JtMGR for more info. [11/16/2022, 1:20:20 PM] [homebridge-tibber-price] This plugin threw an error from the characteristic 'Current Relative Humidity': Unhandled error thrown inside read handler for characteristic: undefined. See https://homebridge.io/w/JtMGR for more info.

Full log: [11/16/2022, 1:23:52 PM] Homebridge v1.5.1 (HAP v0.10.4) (homebridge-tibber-price) is running on port 52259. UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "No prices returned from API!". [11/16/2022, 1:23:57 PM] [homebridge-tibber-price] Child bridge process ended [11/16/2022, 1:23:57 PM] [homebridge-tibber-price] Process Ended. Code: 1, Signal: null [11/16/2022, 1:24:04 PM] [homebridge-tibber-price] Restarting Process... [11/16/2022, 1:24:05 PM] [homebridge-tibber-price] Launched child bridge with PID 32572 [11/16/2022, 1:24:05 PM] Registering platform 'homebridge-tibber-price.HomebridgeTibberPrice' [11/16/2022, 1:24:05 PM] [homebridge-tibber-price] Loaded homebridge-tibber-price v1.0.2 child bridge successfully [11/16/2022, 1:24:05 PM] Loaded 2 cached accessories from cachedAccessories.0E8E73E22E77. [11/16/2022, 1:24:05 PM] [homebridge-tibber-price] Initialized Tibber client [11/16/2022, 1:24:05 PM] [homebridge-tibber-price] Configuring accessory Electricity price, with id cb7128bb-3988-4514-9542-01fcb1299331 [11/16/2022, 1:24:05 PM] [homebridge-tibber-price] Configuring accessory Relative electricity price, with id d6140a59-bd4b-435e-a3a5-d3200b2e93f0 [11/16/2022, 1:24:05 PM] [homebridge-tibber-price] Registering devices... [11/16/2022, 1:24:05 PM] [homebridge-tibber-price] Registering price sensor with id cb7128bb-3988-4514-9542-01fcb1299331 [11/16/2022, 1:24:05 PM] [homebridge-tibber-price] Registering relative price sensor with id d6140a59-bd4b-435e-a3a5-d3200b2e93f0 [11/16/2022, 1:24:05 PM] [homebridge-tibber-price] Will produce a chart PNG, stored at: /var/lib/homebridge/tibber-price/price-chart.png [11/16/2022, 1:24:05 PM] [homebridge-tibber-price] Starting background tasks... [11/16/2022, 1:24:05 PM] Homebridge v1.5.1 (HAP v0.10.4) (homebridge-tibber-price) is running on port 52259. UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "No prices returned from API!". [11/16/2022, 1:24:11 PM] [homebridge-tibber-price] Child bridge process ended [11/16/2022, 1:24:11 PM] [homebridge-tibber-price] Process Ended. Code: 1, Signal: null [11/16/2022, 1:24:18 PM] [homebridge-tibber-price] Restarting Process... [11/16/2022, 1:24:18 PM] [homebridge-tibber-price] Launched child bridge with PID 32608 [11/16/2022, 1:24:19 PM] Registering platform 'homebridge-tibber-price.HomebridgeTibberPrice' [11/16/2022, 1:24:19 PM] [homebridge-tibber-price] Loaded homebridge-tibber-price v1.0.2 child bridge successfully [11/16/2022, 1:24:19 PM] Loaded 2 cached accessories from cachedAccessories.0E8E73E22E77. [11/16/2022, 1:24:19 PM] [homebridge-tibber-price] Initialized Tibber client [11/16/2022, 1:24:19 PM] [homebridge-tibber-price] Configuring accessory Electricity price, with id cb7128bb-3988-4514-9542-01fcb1299331 [11/16/2022, 1:24:19 PM] [homebridge-tibber-price] Configuring accessory Relative electricity price, with id d6140a59-bd4b-435e-a3a5-d3200b2e93f0 [11/16/2022, 1:24:19 PM] [homebridge-tibber-price] Registering devices... [11/16/2022, 1:24:19 PM] [homebridge-tibber-price] Registering price sensor with id cb7128bb-3988-4514-9542-01fcb1299331 [11/16/2022, 1:24:19 PM] [homebridge-tibber-price] Registering relative price sensor with id d6140a59-bd4b-435e-a3a5-d3200b2e93f0 [11/16/2022, 1:24:19 PM] [homebridge-tibber-price] Will produce a chart PNG, stored at: /var/lib/homebridge/tibber-price/price-chart.png [11/16/2022, 1:24:19 PM] [homebridge-tibber-price] Starting background tasks... [11/16/2022, 1:24:19 PM] Homebridge v1.5.1 (HAP v0.10.4) (homebridge-tibber-price) is running on port 52259. UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "No prices returned from API!". [11/16/2022, 1:24:24 PM] [homebridge-tibber-price] Child bridge process ended [11/16/2022, 1:24:24 PM] [homebridge-tibber-price] Process Ended. Code: 1, Signal: null

robinjhector commented 2 years ago

Hi! Yeah i see it as well now, not sure what happened. Will make the error handling a bit more robust.

It might be that we need to quick-return and set the value for Relative Price or Energy Price to 0, while we load the initial data from API. Hopefully that should make it work better.

robinjhector commented 2 years ago

Hi again @osthoren ! Try version 1.0.3. It should have better error handling

osthoren commented 1 year ago

Hi! Yes, thank you! Now I get [12/5/2022, 9:31:12 AM] [homebridge-tibber-price] No prices returned from API. Was: []

And it is not crashing. Thank you for the update!

robinjhector commented 1 year ago

Great to hear @osthoren ! An empty array of prices from the API is a bit weird though 🤔 could it be an incorrect homeId configured?

osthoren commented 1 year ago

Yeah, something off with the homeId. After removing it it worked. Thank you for your help @robinjhector 😊