Fixed broken device type query

Replaced "Devices.LED_LIGHTS" with "DeviceType.LED_LIGHTS" 
Because "Devices.LED_LIGHTS" is undefined (maybe deprecated)
This commit is contained in:
David Colombo 2019-02-04 17:00:07 +01:00 committed by GitHub
parent d4c28982c4
commit c077d63333
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -117,7 +117,7 @@ poweredUP.on("discover", async (hub) => {
hub.setLEDColor(train.color);
console.log(`Connected to ${train.name} (${hub.name})`);
hub.on("attach", (port, type) => {
if (type === PoweredUP.Consts.Devices.LED_LIGHTS && trainHub.lights && trainHub.lights.indexOf(port) >= 0) {
if (type === PoweredUP.Consts.DeviceType.LED_LIGHTS && trainHub.lights && trainHub.lights.indexOf(port) >= 0) {
hub.setLightBrightness(port, 100);
}
});
@ -133,4 +133,4 @@ poweredUP.on("discover", async (hub) => {
poweredUP.scan(); // Start scanning for trains
console.log("Looking for trains...");
console.log("Looking for trains...");