homebridge-rflink
Advanced tools
Comparing version 1.1.2 to 1.1.4
@@ -8,6 +8,7 @@ 'use strict'; | ||
const Readline = SerialPort.parsers.Readline; | ||
let Service, Characteristic; // TODO: types | ||
let Service, Characteristic, UUIDGen; // TODO: types | ||
function index (homebridge) { | ||
Service = homebridge.hap.Service; | ||
Characteristic = homebridge.hap.Characteristic; | ||
UUIDGen = homebridge.hap.uuid; | ||
homebridge.registerPlatform("homebridge-rflink", "RFLink", RFLinkPlatform); | ||
@@ -30,3 +31,3 @@ } | ||
this.log(`received ${s}`); | ||
const m = s.match(/^20;\d+;(?<proto>[^;]+);ID=(?<address>[^;]+);SWITCH=(?<button>[^;]+);CMD=(?<command>[^;]+);/); | ||
const m = s.match(/^20;[^;]+;(?<proto>[^;]+);ID=(?<address>[^;]+);SWITCH=(?<button>[^;]+);CMD=(?<command>[^;]+);/); | ||
if (m) { | ||
@@ -67,2 +68,4 @@ const { proto, address, button, command } = m.groups; | ||
constructor(config, port, log, subscribe) { | ||
this.currentValue = false; | ||
this.currentLevel = 0; | ||
this.name = config.name; | ||
@@ -73,2 +76,5 @@ this.config = config; | ||
this.service = new Service[config.type](config.name); | ||
this.manufacturer = "RF Accessories"; | ||
this.model = `RF ${config.type}`; | ||
this.serialNumber = UUIDGen.generate(config.name); | ||
subscribe((message) => { | ||
@@ -136,3 +142,3 @@ if (!config.devices) { | ||
this.currentValue = value; | ||
this.service.getCharacteristic(Characteristic.On).updateValue(value); | ||
this.service.setCharacteristic(Characteristic.On, value); | ||
} | ||
@@ -142,5 +148,3 @@ updateLevel(level) { | ||
this.currentLevel = level; | ||
this.service | ||
.getCharacteristic(Characteristic.Brightness) | ||
.updateValue(level); | ||
this.service.setCharacteristic(Characteristic.Brightness, level); | ||
} | ||
@@ -147,0 +151,0 @@ getServices() { |
import SerialPort from 'serialport'; | ||
const Readline = SerialPort.parsers.Readline; | ||
let Service, Characteristic; // TODO: types | ||
let Service, Characteristic, UUIDGen; // TODO: types | ||
function index (homebridge) { | ||
Service = homebridge.hap.Service; | ||
Characteristic = homebridge.hap.Characteristic; | ||
UUIDGen = homebridge.hap.uuid; | ||
homebridge.registerPlatform("homebridge-rflink", "RFLink", RFLinkPlatform); | ||
@@ -25,3 +26,3 @@ } | ||
this.log(`received ${s}`); | ||
const m = s.match(/^20;\d+;(?<proto>[^;]+);ID=(?<address>[^;]+);SWITCH=(?<button>[^;]+);CMD=(?<command>[^;]+);/); | ||
const m = s.match(/^20;[^;]+;(?<proto>[^;]+);ID=(?<address>[^;]+);SWITCH=(?<button>[^;]+);CMD=(?<command>[^;]+);/); | ||
if (m) { | ||
@@ -62,2 +63,4 @@ const { proto, address, button, command } = m.groups; | ||
constructor(config, port, log, subscribe) { | ||
this.currentValue = false; | ||
this.currentLevel = 0; | ||
this.name = config.name; | ||
@@ -68,2 +71,5 @@ this.config = config; | ||
this.service = new Service[config.type](config.name); | ||
this.manufacturer = "RF Accessories"; | ||
this.model = `RF ${config.type}`; | ||
this.serialNumber = UUIDGen.generate(config.name); | ||
subscribe((message) => { | ||
@@ -131,3 +137,3 @@ if (!config.devices) { | ||
this.currentValue = value; | ||
this.service.getCharacteristic(Characteristic.On).updateValue(value); | ||
this.service.setCharacteristic(Characteristic.On, value); | ||
} | ||
@@ -137,5 +143,3 @@ updateLevel(level) { | ||
this.currentLevel = level; | ||
this.service | ||
.getCharacteristic(Characteristic.Brightness) | ||
.updateValue(level); | ||
this.service.setCharacteristic(Characteristic.Brightness, level); | ||
} | ||
@@ -142,0 +146,0 @@ getServices() { |
{ | ||
"name": "homebridge-rflink", | ||
"version": "1.1.2", | ||
"version": "1.1.4", | ||
"description": "RFLink support for Homebridge: https://github.com/nfarina/homebridge", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18432
441