UNPKG

homebridge-hilo

Version:

Plugin Homebridge (non officiel) pour la passerelle et les appareils Hilo de Hydro-Québec | Unofficial Homebridge plugin for Hydro-Québec Hilo bridge and devices

148 lines 3.38 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.fetchDevicesForLocation = void 0; const logger_1 = require("./logger"); const hiloApi_1 = require("./hiloApi"); const gql_1 = require("./graphql/gql"); const LOCATION_QUERY = (0, gql_1.graphql)(/* GraphQL */ ` query getLocation($locationHiloId: String!) { getLocation(id: $locationHiloId) { hiloId lastUpdate lastUpdateVersion devices { __typename deviceType hiloId physicalAddress connectionStatus ... on BasicSwitch { deviceType hiloId physicalAddress connectionStatus state power { value kind } } ... on BasicLight { deviceType hiloId physicalAddress connectionStatus state hue level saturation colorTemperature lightType } ... on HeatingFloorThermostat { deviceType hiloId physicalAddress connectionStatus ambientHumidity gDState version zigbeeVersion thermostatType physicalAddress floorMode power { value kind } ambientTemperature { value kind } ambientTempSetpoint { value kind } maxAmbientTempSetpoint { value kind } minAmbientTempSetpoint { value kind } floorLimit { value } } ... on BasicDimmer { deviceType hiloId physicalAddress connectionStatus state level power { value kind } } ... on BasicThermostat { deviceType hiloId physicalAddress connectionStatus ambientHumidity gDState version zigbeeVersion ambientTemperature { value kind } ambientTempSetpoint { value kind } maxAmbientTempSetpoint { value kind } minAmbientTempSetpoint { value kind } maxAmbientTempSetpointLimit { value kind } minAmbientTempSetpointLimit { value kind } heatDemand power { value kind } mode allowedModes } } } } `); const fetchDevicesForLocation = async (locationHiloId) => { var _a; const logger = (0, logger_1.getLogger)(); try { const response = await (0, hiloApi_1.execute)(LOCATION_QUERY, { locationHiloId }); return (((_a = response.data.data.getLocation) === null || _a === void 0 ? void 0 : _a.devices) || []); } catch (error) { logger.error("Error fetching devices for location:", error); return []; } }; exports.fetchDevicesForLocation = fetchDevicesForLocation; //# sourceMappingURL=location.js.map