UNPKG

homebridge-orbit-irrigation

Version:

Orbit Irrigation System platform plugin for [Homebridge](https://github.com/nfarina/homebridge).

52 lines 2.62 kB
import pkg from 'homebridge-orbit-irrigation/package.json' with { type: 'json' }; export default class bridge { platform; log; Service; Characteristic; constructor(platform, log = platform.log) { this.platform = platform; this.log = log; this.Service = platform.Service; this.Characteristic = platform.Characteristic; } createBridgeAccessory(device, uuid, platformAccessory) { if (!platformAccessory) { this.log.debug('Create Bridge Accessory %s %s', device.id, device.name); platformAccessory = new this.platform.api.platformAccessory(device.name, uuid); } else { this.log.debug('Update Bridge Accessory %s %s', device.id, device.name); } platformAccessory.getService(this.Service.AccessoryInformation) .setCharacteristic(this.Characteristic.Name, device.name) .setCharacteristic(this.Characteristic.Manufacturer, 'Orbit Irrigation') .setCharacteristic(this.Characteristic.SerialNumber, device.mac_address) .setCharacteristic(this.Characteristic.Model, device.hardware_version || 'Orbit Bridge') .setCharacteristic(this.Characteristic.Identify, true) .setCharacteristic(this.Characteristic.FirmwareRevision, device.firmware_version || 'unknown') .setCharacteristic(this.Characteristic.HardwareRevision, device.hardware_version || 'unknown') .setCharacteristic(this.Characteristic.SoftwareRevision, pkg.version); return platformAccessory; } createBridgeService(device, network, G2) { this.log.debug('create bridge service for %s', device.name); const bridgeService = new this.Service.WiFiTransport(device.name, device.id); if (G2) { bridgeService .setCharacteristic(this.Characteristic.AccessoryIdentifier, network.network_key); bridgeService.setCharacteristic(this.Characteristic.CurrentTransport, device.is_connected); } else { bridgeService .setCharacteristic(this.Characteristic.AccessoryIdentifier, network.ble_network_key); bridgeService.setCharacteristic(this.Characteristic.CurrentTransport, device.is_connected); } return bridgeService; } configureBridgeService(bridgeService) { this.log.debug('configured bridge for %s', bridgeService.getCharacteristic(this.Characteristic.Name).value); bridgeService.getCharacteristic(this.Characteristic.CurrentTransport); } } //# sourceMappingURL=bridge.js.map