UNPKG

homebridge-rachio-irrigation

Version:

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

43 lines 2.33 kB
import pkg from 'homebridge-rachio-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, property, platformAccessory) { if (!platformAccessory) { this.log.debug(`Create Bridge Accessory ${device.id} ${property.property.address.locality}`); platformAccessory = new this.platform.api.platformAccessory(String(property.property.address.locality), device.id); } else { this.log.debug(`Update Bridge Accessory ${device.id} ${property.property.address.locality}`); } platformAccessory.getService(this.Service.AccessoryInformation) .setCharacteristic(this.Characteristic.Name, property.property.address.locality) .setCharacteristic(this.Characteristic.Manufacturer, 'Rachio') .setCharacteristic(this.Characteristic.SerialNumber, device.serialNumber) .setCharacteristic(this.Characteristic.Model, 'HUB101') .setCharacteristic(this.Characteristic.Identify, true) .setCharacteristic(this.Characteristic.FirmwareRevision, device.reportedState.wifiBridgeFirmwareVersion) //.setCharacteristic(this.Characteristic.HardwareRevision, device.hardware_version) .setCharacteristic(this.Characteristic.SoftwareRevision, pkg.version); return platformAccessory; } createBridgeService(device, property) { this.log.debug(`create bridge service for ${property.property.address.locality}`); const bridgeService = new this.Service.WiFiTransport(String(property.property.address.locality), device.id); bridgeService.setCharacteristic(this.Characteristic.CurrentTransport, device.reportedState.connected); return bridgeService; } configureBridgeService(bridgeService) { this.log.debug(`configured bridge for ${bridgeService.getCharacteristic(this.Characteristic.Name).value}`); bridgeService.getCharacteristic(this.Characteristic.CurrentTransport); } } //# sourceMappingURL=bridge.js.map