Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion api.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
const fetch = require('node-fetch')
const _nodeFetch = require('node-fetch')
// On Node 18+ (notably Node 24), node-fetch@2's gzip (Gunzip) decode throws
// "FetchError: ... Premature close" on the way my.leviton.com closes responses,
// which escalates to an uncaughtException and crash-loops the whole bridge.
// Disabling gzip avoids the failing decode path; responses come back uncompressed.
// See https://github.com/tabrindle/homebridge-leviton/issues/52
const fetch = (url, opts = {}) => _nodeFetch(url, { compress: false, ...opts })
const SockJS = require('sockjs-client')

const baseURL = 'https://my.leviton.com/api'
Expand Down