I am using, node-fetch to query my devices on the device.js
On debug, I need to import
const fetch = require('node-fetch');
Without it, I get this error when running homey app run
:
[ManagerDrivers] [Driver:solarpanel] [Device:09843584-dbce-45d8-bd3d-22068247553a] Error: ReferenceError: fetch is not defined
at SolarPanel.pullData (/app/drivers/solarpanel/device.js:26:7)
However, leaving the line in on production (deploying via homey app install
), breaks the app. I get this error both in the developer tools and homeyscript:
Could not get device by ID.
Leaving that line out works fine in production for some reason.