iobroker.iot 4.2.5 → 4.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -8
- package/admin/assets/{index-CMPNKRVu.js → index-CI6r4XAS.js} +59 -59
- package/admin/index_m.html +1 -1
- package/build/lib/AlexaSmartHomeV3/Alexa/ModeValues/Closed.js +1 -1
- package/build/lib/AlexaSmartHomeV3/Alexa/ModeValues/Closed.js.map +1 -1
- package/build/lib/AlexaSmartHomeV3/Controls/Control.js +5 -1
- package/build/lib/AlexaSmartHomeV3/Controls/Control.js.map +1 -1
- package/build/lib/AlexaSmartHomeV3/Controls/Rgb.js +17 -17
- package/build/lib/AlexaSmartHomeV3/Controls/Rgb.js.map +1 -1
- package/build/lib/AlexaSmartHomeV3/DeviceManager.js.map +1 -1
- package/build/lib/AlexaSmartHomeV3/Helpers/Utils.js +20 -1
- package/build/lib/AlexaSmartHomeV3/Helpers/Utils.js.map +1 -1
- package/build/main.js +36 -1
- package/build/main.js.map +1 -1
- package/io-package.json +28 -28
- package/package.json +4 -4
package/build/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";;;;;;AAAA,2DAA4D;AAC5D,yDAAsE,CAAC,2BAA2B;AAClG,qCAAuC;AACvC,kDAA0B;AAC1B,yCAAwC;AAExC,4BAA4B;AAC5B,8EAA8C;AAC9C,8EAA8C;AAC9C,oEAA0E;AAC1E,4BAA4B;AAC5B,kEAA0C;AAC1C,4BAA4B;AAC5B,wDAAsC;AACtC,0DAA8E;AAC9E,2CAA+G;AAC/G,uDAAmE;AAGnE,MAAM,IAAI,GAAG,YAAY,CAAC;AAC1B,MAAM,sBAAsB,GAAG,GAAG,GAAG,IAAI,CAAC;AAC1C,MAAM,gBAAgB,GAAG,CAAC,SAAS,CAAC,CAAC;AACrC,MAAM,gBAAgB,GAAG,gBAAgB,CA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G,MAAM,IAAI,CAAC,aAAa,CAAC,iBAAiB,CAAC,CAAC;YAC1D,IAAI,KAAK,EAAE,GAAG,EAAE,CAAC;gBACb,MAAM,IAAI,CAAC,aAAa,CAAC,iBAAiB,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;YAC1D,CAAC;QACL,CAAC;QAED,IAAI,CAAC,UAAU,EAAE,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACxC,IAAI,CAAC,UAAU,EAAE,aAAa,EAAE,CAAC;QAEjC,IAAI,CAAC,WAAW,EAAE,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACzC,IAAI,CAAC,WAAW,EAAE,aAAa,EAAE,CAAC;QAElC,MAAM,IAAI,CAAC,oBAAoB,CAAC,aAAa,CAAC,CAAC;IACnD,CAAC;CACJ;AA/hDD,gCA+hDC;AAED,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;IAC1B,yCAAyC;IACzC,MAAM,CAAC,OAAO,GAAG,CAAC,OAA4C,EAAE,EAAE,CAAC,IAAI,UAAU,CAAC,OAAO,CAAC,CAAC;AAC/F,CAAC;KAAM,CAAC;IACJ,wCAAwC;IACxC,CAAC,GAAG,EAAE,CAAC,IAAI,UAAU,EAAE,CAAC,EAAE,CAAC;AAC/B,CAAC","sourcesContent":["import { device as DeviceModule } from 'aws-iot-device-sdk';\nimport { Adapter, type AdapterOptions } from '@iobroker/adapter-core'; // Get common adapter utils\nimport { readFileSync } from 'node:fs';\nimport axios from 'axios';\nimport { deflateSync } from 'node:zlib';\n\n// @ts-expect-error no types\nimport AlexaSH2 from './lib/alexaSmartHomeV2';\nimport AlexaSH3 from './lib/alexaSmartHomeV3';\nimport AlexaCustom, { type AlexaCustomResponse } from './lib/alexaCustom';\n// @ts-expect-error no types\nimport GoogleHome from './lib/googleHome';\n// @ts-expect-error no types\nimport YandexAlisa from './lib/alisa';\nimport Remote, { type SOCKET_MESSAGE, type SOCKET_TRUNK } from './lib/remote';\nimport { handleGeofenceData, handleDevicesData, handleSendToAdapter, handleGetInstances } from './lib/visuApp';\nimport { buildMessageFromNotification } from './lib/notifications';\nimport type { IotAdapterConfig } from './lib/types';\n\nconst NONE = '___none___';\nconst MAX_IOT_MESSAGE_LENGTH = 127 * 1024;\nconst SPECIAL_ADAPTERS = ['netatmo'];\nconst ALLOWED_SERVICES = SPECIAL_ADAPTERS.concat(['text2command']);\n\nexport class IotAdapter extends Adapter {\n declare public config: IotAdapterConfig;\n private recalcTimeout: NodeJS.Timeout | null = null;\n private lang: ioBroker.Languages = 'de';\n private translate = false;\n private alexaSH2: AlexaSH2 | null = null;\n private alexaSH3: AlexaSH3 | null = null;\n private googleHome: GoogleHome | null = null;\n private alexaCustom: AlexaCustom | null = null;\n private yandexAlisa: YandexAlisa | null = null;\n private remote: Remote | null = null;\n private device: DeviceModule | null = null;\n private urlKey: { key: string } | null = null;\n\n private connectedOwn = false;\n private secret: string = '';\n private connectStarted = 0;\n\n public constructor(options: Partial<AdapterOptions> = {}) {\n super({\n ...options,\n name: 'iot',\n objectChange: (id, obj) => {\n if (id === 'system.config' && obj && !this.translate) {\n const systemObj = obj as ioBroker.SystemConfigObject;\n this.lang = systemObj.common.language;\n\n if (this.lang !== 'en' && this.lang !== 'de' && this.lang !== 'ru') {\n this.lang = 'en';\n }\n\n this.alexaSH2?.setLanguage(this.lang);\n this.alexaSH3?.setLanguage(this.lang);\n this.yandexAlisa?.setLanguage(this.lang);\n this.alexaCustom?.setLanguage(this.lang);\n this.googleHome?.setLanguage(this.lang);\n this.remote?.setLanguage(this.lang);\n }\n // if it is an instance\n if (id.startsWith('system.adapter.')) {\n // try to find it in special adapters\n const adpr = SPECIAL_ADAPTERS.find(a => id.startsWith(`system.adapter.${a}.`));\n // if found and it is really instance\n if (adpr && id.match(/\\.\\d+$/)) {\n // update state\n setTimeout(async () => await this.createStateForAdapter(adpr), 1000);\n }\n\n return;\n }\n void this.alexaSH3?.handleObjectChange(id, obj);\n\n if (id) {\n this.remote?.updateObject(id, obj);\n }\n },\n stateChange: async (id, state) => {\n if (id === `${this.namespace}.app.message` && state && !state.ack) {\n try {\n await this.sendMessageToApp(state.val as string);\n } catch (e) {\n this.log.error(`Cannot send message to app: ${e}`);\n }\n }\n\n if (state) {\n if (this.config.googleHome) {\n void this.googleHome?.updateState(id, state);\n }\n if (this.config.amazonAlexa) {\n void this.alexaSH3?.handleStateUpdate(id, state);\n }\n\n if (this.config.yandexAlisa) {\n void this.yandexAlisa?.updateState?.(id, state);\n }\n }\n\n if (id) {\n this.remote?.updateState(id, state);\n }\n\n if (id === `${this.namespace}.smart.lastResponse` && state && !state.ack) {\n this.alexaCustom?.setResponse(state.val as string);\n }\n },\n unload: async callback => {\n try {\n if (this.device) {\n this.device.end();\n this.device = null;\n }\n if (this.remote) {\n this.remote.destroy();\n this.remote = null;\n }\n\n if (this.alexaSH3) {\n await this.alexaSH3.destroy();\n }\n } catch {\n // ignore\n }\n callback();\n },\n message: async obj => {\n if (obj) {\n switch (obj.command) {\n case 'update':\n if (this.recalcTimeout) {\n clearTimeout(this.recalcTimeout);\n }\n\n this.recalcTimeout = setTimeout(async () => {\n this.recalcTimeout = null;\n this.alexaSH2?.updateDevices(\n obj.message,\n async (analyseAddedId: any): Promise<void> => {\n await this.setStateAsync('smart.updatesResult', analyseAddedId || '', true);\n this.log.debug('Devices updated!');\n await this.setStateAsync('smart.updates', true, true);\n },\n );\n\n // this.alexaSH3 && this.alexaSH3.updateDevices(obj.message, async analyseAddedId => {\n // await this.setStateAsync('smart.updatesResult', analyseAddedId || '', true);\n // await this.setStateAsync('smart.updates3', true, true);\n // });\n if (this.alexaSH3) {\n await this.alexaSH3.updateDevices();\n await this.setStateAsync('smart.updates3', true, true);\n }\n\n this.googleHome?.updateDevices(async (analyseAddedId: any): Promise<void> => {\n await this.setStateAsync('smart.updatesResult', analyseAddedId || '', true);\n this.log.debug('GH Devices updated!');\n await this.setStateAsync('smart.updatesGH', true, true);\n });\n }, 1000);\n break;\n\n case 'browse':\n if (obj.callback) {\n this.log.info('Request devices');\n if (this.alexaSH2) {\n this.alexaSH2.updateDevices(() => {\n this.sendTo(obj.from, obj.command, this.alexaSH2!.getDevices(), obj.callback);\n void this.setState('smart.updates', false, true);\n });\n } else {\n this.sendTo(obj.from, obj.command, { error: 'not activated' }, obj.callback);\n }\n }\n break;\n\n case 'browse3':\n if (obj.callback) {\n this.log.info('Request V3 devices');\n if (this.alexaSH3) {\n const devices = await this.alexaSH3.getDevices();\n this.sendTo(obj.from, obj.command, devices, obj.callback);\n await this.setStateAsync('smart.updates3', false, true);\n } else {\n this.sendTo(obj.from, obj.command, { error: 'not activated' }, obj.callback);\n }\n }\n break;\n\n case 'browseGH':\n if (obj.callback) {\n this.log.info('Request google home devices');\n if (this.googleHome) {\n this.googleHome.updateDevices(() => {\n this.sendTo(obj.from, obj.command, this.googleHome!.getDevices(), obj.callback);\n void this.setStateAsync('smart.updatesGH', false, true);\n });\n } else {\n this.sendTo(obj.from, obj.command, { error: 'not activated' }, obj.callback);\n }\n }\n break;\n\n case 'browseAlisa':\n if (obj.callback) {\n this.log.info('Request Yandex Alice devices');\n if (this.yandexAlisa) {\n this.yandexAlisa.updateDevices(() => {\n this.sendTo(\n obj.from,\n obj.command,\n this.yandexAlisa!.getDevices(),\n obj.callback,\n );\n void this.setStateAsync('smart.updatesYA', false, true);\n });\n } else {\n this.sendTo(obj.from, obj.command, { error: 'not activated' }, obj.callback);\n }\n }\n break;\n\n case 'alexaCustomKnownDevices':\n // Admin UI can request the known/discoveredAlexa devices used via Custom skill\n // Allow setting the rooms of the devices and store in adapter config\n // Restart adapter after change - or we also add a set message to the config\n if (obj.callback) {\n this.log.info('Request Alexa Custom known devices');\n this.sendTo(\n obj.from,\n obj.command,\n this.alexaCustom ? this.alexaCustom.getKnownDevices() : { error: 'not activated' },\n obj.callback,\n );\n }\n break;\n\n case 'alexaCustomKnownUsers':\n // Admin UI can request the known/discoveredAlexa users used via Custom skill\n // Allow setting the names of the users and store in adapter config\n // Restart adapter after change - or we also add a set message to the config\n if (obj.callback) {\n this.log.info('Request Alexa Custom known users');\n this.sendTo(\n obj.from,\n obj.command,\n this.alexaCustom ? this.alexaCustom.getKnownUsers() : { error: 'not activated' },\n obj.callback,\n );\n }\n break;\n\n case 'private': {\n if (typeof obj.message !== 'object') {\n try {\n obj.message = JSON.parse(obj.message);\n } catch (e) {\n this.log.error(`Cannot parse object: ${e}`);\n obj.callback &&\n this.sendTo(\n obj.from,\n obj.command,\n { error: 'Invalid message format: cannot parse object' },\n obj.callback,\n );\n return;\n }\n }\n const response = await this.processMessage(obj.message.type, obj.message.request);\n if (obj.callback) {\n this.sendTo(obj.from, obj.command, response, obj.callback);\n }\n\n break;\n }\n case 'ifttt':\n this.sendDataToIFTTT(obj.message);\n break;\n\n case 'alexaCustomResponse':\n this.alexaCustom?.setResponse(obj.message);\n break;\n\n case 'debug':\n this.alexaSH2?.getDebug((data: any): void =>\n this.sendTo(obj.from, obj.command, data, obj.callback),\n );\n break;\n\n case 'getServiceEndpoint':\n if (obj.callback) {\n if (!this.urlKey) {\n try {\n this.urlKey = await this.readUrlKey();\n } catch {\n try {\n this.urlKey = await this.createUrlKey(this.config.login, this.config.pass);\n } catch (err) {\n return (\n obj.callback &&\n this.sendTo(\n obj.from,\n obj.command,\n { error: `Cannot get urlKey: ${err.toString()}` },\n obj.callback,\n )\n );\n }\n }\n }\n\n const result: {\n url: string;\n stateID?: string;\n data?: string;\n warning?: string;\n } = {\n url: `https://service.iobroker.in/v1/iotService?key=${this.urlKey.key}&user=${encodeURIComponent(this.config.login)}`,\n };\n const serviceName =\n typeof obj.message === 'string' ? obj.message : obj.message?.serviceName;\n if (serviceName) {\n result.url += `&service=${encodeURIComponent(serviceName)}`;\n result.stateID = `${this.namespace}.services.${serviceName}`;\n }\n if (obj.message?.data) {\n result.data += `&data=${typeof obj.message.data === 'object' ? JSON.stringify(obj.message.data) : obj.message.data}`;\n }\n // check if the service name is in the white list\n if (\n serviceName &&\n this.config.allowedServices[0] !== '*' &&\n !this.config.allowedServices.includes(serviceName.replace(/^custom_/, '')) &&\n !ALLOWED_SERVICES.includes(serviceName)\n ) {\n result.warning = 'Service name is not in white list';\n this.log.warn(`Service \"${serviceName}\" is not in allowed services list`);\n }\n\n if (obj.callback) {\n this.sendTo(obj.from, obj.command, result, obj.callback);\n }\n }\n break;\n case 'sendNotification':\n try {\n const { message, title } = buildMessageFromNotification(obj.message);\n await this.sendMessageToApp(JSON.stringify({ message, title }));\n if (obj.callback) {\n this.sendTo(obj.from, 'sendNotification', { sent: true }, obj.callback);\n }\n } catch {\n if (obj.callback) {\n this.sendTo(obj.from, 'sendNotification', { sent: false }, obj.callback);\n }\n }\n break;\n default:\n this.log.warn(`Unknown command: ${obj.command}`);\n break;\n }\n }\n },\n ready: () =>\n this.main()\n .then(() => {})\n .catch(error => {\n this.log.error(`Error in main: ${error.toString()}`);\n }),\n });\n\n // warning: `this.log = obj => console.log(obj)` does not implemented. Only this.on('log', obj => console.log(obj))\n this.on('log', obj => this.remote?.onLog(obj));\n }\n\n sendDataToIFTTT(obj: {\n event?: string;\n key?: string;\n id?: string;\n val?: ioBroker.StateValue;\n ack?: boolean;\n }): void {\n if (!obj) {\n this.log.warn('No data to send to IFTTT');\n return;\n }\n if (!this.config.iftttKey && (typeof obj !== 'object' || !obj.key)) {\n this.log.warn('No IFTTT key is defined');\n return;\n }\n\n let url;\n let data;\n if (typeof obj !== 'object') {\n url = `https://maker.ifttt.com/trigger/state/with/key/${this.config.iftttKey}`;\n data = {\n value1: `${this.namespace}.services.ifttt`,\n value2: obj,\n };\n } else if (obj.event) {\n const event = obj.event;\n const key = obj.key;\n delete obj.event;\n delete obj.key;\n url = `https://maker.ifttt.com/trigger/${event}/with/key/${key || this.config.iftttKey}`;\n data = obj;\n } else if (obj.val === undefined) {\n return this.log.warn('No value is defined');\n } else {\n obj.id = obj.id || `${this.namespace}.services.ifttt`;\n url = `https://maker.ifttt.com/trigger/state/with/key/${this.config.iftttKey}`;\n data = {\n value1: obj.id,\n value2: obj.val,\n value3: obj.ack,\n };\n }\n\n if (url) {\n axios\n .post(url, data, {\n timeout: 15000,\n validateStatus: status => status < 400,\n })\n .then(response => this.log.debug(`Response from IFTTT: ${JSON.stringify(response.data)}`))\n .catch(error => {\n if (error.response) {\n this.log.warn(\n `Response from IFTTT: ${error.response.data ? JSON.stringify(error.response.data) : error.response.status}`,\n );\n } else {\n this.log.warn(`Response from IFTTT: ${error.code}`);\n }\n });\n } else {\n this.log.warn(`Invalid request to IFTTT: ${JSON.stringify(obj)}`);\n }\n }\n\n /**\n * Send a message to the ioBroker Visu App by using the app-message endpoint (which then forwards it to the app via FCM)\n *\n * @param message either a json string or the message itself, if the message itself the other props will be taken from the adapter states\n */\n async sendMessageToApp(message: string): Promise<void> {\n if (!message) {\n throw new Error('Empty message');\n }\n const trimmedMessage = message.toString().trim();\n let json: {\n message: string;\n title: string;\n priority?: 'high';\n ttlSeconds?: number;\n expire?: number;\n } | null;\n if (trimmedMessage.startsWith('{') && trimmedMessage.endsWith('}')) {\n try {\n json = JSON.parse(trimmedMessage);\n } catch {\n this.log.warn(`Cannot parse message: ${trimmedMessage}`);\n json = null;\n }\n } else {\n json = null;\n }\n\n if (!json) {\n // take expires\n const ttlSecondsState = await this.getStateAsync(`${this.namespace}.app.expire`);\n const priorityState = await this.getStateAsync(`${this.namespace}.app.priority`);\n const titleState = await this.getStateAsync(`${this.namespace}.app.title`);\n const priorityVal = priorityState?.val;\n json = {\n message: message.toString(),\n priority: priorityVal === '1' || priorityVal === 'high' || priorityVal === true ? 'high' : undefined,\n ttlSeconds: parseInt(ttlSecondsState?.val as string, 0) || undefined,\n title: ((titleState?.val as string) || 'ioBroker').toString(),\n };\n } else {\n if (json.expire) {\n json.ttlSeconds = json.expire;\n delete json.expire;\n }\n }\n\n json.ttlSeconds = parseInt(json.ttlSeconds as unknown as string, 0) || undefined;\n\n if (json.ttlSeconds && json.ttlSeconds > 3_600 * 48) {\n json.ttlSeconds = 3_600 * 48;\n }\n\n if (!json.message) {\n throw new Error('Empty message');\n }\n\n const response = await axios.post('https://app-message.iobroker.in/', json, {\n headers: {\n 'Content-Type': 'application/json',\n Authorization: `Bearer ${Buffer.from(`${this.config.login}:${this.config.pass}`).toString('base64')}`,\n },\n timeout: 5_000,\n validateStatus: status => status < 400,\n });\n await this.setState('app.message', message, true);\n this.log.debug(`Message sent: ${JSON.stringify(response.data)}`);\n }\n\n async controlState(\n id: string | null,\n data: string | { id?: string; val?: ioBroker.StateValue; ack?: boolean },\n ): Promise<void> {\n id ||= 'services.ifttt';\n\n if (typeof data === 'object') {\n if (data.id) {\n if (data.id === `${this.namespace}.services.ifttt`) {\n data.ack = true;\n }\n if (data.val === undefined) {\n throw new Error('No value set');\n }\n const obj = await this.getForeignObjectAsync(data.id);\n if (!obj || !obj.common) {\n throw new Error(`Unknown ID: ${data.id}`);\n } else {\n if (typeof data.val === 'string') {\n data.val = data.val.replace(/^@ifttt\\s?/, '');\n }\n if (obj.common.type === 'boolean') {\n data.val =\n data.val === true ||\n data.val === 'true' ||\n data.val === 'on' ||\n data.val === 'ON' ||\n data.val === 1 ||\n data.val === '1';\n } else if (obj.common.type === 'number') {\n data.val = parseFloat(data.val as string);\n }\n\n await this.setForeignStateAsync(data.id, data.val, data.ack);\n }\n } else if (data.val !== undefined) {\n if (typeof data.val === 'string') {\n data.val = data.val.replace(/^@ifttt\\s?/, '');\n }\n await this.setStateAsync(id, data.val, data.ack !== undefined ? data.ack : true);\n } else {\n await this.setStateAsync(id, JSON.stringify(data), true);\n }\n } else {\n if (typeof data === 'string') {\n data = data.replace(/^@ifttt\\s?/, '');\n }\n await this.setStateAsync(id, data, true);\n }\n }\n\n async processIfttt(data: {\n id?: string;\n data?:\n | string\n | {\n id?: string;\n val?: ioBroker.StateValue;\n ack?: boolean;\n data?: { id?: string; val?: ioBroker.StateValue; ack?: boolean } | string;\n };\n }): Promise<void> {\n this.log.debug(`Received IFTTT object: ${JSON.stringify(data)}`);\n let id: string | undefined;\n let dataObj: { id?: string; val?: ioBroker.StateValue; ack?: boolean } | null = null;\n // >If data is object with id and data property\n if (typeof data === 'object' && data.id && data.data !== undefined) {\n id = data.id;\n if (typeof data.data === 'string' && data.data[0] === '{') {\n try {\n dataObj = JSON.parse(data.data);\n } catch {\n this.log.debug(`Cannot parse: ${data.data}`);\n dataObj = data;\n }\n } else {\n dataObj = data.data as { id?: string; val?: ioBroker.StateValue; ack?: boolean };\n }\n } else if (typeof data === 'string' && data[0] === '{') {\n // If data is string and starts with {\n try {\n dataObj = JSON.parse(data) as { id?: string; val?: ioBroker.StateValue; ack?: boolean };\n\n if (typeof dataObj.id === 'string') {\n id = dataObj.id;\n if ((dataObj as any).data) {\n dataObj = (dataObj as any).data as {\n id?: string;\n val?: ioBroker.StateValue;\n ack?: boolean;\n };\n }\n }\n } catch {\n this.log.debug(`Cannot parse: ${JSON.stringify(data)}`);\n }\n } else {\n dataObj = data as { id?: string; val?: ioBroker.StateValue; ack?: boolean };\n }\n\n if (id) {\n let obj = await this.getForeignObjectAsync(id);\n if (!obj) {\n const newId = `${this.namespace}.services.${id}`;\n obj = await this.getForeignObjectAsync(newId);\n if (!obj) {\n // create state\n await this.setObjectNotExistsAsync(`services.${id}`, {\n type: 'state',\n common: {\n name: 'IFTTT value',\n write: false,\n role: 'state',\n read: true,\n type: 'mixed',\n desc: 'Custom state',\n },\n native: {},\n });\n id = newId;\n }\n }\n }\n\n await this.controlState(\n id || null,\n (dataObj as { id?: string; val?: ioBroker.StateValue; ack?: boolean }) || data,\n );\n }\n\n onDisconnect(event?: string): void {\n const now = Date.now();\n if (now - this.connectStarted < 500) {\n this.log.warn(\n 'Looks like your connection certificates are invalid. Please renew them via configuration dialog.',\n );\n }\n\n if (typeof event === 'string') {\n if (event.toLowerCase().includes('duplicate')) {\n // disable adapter\n this.log.error(\n `Two devices are trying to connect with the same iot account. This is not allowed. Stopping`,\n );\n void this.getForeignObjectAsync(`system.adapter.${this.namespace}`).then(obj => {\n if (obj) {\n obj.common.enabled = false;\n return this.setForeignObjectAsync(obj._id, obj);\n }\n });\n }\n this.log.info(`Connection changed: ${event}`);\n } else {\n this.log.info('Connection changed: disconnect');\n }\n\n if (this.connectedOwn) {\n this.log.info('Connection lost');\n this.connectedOwn = false;\n void this.setState('info.connection', false, true);\n }\n\n this.remote?.onCloudDisconnect();\n }\n\n onConnect(clientId: string): void {\n if (!this.connectedOwn) {\n this.log.info(`Connection changed: connect \"${clientId}\"`);\n this.connectedOwn = true;\n void this.setState('info.connection', this.connectedOwn, true);\n // setTimeout(() => {\n // device.publish(`response/${clientId}/stateChange`, JSON.stringify({alive: true}), {qos: 0}, (error, result) => {\n // console.log(`Published alive: ${result}, ${error}`);\n // });\n // }, 2000);\n } else {\n this.log.info('Connection not changed: was connected');\n }\n }\n\n encryptOwn(secret: string, value: string): string {\n let result = '';\n for (let i = 0; i < value.length; i++) {\n result += String.fromCharCode(secret[i % secret.length].charCodeAt(0) ^ value.charCodeAt(i));\n }\n return `base64:${Buffer.from(result).toString('base64')}`;\n }\n\n decryptOwn(secret: string, value: string): string {\n if (value.startsWith('base64:')) {\n try {\n value = Buffer.from(value.substring(7), 'base64').toString('ascii');\n } catch (e) {\n this.log.error(`Cannot decrypt key: ${e}`);\n }\n }\n\n let result = '';\n for (let i = 0; i < value.length; i++) {\n result += String.fromCharCode(secret[i % secret.length].charCodeAt(0) ^ value.charCodeAt(i));\n }\n return result;\n }\n\n async readUrlKey(): Promise<{ key: string }> {\n const key = await this.getStateAsync('certs.urlKey');\n\n if (!key?.val) {\n throw new Error('Not exists');\n } else {\n return { key: key.val as string };\n }\n }\n\n async createUrlKey(login: string, pass: string): Promise<{ key: string }> {\n this.log.debug('Fetching URL key...');\n\n let response;\n try {\n response = await axios.get(\n `https://generate-key.iobroker.in/v1/generateUrlKey?user=${encodeURIComponent(login)}&pass=${encodeURIComponent(pass)}&version=${this.version}`,\n {\n timeout: 15000,\n validateStatus: status => status < 400,\n },\n );\n } catch (error) {\n if (error.response) {\n if (error.response.status === 401) {\n this.log.error(`Cannot create URL key because of invalid user or password`);\n }\n\n throw new Error(error.response.data);\n } else {\n throw error;\n }\n }\n\n if (response.data && response.data.error) {\n this.log.error(`Cannot fetch URL key: ${JSON.stringify(response.data.error)}`);\n throw new Error(response.data);\n } else if (response.data && response.data.key) {\n await this.setStateAsync('certs.urlKey', response.data.key, true);\n return { key: response.data.key };\n } else {\n this.log.error(`Cannot fetch URL key: ${JSON.stringify(response.data)}`);\n throw new Error(response.data);\n }\n }\n\n async readCertificates(): Promise<{\n private: string;\n certificate: string;\n }> {\n let privateKey: ioBroker.State | null | undefined;\n let certificate: ioBroker.State | null | undefined;\n\n try {\n privateKey = await this.getStateAsync('certs.private');\n certificate = await this.getStateAsync('certs.certificate');\n } catch {\n throw new Error('Not exists');\n }\n\n if (!certificate?.val || !privateKey?.val) {\n throw new Error('Not exists');\n } else {\n return {\n private: this.decryptOwn(this.secret, privateKey.val as string),\n certificate: this.decryptOwn(this.secret, certificate.val as string),\n };\n }\n }\n\n async writeKeys(data: {\n certificateId: string;\n certificatePem: string;\n keyPair: { PublicKey: string; PrivateKey: string };\n }): Promise<void> {\n await this.setStateAsync('certs.private', this.encryptOwn(this.secret, data.keyPair.PrivateKey), true);\n await this.setStateAsync('certs.public', this.encryptOwn(this.secret, data.keyPair.PublicKey), true);\n await this.setStateAsync('certs.certificate', this.encryptOwn(this.secret, data.certificatePem), true);\n await this.setStateAsync('certs.id', data.certificateId, true);\n }\n\n async fetchCertificates(\n login: string,\n pass: string,\n _forceUserCreation?: boolean,\n ): Promise<{\n private: string;\n certificate: string;\n }> {\n const state = await this.getStateAsync('certs.forceUserCreate');\n const forceUserCreation = state?.val;\n\n if (forceUserCreation) {\n await this.setStateAsync('certs.forceUserCreate', false, true);\n }\n\n this.log.debug('Fetching certificates...');\n let response;\n try {\n response = await axios.get(\n `https://create-user.iobroker.in/v1/createUser?user=${encodeURIComponent(login)}&pass=${encodeURIComponent(pass)}&forceRecreate=${forceUserCreation}&version=${this.version}`,\n {\n timeout: 15000,\n validateStatus: status => status < 400,\n },\n );\n } catch (error) {\n if (error.response) {\n if (error.response.status === 401) {\n this.log.error(`Cannot fetch connection certificates because of invalid user or password`);\n } else {\n this.log.error(`Cannot fetch connection certificates: ${JSON.stringify(error.response.data)}`);\n }\n throw new Error(error.response.data);\n } else {\n this.log.error(`Cannot fetch connection certificates: ${JSON.stringify(error.code)}`);\n throw error;\n }\n }\n\n if (response?.data?.certificates) {\n const awsCertificates: {\n certificateId: string;\n certificatePem: string;\n keyPair: { PublicKey: string; PrivateKey: string };\n } = response.data.certificates;\n await this.writeKeys(awsCertificates);\n\n return {\n private: awsCertificates.keyPair.PrivateKey,\n certificate: awsCertificates.certificatePem,\n };\n }\n this.log.error(`Cannot fetch connection certificates: ${JSON.stringify(response.data)}`);\n throw new Error(response.data);\n }\n\n async processMessage(\n type: string,\n request: any,\n ): Promise<{ error?: string; result?: string } | string | SOCKET_MESSAGE | SOCKET_TRUNK[] | AlexaCustomResponse> {\n if (request instanceof Buffer) {\n request = request.toString();\n }\n\n if (!request || !type) {\n this.log.debug(`Invalid request: ${JSON.stringify(request)}`);\n return { error: 'invalid request' };\n }\n\n if (type.startsWith('remote')) {\n const start = Date.now();\n\n this.log.debug(`Remote request: ${JSON.stringify(request)}`);\n\n if (this.remote) {\n return this.remote\n .process(request, type as `remote${string}`)\n .then(response => {\n if (response !== NONE) {\n this.log.debug(\n `[REMOTE] Response in: ${Date.now() - start}ms (Length: ${Array.isArray(response) ? `A ${response.length}` : JSON.stringify(response).length}) for ${request}`,\n );\n }\n return response;\n })\n .catch(err => {\n this.log.error(`Error in processing of remote request: ${err.toString()}`);\n return NONE;\n });\n }\n this.log.error(`Received command, but remote already closed.`);\n } else if (type.startsWith('nightscout')) {\n this.log.debug(`Nightscout request: ${JSON.stringify(request)}`);\n if (this.config.nightscout) {\n const state = await this.getForeignStateAsync(\n `system.adapter.nightscout.${this.config.nightscout}.alive`,\n );\n if (state?.val) {\n return this.sendToAsync(`nightscout.${this.config.nightscout}`, 'send', request) as {\n error?: string;\n result?: string;\n };\n }\n return { error: `nightscout.${this.config.nightscout} is offline` };\n }\n return { error: 'Service is disabled' };\n } else if (type.startsWith('alexa')) {\n if (typeof request === 'string') {\n try {\n request = JSON.parse(request);\n } catch {\n this.log.error(`Cannot parse request: ${JSON.stringify(request)}`);\n return { error: 'Cannot parse request' };\n }\n }\n\n const printRequest = JSON.parse(JSON.stringify(request));\n if (printRequest.directive?.header?.correlationToken) {\n printRequest.directive.header.correlationToken = '***';\n }\n if (printRequest.directive?.endpoint?.scope?.token) {\n printRequest.directive.endpoint.scope.token = '***';\n }\n this.log.debug(`${Date.now()} ALEXA: ${JSON.stringify(printRequest)}`);\n\n if (request?.directive) {\n if (this.alexaSH3) {\n try {\n const response = await this.alexaSH3.process(request);\n if (request.directive.header.messageId != response.event!.header.messageId) {\n throw new Error('Incoming and outgoing header message IDs are not equal!');\n }\n return response as any;\n } catch {\n this.log.error(`Cannot parse request: ${request}`);\n }\n }\n return { error: 'Service is disabled' };\n } else if (request?.error) {\n // answer from alexa3 events cloud actually just show it in log\n if (request.error.includes('You have no iobroker.iot license')) {\n // pause for 30 minutes send of the events\n this.alexaSH3?.pauseEvents();\n }\n this.log.error(`Error from Alexa events cloud: ${request.error}`);\n } else if (request && !request.header) {\n if (this.alexaCustom) {\n return this.alexaCustom.process(request, this.config.amazonCustom);\n }\n return { error: 'Service is disabled' };\n } else {\n if (this.alexaSH2) {\n return this.alexaSH2.process(request, this.config.amazonAlexa) as any;\n }\n return { error: 'Service is disabled' };\n }\n } else if (type.startsWith('ifttt')) {\n try {\n if (typeof request === 'object') {\n request = JSON.stringify(request);\n } else {\n request = request.toString();\n }\n } catch {\n this.log.error(`Cannot parse request: ${request}`);\n return { error: 'Cannot parse request' };\n }\n this.log.debug(`IFTTT request: ${JSON.stringify(request)}`);\n\n await this.processIfttt(request);\n return NONE;\n } else if (type.startsWith('ghome')) {\n if (typeof request === 'string') {\n try {\n request = JSON.parse(request);\n } catch {\n this.log.error(`Cannot parse request: ${request}`);\n return { error: 'Cannot parse request' };\n }\n }\n this.log.debug(`[GHOME] request: ${JSON.stringify(request)}`);\n\n if (this.googleHome) {\n return this.googleHome.process(request, this.config.googleHome);\n }\n return { error: 'Service is disabled' };\n } else if (type.startsWith('alisa')) {\n if (typeof request === 'string') {\n try {\n request = JSON.parse(request);\n } catch {\n this.log.error(`Cannot parse request: ${request}`);\n return { error: 'Cannot parse request' };\n }\n }\n this.log.debug(`[ALISA] request: ${JSON.stringify(request)}`);\n\n this.log.debug(`${Date.now()} ALISA: ${JSON.stringify(request)}`);\n if (this.yandexAlisa) {\n return this.yandexAlisa.process(request, this.config.yandexAlisa) as any;\n }\n return { error: 'Service is disabled' };\n } else {\n let isCustom = false;\n let _type = type;\n if (_type.match(/^custom_/)) {\n _type = _type.substring(7);\n isCustom = true;\n }\n if (_type === 'visu') {\n this.log.debug(`Received visu command: ${JSON.stringify(request)}`);\n if (typeof request === 'object') {\n request = JSON.stringify(request);\n } else {\n request = request.toString();\n }\n\n try {\n const visuData = JSON.parse(request);\n\n if (visuData.presence) {\n await handleGeofenceData(visuData, this);\n }\n\n if (visuData.devices) {\n await handleDevicesData(visuData, this);\n }\n\n if (visuData.command === 'getInstances') {\n const res = await handleGetInstances(visuData, this);\n return { result: 'Ok', ...res };\n }\n\n if (visuData.command === 'sendToAdapter') {\n return await handleSendToAdapter(visuData, this);\n }\n } catch (e) {\n this.log.error(`Could not handle data \"${request}\" by Visu App: ${e.message}`);\n return { error: e.message };\n }\n\n return { result: 'Ok' };\n } else if (\n this.config.allowedServices[0] === '*' ||\n this.config.allowedServices.includes(_type) ||\n ALLOWED_SERVICES.includes(_type)\n ) {\n if (typeof request === 'object') {\n request = JSON.stringify(request);\n } else {\n request = request.toString();\n }\n this.log.debug(`Custom request: ${JSON.stringify(request)}`);\n\n if (SPECIAL_ADAPTERS.includes(_type)) {\n try {\n await this.setStateAsync(`services.${_type}`, request, true);\n } catch (err) {\n return { result: err };\n }\n\n return { result: 'Ok' };\n } else if (type.startsWith('text2command')) {\n if (this.config.text2command !== undefined && (this.config.text2command as string) !== '') {\n try {\n await this.setForeignStateAsync(`text2command.${this.config.text2command}.text`, request);\n } catch (err) {\n return { result: err };\n }\n return { result: 'Ok' };\n }\n this.log.warn('Received service text2command, but instance is not defined');\n return { result: 'but instance is not defined' };\n } else if (type.startsWith('simpleApi')) {\n return { result: 'not implemented' };\n } else if (isCustom) {\n let obj;\n try {\n obj = await this.getObjectAsync(`services.custom_${_type}`);\n } catch (e) {\n this.log.error(`Cannot get object services.custom_${_type}: ${e}`);\n }\n\n if (!obj) {\n try {\n await this.setObjectNotExistsAsync(`services.custom_${_type}`, {\n _id: `${this.namespace}.services.custom_${_type}`,\n type: 'state',\n common: {\n name: `Service for ${_type}`,\n write: false,\n read: true,\n type: 'mixed',\n role: 'value',\n },\n native: {},\n });\n await this.setStateAsync(`services.custom_${_type}`, request, true);\n } catch (err) {\n this.log.error(`Cannot control .services.custom_${_type}: ${JSON.stringify(err)}`);\n return { error: err };\n }\n } else {\n await this.setStateAsync(`services.custom_${_type}`, request, true);\n return { result: 'Ok' };\n }\n } else {\n this.log.warn(`Received service \"${type}\", but it is not allowed`);\n return { error: 'not allowed' };\n }\n } else {\n this.log.warn(`Received service \"${type}\", but it is not found in whitelist`);\n return { error: 'Unknown service' };\n }\n }\n\n this.log.warn(`Received message of unknown type: ${type}`);\n return { error: 'Unknown message type' };\n }\n\n closeDevice(): Promise<void> {\n return new Promise<void>(resolve => {\n if (this.device) {\n try {\n this.device.end(true, () => {\n this.device = null;\n resolve();\n });\n } catch {\n this.device = null;\n resolve();\n }\n } else {\n resolve();\n }\n });\n }\n\n async startDevice(clientId: string, login: string, password: string, retry?: number): Promise<void> {\n retry ||= 0;\n let certs:\n | {\n private: string;\n certificate: string;\n }\n | undefined;\n\n try {\n certs = await this.readCertificates();\n } catch (error) {\n if (error.message === 'Not exists') {\n try {\n certs = await this.fetchCertificates(login, password);\n } catch {\n // ignore\n }\n } else {\n throw error;\n }\n }\n\n // destroy the old device\n await this.closeDevice();\n\n if (!certs) {\n return this.log.error(`Cannot read connection certificates`);\n }\n\n try {\n this.connectStarted = Date.now();\n this.device = new DeviceModule({\n privateKey: Buffer.from(certs.private),\n clientCert: Buffer.from(certs.certificate),\n caCert: readFileSync(`${__dirname}/../keys/root-CA.crt`),\n clientId,\n username: 'ioBroker',\n host: this.config.cloudUrl,\n debug: !!this.config.debug,\n baseReconnectTimeMs: 5000,\n keepalive: 60,\n });\n this.remote?.registerDevice(this.device);\n\n this.device.subscribe(`command/${clientId}/#`);\n this.device.on('connect', () => this.onConnect(clientId));\n this.device.on('close', (): void => this.onDisconnect());\n this.device.on('reconnect', () => this.log.debug('reconnect'));\n this.device.on('offline', () => this.log.debug('offline'));\n this.device.on('error', error => {\n const errorTxt =\n ((error as Error)?.message && JSON.stringify((error as Error).message)) || JSON.stringify(error);\n this.log.error(`Error by device connection: ${errorTxt}`);\n\n // restart the iot device if DNS cannot be resolved\n if (errorTxt.includes('EAI_AGAIN')) {\n this.log.error(\n `DNS name of ${this.config.cloudUrl} cannot be resolved: connection will be retried in 10 seconds.`,\n );\n setTimeout(() => this.startDevice(clientId, login, password), 10000);\n }\n });\n\n this.device.on('message', async (topic: string, request: string | Buffer): Promise<void> => {\n this.log.debug(`Request ${topic}`);\n if (topic.startsWith(`command/${clientId}/`)) {\n const type = topic.substring(clientId.length + 9); // 9 === 'command//'.length\n\n try {\n const response = await this.processMessage(type, request);\n\n if (this.common!.loglevel === 'debug' && !type.startsWith('remote')) {\n this.log.debug(`Response: ${JSON.stringify(response)}`);\n }\n\n if (this.device && response !== NONE) {\n // It is a big file - send in trunks\n if (Array.isArray(response)) {\n try {\n for (let m = 0; m < response.length; m++) {\n const trunk = response[m];\n await new Promise<void>((resolve, reject) =>\n this.device!.publish(\n `response/${clientId}/${type}`,\n typeof trunk !== 'string' ? JSON.stringify(trunk) : trunk,\n { qos: 1 },\n error => {\n if (error) {\n reject(error);\n } else {\n resolve();\n }\n },\n ),\n );\n }\n } catch (err) {\n this.log.error(`[REMOTE] Cannot send packet: ${err}`);\n }\n } else {\n const printResponse = JSON.parse(JSON.stringify(response));\n if (printResponse?.event?.header?.correlationToken) {\n printResponse.event.header.correlationToken = '***';\n }\n if (printResponse?.event?.endpoint?.scope?.token) {\n printResponse.event.endpoint.scope.token = '***';\n }\n this.log.debug(\n `[REMOTE] Response to 'response/${clientId}/${type}: ${JSON.stringify(\n printResponse,\n )}`,\n );\n\n const msg = JSON.stringify(response);\n if (msg && msg.length > MAX_IOT_MESSAGE_LENGTH) {\n const packed = deflateSync(msg).toString('base64');\n this.log.debug(\n `[REMOTE] Content was packed from ${msg.length} bytes to ${packed.length} bytes`,\n );\n if (packed.length > MAX_IOT_MESSAGE_LENGTH) {\n this.log.warn(\n `[REMOTE] Content was packed to ${packed.length} bytes which is still near/over the message limit!`,\n );\n }\n this.device.publish(`response/${clientId}/${type}`, packed);\n } else {\n // console.log(`Publish to \"response/${clientId}/${type}\": ${msg}`);\n this.device.publish(`response/${clientId}/${type}`, msg);\n }\n }\n }\n } catch (error) {\n this.log.debug(`Error processing request ${topic}`);\n this.log.debug(`${error}`);\n }\n }\n });\n } catch (error) {\n if (error && typeof error === 'object' && error.message) {\n this.log.error(`Cannot read connection certificates: ${error.message}`);\n } else {\n this.log.error(\n `Cannot read connection certificates: ${JSON.stringify(error)} / ${error && error.toString()}`,\n );\n }\n\n if ((error === 'timeout' || error.message?.includes('timeout')) && retry < 10) {\n setTimeout(() => this.startDevice(clientId, login, password, retry + 1), 10000);\n }\n }\n }\n\n async updateNightscoutSecret(): Promise<void> {\n if (!this.config.nightscout) {\n return;\n }\n\n const email = this.config.login.replace(/[^\\w\\d-_]/g, '_');\n const secret = this.config.nightscoutPass;\n const apiSecret = email + (secret ? `-${secret}` : '');\n const URL = `https://generate-key.iobroker.in/v1/generateUrlKey?user=${encodeURIComponent(this.config.login)}&pass=${encodeURIComponent(this.config.pass)}&apisecret=${encodeURIComponent(apiSecret)}`;\n let response;\n\n try {\n response = await axios.get(URL, {\n timeout: 15000,\n validateStatus: status => status < 400,\n });\n if (response.data.error) {\n this.log.error(`Api-Secret cannot be updated: ${response.data.error}`);\n } else {\n this.log.debug(`Api-Secret updated: ${JSON.stringify(response.data)}`);\n }\n } catch (error) {\n if (error.response) {\n this.log.warn(\n `Cannot update api-secret: ${error.response.data ? JSON.stringify(error.response.data) : error.response.status}`,\n );\n } else {\n this.log.warn(`Cannot update api-secret: ${error.code}`);\n }\n }\n }\n\n async createStateForAdapter(adapterName: string): Promise<void> {\n // find any instance of this adapter\n const instances = await this.getObjectViewAsync('system', 'instance', {\n startkey: `system.adapter.${adapterName}.`,\n endkey: `system.adapter.${adapterName}.\\u9999`,\n });\n if (instances?.rows?.length) {\n let obj;\n try {\n obj = await this.getObjectAsync(`service.${adapterName}`);\n } catch {\n // ignore\n }\n if (!obj) {\n try {\n await this.setForeignObjectAsync(`${this.namespace}.services.${adapterName}`, {\n type: 'state',\n common: {\n name: `Service for ${adapterName}`,\n write: false,\n read: true,\n type: 'mixed',\n role: 'value',\n },\n native: {},\n });\n } catch {\n // ignore\n }\n }\n } else {\n try {\n // delete if object exists\n const obj = await this.getObjectAsync(`service.${adapterName}`);\n if (obj) {\n await this.delObjectAsync(`service.${adapterName}`);\n }\n } catch {\n // ignore\n }\n }\n }\n\n async main(): Promise<void> {\n if (this.config.googleHome === undefined) {\n this.config.googleHome = false;\n }\n\n if (this.config.amazonAlexa === undefined) {\n this.config.amazonAlexa = true;\n }\n\n if (this.config.yandexAlisa === undefined) {\n this.config.yandexAlisa = false;\n }\n\n // Workaround for amazonCustom\n if (this.config.amazonCustom === undefined) {\n // get current config\n const obj = await this.getForeignObjectAsync(`system.adapter.${this.namespace}`);\n if (obj) {\n this.log.info(\n `Migrating amazonCustom configuration to ${this.config.amazonAlexa || this.config.amazonAlexaV3}`,\n );\n obj.native.amazonCustom = !!(this.config.amazonAlexa || this.config.amazonAlexaV3);\n await this.setForeignObjectAsync(`system.adapter.${this.namespace}`, obj);\n return;\n }\n }\n\n this.config.pingTimeout = parseInt(this.config.pingTimeout as string, 10) || 5000;\n\n if (this.config.pingTimeout < 3000) {\n this.config.pingTimeout = 3000;\n }\n\n if (this.config.deviceOffLevel === undefined) {\n this.config.deviceOffLevel = 30;\n }\n\n if (this.config.login !== (this.config.login || '').trim().toLowerCase()) {\n this.log.error('Please write your login only in lowercase!');\n }\n if (!this.config.login || !this.config.pass) {\n return this.log.error('No cloud credentials found. Please get one on https://iobroker.pro');\n }\n\n let systemConfig = await this.getForeignObjectAsync('system.config');\n if (!systemConfig) {\n this.log.warn('Object system.config not found. Please check your installation!');\n systemConfig = { common: {} } as ioBroker.SystemConfigObject;\n }\n\n // create service state for netatmo if any instance exists\n for (let a = 0; a < SPECIAL_ADAPTERS.length; a++) {\n await this.createStateForAdapter(SPECIAL_ADAPTERS[a]);\n }\n\n this.secret = systemConfig?.native?.secret || 'Zgfr56gFe87jJOM';\n\n this.config.pass = this.decryptOwn(this.secret, this.config.pass);\n this.config.deviceOffLevel = parseFloat(this.config.deviceOffLevel as string) || 0;\n this.config.concatWord = (this.config.concatWord || '').toString().trim();\n this.config.apikey = (this.config.apikey || '').trim();\n this.config.replaces = this.config.replaces ? (this.config.replaces as string).split(',') : null;\n this.config.cloudUrl = (this.config.cloudUrl || '').toString();\n this.config.nightscout = this.config.nightscout || '';\n\n if (this.config.replaces) {\n const text: string[] = [];\n for (let r = 0; r < this.config.replaces.length; r++) {\n text.push(`\"${this.config.replaces[r]}\"`);\n }\n this.log.debug(`Following strings will be replaced in names: ${text.join(', ')}`);\n }\n if (this.config.yandexAlisa) {\n this.yandexAlisa = new YandexAlisa(this);\n }\n\n this.remote = new Remote(this, this.config.login.replace(/[^-_:a-zA-Z1-9]/g, '_'));\n\n this.config.allowedServices = ((this.config.allowedServices as string) || '')\n .split(/[,\\s]+/)\n .map(s => s.trim())\n .filter(s => s);\n\n await this.setStateAsync('info.connection', false, true);\n this.config.cloudUrl = this.config.cloudUrl || 'a18wym7vjdl22g.iot.eu-west-1.amazonaws.com';\n\n if (!this.config.login || !this.config.pass) {\n return this.log.error('No cloud credentials found. Please get one on https://iobroker.pro');\n }\n\n if (this.config.iftttKey) {\n await this.subscribeStatesAsync('services.ifttt');\n // create ifttt object\n const iftttObj = await this.getObjectAsync('.services.ifttt');\n if (!iftttObj) {\n await this.setObjectNotExistsAsync('services.ifttt', {\n _id: `${this.namespace}.services.ifttt`,\n type: 'state',\n common: {\n name: 'IFTTT value',\n write: true,\n role: 'state',\n read: true,\n type: 'mixed',\n desc: 'All written data will be sent to IFTTT. If no state specified all requests from IFTTT will be saved here',\n },\n native: {},\n });\n }\n }\n\n // detect netatmo creation\n await this.subscribeForeignObjectsAsync('system.adapter.*');\n\n await this.subscribeStatesAsync('smart.*');\n\n this.log.info(`Connecting with ${this.config.cloudUrl}`);\n\n if (this.config.language) {\n this.translate = true;\n this.lang = this.config.language;\n } else {\n this.lang = systemConfig.common.language;\n }\n\n if (this.lang !== 'en' && this.lang !== 'de' && this.lang !== 'ru') {\n this.lang = 'en';\n }\n\n if (this.config.amazonAlexa) {\n this.alexaSH2 = new AlexaSH2(this);\n this.alexaSH2.setLanguage(this.lang, this.translate);\n this.alexaSH2.updateDevices();\n } else {\n // Check that update result is empty\n const state = await this.getStateAsync('smart.updatesResult');\n if (state?.val) {\n await this.setStateAsync('smart.updatesResult', '', true);\n }\n }\n\n this.remote?.setLanguage(this.lang);\n // check password\n if (\n this.config.pass.length < 8 ||\n !this.config.pass.match(/[a-z]/) ||\n !this.config.pass.match(/[A-Z]/) ||\n !this.config.pass.match(/\\d/)\n ) {\n return this.log.error(\n 'The password must be at least 8 characters long and have numbers, upper and lower case letters. Please change the password in the profile https://iobroker.pro/accountProfile.',\n );\n }\n\n await this.updateNightscoutSecret();\n\n const iotClientId = this.config.login.replace(/[^-_:a-zA-Z1-9]/g, '_');\n // user will be created here\n await this.startDevice(iotClientId, this.config.login, this.config.pass);\n\n // after the user created, we can try to generate URL key\n // read URL keys from server\n try {\n this.urlKey = await this.readUrlKey();\n } catch {\n if (\n this.config.googleHome ||\n this.config.yandexAlisa ||\n this.config.allowedServices.length ||\n this.config.iftttKey\n ) {\n try {\n this.urlKey = await this.createUrlKey(this.config.login, this.config.pass);\n } catch (err) {\n return this.log.error(\n `Cannot read URL key: ${typeof err === 'object' ? JSON.stringify(err) : err}`,\n );\n }\n }\n }\n\n if (this.config.amazonAlexaV3) {\n this.alexaSH3 = new AlexaSH3({\n adapter: this,\n iotClientId,\n iotDevice: this.device!,\n });\n this.alexaSH3.setLanguage(this.lang);\n await this.alexaSH3.updateDevices();\n } else {\n // Check that update result is empty\n const state = await this.getStateAsync('smart.updates3');\n if (state?.val) {\n await this.setStateAsync('smart.updates3', '', true);\n }\n }\n\n if (this.config.amazonCustom) {\n this.alexaCustom = new AlexaCustom(this);\n this.alexaCustom.setLanguage(this.lang);\n }\n\n if (this.config.googleHome) {\n this.googleHome = new GoogleHome(this, this.urlKey);\n } else {\n // Check that update result is empty\n const state = await this.getStateAsync('smart.updatesGH');\n if (state?.val) {\n await this.setStateAsync('smart.updatesGH', '', true);\n }\n }\n if (this.config.yandexAlisa) {\n this.yandexAlisa = new YandexAlisa(this, this.urlKey);\n } else {\n // Check that update result is empty\n const state = await this.getStateAsync('smart.updatesYA');\n if (state?.val) {\n await this.setStateAsync('smart.updatesYA', '', true);\n }\n }\n\n this.googleHome?.setLanguage(this.lang);\n this.googleHome?.updateDevices();\n\n this.yandexAlisa?.setLanguage(this.lang);\n this.yandexAlisa?.updateDevices();\n\n await this.subscribeStatesAsync('app.message');\n }\n}\n\nif (require.main !== module) {\n // Export the constructor in compact mode\n module.exports = (options: Partial<AdapterOptions> | undefined) => new IotAdapter(options);\n} else {\n // otherwise start the instance directly\n (() => new IotAdapter())();\n}\n"]}
|
|
1
|
+
{"version":3,"file":"main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U,EAAE,aAAa,EAAE,CAAC;QAEjC,IAAI,CAAC,WAAW,EAAE,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACzC,IAAI,CAAC,WAAW,EAAE,aAAa,EAAE,CAAC;QAElC,MAAM,IAAI,CAAC,oBAAoB,CAAC,aAAa,CAAC,CAAC;IACnD,CAAC;CACJ;AArkDD,gCAqkDC;AAED,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;IAC1B,yCAAyC;IACzC,MAAM,CAAC,OAAO,GAAG,CAAC,OAA4C,EAAE,EAAE,CAAC,IAAI,UAAU,CAAC,OAAO,CAAC,CAAC;AAC/F,CAAC;KAAM,CAAC;IACJ,wCAAwC;IACxC,CAAC,GAAG,EAAE,CAAC,IAAI,UAAU,EAAE,CAAC,EAAE,CAAC;AAC/B,CAAC","sourcesContent":["import { device as DeviceModule } from 'aws-iot-device-sdk';\nimport { Adapter, type AdapterOptions } from '@iobroker/adapter-core'; // Get common adapter utils\nimport { readFileSync } from 'node:fs';\nimport axios from 'axios';\nimport { deflateSync } from 'node:zlib';\n\n// @ts-expect-error no types\nimport AlexaSH2 from './lib/alexaSmartHomeV2';\nimport AlexaSH3 from './lib/alexaSmartHomeV3';\nimport AlexaCustom, { type AlexaCustomResponse } from './lib/alexaCustom';\n// @ts-expect-error no types\nimport GoogleHome from './lib/googleHome';\n// @ts-expect-error no types\nimport YandexAlisa from './lib/alisa';\nimport Remote, { type SOCKET_MESSAGE, type SOCKET_TRUNK } from './lib/remote';\nimport { handleGeofenceData, handleDevicesData, handleSendToAdapter, handleGetInstances } from './lib/visuApp';\nimport { buildMessageFromNotification } from './lib/notifications';\nimport type { IotAdapterConfig } from './lib/types';\n\nconst NONE = '___none___';\nconst MAX_IOT_MESSAGE_LENGTH = 127 * 1024;\nconst SPECIAL_ADAPTERS = ['netatmo'];\nconst ALLOWED_SERVICES = SPECIAL_ADAPTERS.concat(['text2command']);\n\nexport class IotAdapter extends Adapter {\n declare public config: IotAdapterConfig;\n private recalcTimeout: NodeJS.Timeout | null = null;\n private lang: ioBroker.Languages = 'de';\n private translate = false;\n private alexaSH2: AlexaSH2 | null = null;\n private alexaSH3: AlexaSH3 | null = null;\n private googleHome: GoogleHome | null = null;\n private alexaCustom: AlexaCustom | null = null;\n private yandexAlisa: YandexAlisa | null = null;\n private remote: Remote | null = null;\n private device: DeviceModule | null = null;\n private urlKey: { key: string } | null = null;\n\n private connectedOwn = false;\n private secret: string = '';\n private connectStarted = 0;\n\n public constructor(options: Partial<AdapterOptions> = {}) {\n super({\n ...options,\n name: 'iot',\n objectChange: (id, obj) => {\n if (id === 'system.config' && obj && !this.translate) {\n const systemObj = obj as ioBroker.SystemConfigObject;\n this.lang = systemObj.common.language;\n\n if (this.lang !== 'en' && this.lang !== 'de' && this.lang !== 'ru') {\n this.lang = 'en';\n }\n\n this.alexaSH2?.setLanguage(this.lang);\n this.alexaSH3?.setLanguage(this.lang);\n this.yandexAlisa?.setLanguage(this.lang);\n this.alexaCustom?.setLanguage(this.lang);\n this.googleHome?.setLanguage(this.lang);\n this.remote?.setLanguage(this.lang);\n }\n // if it is an instance\n if (id.startsWith('system.adapter.')) {\n // try to find it in special adapters\n const adpr = SPECIAL_ADAPTERS.find(a => id.startsWith(`system.adapter.${a}.`));\n // if found and it is really instance\n if (adpr && id.match(/\\.\\d+$/)) {\n // update state\n setTimeout(async () => await this.createStateForAdapter(adpr), 1000);\n }\n\n return;\n }\n void this.alexaSH3?.handleObjectChange(id, obj);\n\n if (id) {\n this.remote?.updateObject(id, obj);\n }\n },\n stateChange: async (id, state) => {\n if (id === `${this.namespace}.app.message` && state && !state.ack) {\n try {\n await this.sendMessageToApp(state.val as string);\n } catch (e) {\n this.log.error(`Cannot send message to app: ${e}`);\n }\n }\n\n if (state) {\n if (this.config.googleHome) {\n void this.googleHome?.updateState(id, state);\n }\n if (this.config.amazonAlexa) {\n void this.alexaSH3?.handleStateUpdate(id, state);\n }\n\n if (this.config.yandexAlisa) {\n void this.yandexAlisa?.updateState?.(id, state);\n }\n }\n\n if (id) {\n this.remote?.updateState(id, state);\n }\n\n if (id === `${this.namespace}.smart.lastResponse` && state && !state.ack) {\n this.alexaCustom?.setResponse(state.val as string);\n }\n },\n unload: async callback => {\n try {\n if (this.device) {\n this.device.end();\n this.device = null;\n }\n if (this.remote) {\n this.remote.destroy();\n this.remote = null;\n }\n\n if (this.alexaSH3) {\n await this.alexaSH3.destroy();\n }\n } catch {\n // ignore\n }\n callback();\n },\n message: async obj => {\n if (obj) {\n switch (obj.command) {\n case 'update':\n if (this.recalcTimeout) {\n clearTimeout(this.recalcTimeout);\n }\n\n this.recalcTimeout = setTimeout(async () => {\n this.recalcTimeout = null;\n this.alexaSH2?.updateDevices(\n obj.message,\n async (analyseAddedId: any): Promise<void> => {\n await this.setStateAsync('smart.updatesResult', analyseAddedId || '', true);\n this.log.debug('Devices updated!');\n await this.setStateAsync('smart.updates', true, true);\n },\n );\n\n // this.alexaSH3 && this.alexaSH3.updateDevices(obj.message, async analyseAddedId => {\n // await this.setStateAsync('smart.updatesResult', analyseAddedId || '', true);\n // await this.setStateAsync('smart.updates3', true, true);\n // });\n if (this.alexaSH3) {\n await this.alexaSH3.updateDevices();\n await this.setStateAsync('smart.updates3', true, true);\n }\n\n this.googleHome?.updateDevices(async (analyseAddedId: any): Promise<void> => {\n await this.setStateAsync('smart.updatesResult', analyseAddedId || '', true);\n this.log.debug('GH Devices updated!');\n await this.setStateAsync('smart.updatesGH', true, true);\n });\n }, 1000);\n break;\n\n case 'browse':\n if (obj.callback) {\n this.log.info('Request devices');\n if (this.alexaSH2) {\n this.alexaSH2.updateDevices(() => {\n this.sendTo(obj.from, obj.command, this.alexaSH2!.getDevices(), obj.callback);\n void this.setState('smart.updates', false, true);\n });\n } else {\n this.sendTo(obj.from, obj.command, { error: 'not activated' }, obj.callback);\n }\n }\n break;\n\n case 'browse3':\n if (obj.callback) {\n this.log.info('Request V3 devices');\n if (this.alexaSH3) {\n const devices = await this.alexaSH3.getDevices();\n this.sendTo(obj.from, obj.command, devices, obj.callback);\n await this.setStateAsync('smart.updates3', false, true);\n } else {\n this.sendTo(obj.from, obj.command, { error: 'not activated' }, obj.callback);\n }\n }\n break;\n\n case 'browseGH':\n if (obj.callback) {\n this.log.info('Request google home devices');\n if (this.googleHome) {\n this.googleHome.updateDevices(() => {\n this.sendTo(obj.from, obj.command, this.googleHome!.getDevices(), obj.callback);\n void this.setStateAsync('smart.updatesGH', false, true);\n });\n } else {\n this.sendTo(obj.from, obj.command, { error: 'not activated' }, obj.callback);\n }\n }\n break;\n\n case 'browseAlisa':\n if (obj.callback) {\n this.log.info('Request Yandex Alice devices');\n if (this.yandexAlisa) {\n this.yandexAlisa.updateDevices(() => {\n this.sendTo(\n obj.from,\n obj.command,\n this.yandexAlisa!.getDevices(),\n obj.callback,\n );\n void this.setStateAsync('smart.updatesYA', false, true);\n });\n } else {\n this.sendTo(obj.from, obj.command, { error: 'not activated' }, obj.callback);\n }\n }\n break;\n\n case 'alexaCustomKnownDevices':\n // Admin UI can request the known/discoveredAlexa devices used via Custom skill\n // Allow setting the rooms of the devices and store in adapter config\n // Restart adapter after change - or we also add a set message to the config\n if (obj.callback) {\n this.log.info('Request Alexa Custom known devices');\n this.sendTo(\n obj.from,\n obj.command,\n this.alexaCustom ? this.alexaCustom.getKnownDevices() : { error: 'not activated' },\n obj.callback,\n );\n }\n break;\n\n case 'alexaCustomKnownUsers':\n // Admin UI can request the known/discoveredAlexa users used via Custom skill\n // Allow setting the names of the users and store in adapter config\n // Restart adapter after change - or we also add a set message to the config\n if (obj.callback) {\n this.log.info('Request Alexa Custom known users');\n this.sendTo(\n obj.from,\n obj.command,\n this.alexaCustom ? this.alexaCustom.getKnownUsers() : { error: 'not activated' },\n obj.callback,\n );\n }\n break;\n\n case 'private': {\n if (typeof obj.message !== 'object') {\n try {\n obj.message = JSON.parse(obj.message);\n } catch (e) {\n this.log.error(`Cannot parse object: ${e}`);\n obj.callback &&\n this.sendTo(\n obj.from,\n obj.command,\n { error: 'Invalid message format: cannot parse object' },\n obj.callback,\n );\n return;\n }\n }\n const response = await this.processMessage(obj.message.type, obj.message.request);\n if (obj.callback) {\n this.sendTo(obj.from, obj.command, response, obj.callback);\n }\n\n break;\n }\n case 'ifttt':\n this.sendDataToIFTTT(obj.message);\n break;\n\n case 'alexaCustomResponse':\n this.alexaCustom?.setResponse(obj.message);\n break;\n\n case 'debug':\n this.alexaSH2?.getDebug((data: any): void =>\n this.sendTo(obj.from, obj.command, data, obj.callback),\n );\n break;\n\n case 'getServiceEndpoint':\n if (obj.callback) {\n if (!this.urlKey) {\n try {\n this.urlKey = await this.readUrlKey();\n } catch {\n try {\n this.urlKey = await this.createUrlKey(this.config.login, this.config.pass);\n } catch (err) {\n return (\n obj.callback &&\n this.sendTo(\n obj.from,\n obj.command,\n { error: `Cannot get urlKey: ${err.toString()}` },\n obj.callback,\n )\n );\n }\n }\n }\n\n const result: {\n url: string;\n stateID?: string;\n data?: string;\n warning?: string;\n } = {\n url: `https://service.iobroker.in/v1/iotService?key=${this.urlKey.key}&user=${encodeURIComponent(this.config.login)}`,\n };\n const serviceName =\n typeof obj.message === 'string' ? obj.message : obj.message?.serviceName;\n if (serviceName) {\n result.url += `&service=${encodeURIComponent(serviceName)}`;\n result.stateID = `${this.namespace}.services.${serviceName}`;\n }\n if (obj.message?.data) {\n result.data += `&data=${typeof obj.message.data === 'object' ? JSON.stringify(obj.message.data) : obj.message.data}`;\n }\n // check if the service name is in the white list\n if (\n serviceName &&\n this.config.allowedServices[0] !== '*' &&\n !this.config.allowedServices.includes(serviceName.replace(/^custom_/, '')) &&\n !ALLOWED_SERVICES.includes(serviceName)\n ) {\n result.warning = 'Service name is not in white list';\n this.log.warn(`Service \"${serviceName}\" is not in allowed services list`);\n }\n\n if (obj.callback) {\n this.sendTo(obj.from, obj.command, result, obj.callback);\n }\n }\n break;\n case 'sendNotification':\n try {\n const { message, title } = buildMessageFromNotification(obj.message);\n await this.sendMessageToApp(JSON.stringify({ message, title }));\n if (obj.callback) {\n this.sendTo(obj.from, 'sendNotification', { sent: true }, obj.callback);\n }\n } catch {\n if (obj.callback) {\n this.sendTo(obj.from, 'sendNotification', { sent: false }, obj.callback);\n }\n }\n break;\n default:\n this.log.warn(`Unknown command: ${obj.command}`);\n break;\n }\n }\n },\n ready: () =>\n this.main()\n .then(() => {})\n .catch(error => {\n this.log.error(`Error in main: ${error.toString()}`);\n }),\n });\n\n // warning: `this.log = obj => console.log(obj)` does not implemented. Only this.on('log', obj => console.log(obj))\n this.on('log', obj => this.remote?.onLog(obj));\n }\n\n sendDataToIFTTT(obj: {\n event?: string;\n key?: string;\n id?: string;\n val?: ioBroker.StateValue;\n ack?: boolean;\n }): void {\n if (!obj) {\n this.log.warn('No data to send to IFTTT');\n return;\n }\n if (!this.config.iftttKey && (typeof obj !== 'object' || !obj.key)) {\n this.log.warn('No IFTTT key is defined');\n return;\n }\n\n let url;\n let data;\n if (typeof obj !== 'object') {\n url = `https://maker.ifttt.com/trigger/state/with/key/${this.config.iftttKey}`;\n data = {\n value1: `${this.namespace}.services.ifttt`,\n value2: obj,\n };\n } else if (obj.event) {\n const event = obj.event;\n const key = obj.key;\n delete obj.event;\n delete obj.key;\n url = `https://maker.ifttt.com/trigger/${event}/with/key/${key || this.config.iftttKey}`;\n data = obj;\n } else if (obj.val === undefined) {\n return this.log.warn('No value is defined');\n } else {\n obj.id = obj.id || `${this.namespace}.services.ifttt`;\n url = `https://maker.ifttt.com/trigger/state/with/key/${this.config.iftttKey}`;\n data = {\n value1: obj.id,\n value2: obj.val,\n value3: obj.ack,\n };\n }\n\n if (url) {\n axios\n .post(url, data, {\n timeout: 15000,\n validateStatus: status => status < 400,\n })\n .then(response => this.log.debug(`Response from IFTTT: ${JSON.stringify(response.data)}`))\n .catch(error => {\n if (error.response) {\n this.log.warn(\n `Response from IFTTT: ${error.response.data ? JSON.stringify(error.response.data) : error.response.status}`,\n );\n } else {\n this.log.warn(`Response from IFTTT: ${error.code}`);\n }\n });\n } else {\n this.log.warn(`Invalid request to IFTTT: ${JSON.stringify(obj)}`);\n }\n }\n\n /**\n * Send a message to the ioBroker Visu App by using the app-message endpoint (which then forwards it to the app via FCM)\n *\n * @param message either a json string or the message itself, if the message itself the other props will be taken from the adapter states\n */\n async sendMessageToApp(message: string): Promise<void> {\n if (!message) {\n throw new Error('Empty message');\n }\n const trimmedMessage = message.toString().trim();\n let json: {\n message: string;\n title: string;\n priority?: 'high';\n ttlSeconds?: number;\n expire?: number;\n } | null;\n if (trimmedMessage.startsWith('{') && trimmedMessage.endsWith('}')) {\n try {\n json = JSON.parse(trimmedMessage);\n } catch {\n this.log.warn(`Cannot parse message: ${trimmedMessage}`);\n json = null;\n }\n } else {\n json = null;\n }\n\n if (!json) {\n // take expires\n const ttlSecondsState = await this.getStateAsync(`${this.namespace}.app.expire`);\n const priorityState = await this.getStateAsync(`${this.namespace}.app.priority`);\n const titleState = await this.getStateAsync(`${this.namespace}.app.title`);\n const priorityVal = priorityState?.val;\n json = {\n message: message.toString(),\n priority: priorityVal === '1' || priorityVal === 'high' || priorityVal === true ? 'high' : undefined,\n ttlSeconds: parseInt(ttlSecondsState?.val as string, 0) || undefined,\n title: ((titleState?.val as string) || 'ioBroker').toString(),\n };\n } else {\n if (json.expire) {\n json.ttlSeconds = json.expire;\n delete json.expire;\n }\n }\n\n json.ttlSeconds = parseInt(json.ttlSeconds as unknown as string, 0) || undefined;\n\n if (json.ttlSeconds && json.ttlSeconds > 3_600 * 48) {\n json.ttlSeconds = 3_600 * 48;\n }\n\n if (!json.message) {\n throw new Error('Empty message');\n }\n\n const response = await axios.post('https://app-message.iobroker.in/', json, {\n headers: {\n 'Content-Type': 'application/json',\n Authorization: `Bearer ${Buffer.from(`${this.config.login}:${this.config.pass}`).toString('base64')}`,\n },\n timeout: 5_000,\n validateStatus: status => status < 400,\n });\n await this.setState('app.message', message, true);\n this.log.debug(`Message sent: ${JSON.stringify(response.data)}`);\n }\n\n async controlState(\n id: string | null,\n data: string | { id?: string; val?: ioBroker.StateValue; ack?: boolean },\n ): Promise<void> {\n id ||= 'services.ifttt';\n\n if (typeof data === 'object') {\n if (data.id) {\n if (data.id === `${this.namespace}.services.ifttt`) {\n data.ack = true;\n }\n if (data.val === undefined) {\n throw new Error('No value set');\n }\n const obj = await this.getForeignObjectAsync(data.id);\n if (!obj || !obj.common) {\n throw new Error(`Unknown ID: ${data.id}`);\n } else {\n if (typeof data.val === 'string') {\n data.val = data.val.replace(/^@ifttt\\s?/, '');\n }\n if (obj.common.type === 'boolean') {\n data.val =\n data.val === true ||\n data.val === 'true' ||\n data.val === 'on' ||\n data.val === 'ON' ||\n data.val === 1 ||\n data.val === '1';\n } else if (obj.common.type === 'number') {\n data.val = parseFloat(data.val as string);\n }\n\n await this.setForeignStateAsync(data.id, data.val, data.ack);\n }\n } else if (data.val !== undefined) {\n if (typeof data.val === 'string') {\n data.val = data.val.replace(/^@ifttt\\s?/, '');\n }\n await this.setStateAsync(id, data.val, data.ack !== undefined ? data.ack : true);\n } else {\n await this.setStateAsync(id, JSON.stringify(data), true);\n }\n } else {\n if (typeof data === 'string') {\n data = data.replace(/^@ifttt\\s?/, '');\n }\n await this.setStateAsync(id, data, true);\n }\n }\n\n async processIfttt(data: {\n id?: string;\n data?:\n | string\n | {\n id?: string;\n val?: ioBroker.StateValue;\n ack?: boolean;\n data?: { id?: string; val?: ioBroker.StateValue; ack?: boolean } | string;\n };\n }): Promise<void> {\n this.log.debug(`Received IFTTT object: ${JSON.stringify(data)}`);\n let id: string | undefined;\n let dataObj: { id?: string; val?: ioBroker.StateValue; ack?: boolean } | null = null;\n // >If data is object with id and data property\n if (typeof data === 'object' && data.id && data.data !== undefined) {\n id = data.id;\n if (typeof data.data === 'string' && data.data[0] === '{') {\n try {\n dataObj = JSON.parse(data.data);\n } catch {\n this.log.debug(`Cannot parse: ${data.data}`);\n dataObj = data;\n }\n } else {\n dataObj = data.data as { id?: string; val?: ioBroker.StateValue; ack?: boolean };\n }\n } else if (typeof data === 'string' && data[0] === '{') {\n // If data is string and starts with {\n try {\n dataObj = JSON.parse(data) as { id?: string; val?: ioBroker.StateValue; ack?: boolean };\n\n if (typeof dataObj.id === 'string') {\n id = dataObj.id;\n if ((dataObj as any).data) {\n dataObj = (dataObj as any).data as {\n id?: string;\n val?: ioBroker.StateValue;\n ack?: boolean;\n };\n }\n }\n } catch {\n this.log.debug(`Cannot parse: ${JSON.stringify(data)}`);\n }\n } else {\n dataObj = data as { id?: string; val?: ioBroker.StateValue; ack?: boolean };\n }\n\n if (id) {\n let obj = await this.getForeignObjectAsync(id);\n if (!obj) {\n const newId = `${this.namespace}.services.${id}`;\n obj = await this.getForeignObjectAsync(newId);\n if (!obj) {\n // create state\n await this.setObjectNotExistsAsync(`services.${id}`, {\n type: 'state',\n common: {\n name: 'IFTTT value',\n write: false,\n role: 'state',\n read: true,\n type: 'mixed',\n desc: 'Custom state',\n },\n native: {},\n });\n id = newId;\n }\n }\n }\n\n await this.controlState(\n id || null,\n (dataObj as { id?: string; val?: ioBroker.StateValue; ack?: boolean }) || data,\n );\n }\n\n onDisconnect(event?: string): void {\n const now = Date.now();\n if (now - this.connectStarted < 500) {\n this.log.warn(\n 'Looks like your connection certificates are invalid. Please renew them via configuration dialog.',\n );\n }\n\n if (typeof event === 'string') {\n if (event.toLowerCase().includes('duplicate')) {\n // disable adapter\n this.log.error(\n `Two devices are trying to connect with the same iot account. This is not allowed. Stopping`,\n );\n void this.getForeignObjectAsync(`system.adapter.${this.namespace}`).then(obj => {\n if (obj) {\n obj.common.enabled = false;\n return this.setForeignObjectAsync(obj._id, obj);\n }\n });\n }\n this.log.info(`Connection changed: ${event}`);\n } else {\n this.log.info('Connection changed: disconnect');\n }\n\n if (this.connectedOwn) {\n this.log.info('Connection lost');\n this.connectedOwn = false;\n void this.setState('info.connection', false, true);\n }\n\n this.remote?.onCloudDisconnect();\n }\n\n onConnect(clientId: string): void {\n if (!this.connectedOwn) {\n this.log.info(`Connection changed: connect \"${clientId}\"`);\n this.connectedOwn = true;\n void this.setState('info.connection', this.connectedOwn, true);\n // setTimeout(() => {\n // device.publish(`response/${clientId}/stateChange`, JSON.stringify({alive: true}), {qos: 0}, (error, result) => {\n // console.log(`Published alive: ${result}, ${error}`);\n // });\n // }, 2000);\n } else {\n this.log.info('Connection not changed: was connected');\n }\n }\n\n encryptOwn(secret: string, value: string): string {\n let result = '';\n for (let i = 0; i < value.length; i++) {\n result += String.fromCharCode(secret[i % secret.length].charCodeAt(0) ^ value.charCodeAt(i));\n }\n return `base64:${Buffer.from(result).toString('base64')}`;\n }\n\n decryptOwn(secret: string, value: string): string {\n if (value.startsWith('base64:')) {\n try {\n value = Buffer.from(value.substring(7), 'base64').toString('ascii');\n } catch (e) {\n this.log.error(`Cannot decrypt key: ${e}`);\n }\n }\n\n let result = '';\n for (let i = 0; i < value.length; i++) {\n result += String.fromCharCode(secret[i % secret.length].charCodeAt(0) ^ value.charCodeAt(i));\n }\n return result;\n }\n\n async readUrlKey(): Promise<{ key: string }> {\n const key = await this.getStateAsync('certs.urlKey');\n\n if (!key?.val) {\n throw new Error('Not exists');\n } else {\n return { key: key.val as string };\n }\n }\n\n async createUrlKey(login: string, pass: string): Promise<{ key: string }> {\n this.log.debug('Fetching URL key...');\n\n let response;\n try {\n response = await axios.get(\n `https://generate-key.iobroker.in/v1/generateUrlKey?user=${encodeURIComponent(login)}&pass=${encodeURIComponent(pass)}&version=${this.version}`,\n {\n timeout: 15000,\n validateStatus: status => status < 400,\n },\n );\n } catch (error) {\n if (error.response) {\n if (error.response.status === 401) {\n this.log.error(`Cannot create URL key because of invalid user or password`);\n }\n\n throw new Error(error.response.data);\n } else {\n throw error;\n }\n }\n\n if (response.data && response.data.error) {\n this.log.error(`Cannot fetch URL key: ${JSON.stringify(response.data.error)}`);\n throw new Error(response.data);\n } else if (response.data && response.data.key) {\n await this.setStateAsync('certs.urlKey', response.data.key, true);\n return { key: response.data.key };\n } else {\n this.log.error(`Cannot fetch URL key: ${JSON.stringify(response.data)}`);\n throw new Error(response.data);\n }\n }\n\n async readCertificates(): Promise<{\n private: string;\n certificate: string;\n }> {\n let privateKey: ioBroker.State | null | undefined;\n let certificate: ioBroker.State | null | undefined;\n\n try {\n privateKey = await this.getStateAsync('certs.private');\n certificate = await this.getStateAsync('certs.certificate');\n } catch {\n throw new Error('Not exists');\n }\n\n if (!certificate?.val || !privateKey?.val) {\n throw new Error('Not exists');\n } else {\n return {\n private: this.decryptOwn(this.secret, privateKey.val as string),\n certificate: this.decryptOwn(this.secret, certificate.val as string),\n };\n }\n }\n\n async writeKeys(data: {\n certificateId: string;\n certificatePem: string;\n keyPair: { PublicKey: string; PrivateKey: string };\n }): Promise<void> {\n await this.setStateAsync('certs.private', this.encryptOwn(this.secret, data.keyPair.PrivateKey), true);\n await this.setStateAsync('certs.public', this.encryptOwn(this.secret, data.keyPair.PublicKey), true);\n await this.setStateAsync('certs.certificate', this.encryptOwn(this.secret, data.certificatePem), true);\n await this.setStateAsync('certs.id', data.certificateId, true);\n }\n\n async fetchCertificates(\n login: string,\n pass: string,\n _forceUserCreation?: boolean,\n ): Promise<{\n private: string;\n certificate: string;\n }> {\n const state = await this.getStateAsync('certs.forceUserCreate');\n const forceUserCreation = state?.val;\n\n if (forceUserCreation) {\n await this.setStateAsync('certs.forceUserCreate', false, true);\n }\n\n this.log.debug('Fetching certificates...');\n let response;\n try {\n response = await axios.get(\n `https://create-user.iobroker.in/v1/createUser?user=${encodeURIComponent(login)}&pass=${encodeURIComponent(pass)}&forceRecreate=${forceUserCreation}&version=${this.version}`,\n {\n timeout: 15000,\n validateStatus: status => status < 400,\n },\n );\n } catch (error) {\n if (error.response) {\n if (error.response.status === 401) {\n this.log.error(`Cannot fetch connection certificates because of invalid user or password`);\n } else {\n this.log.error(`Cannot fetch connection certificates: ${JSON.stringify(error.response.data)}`);\n }\n throw new Error(error.response.data);\n } else {\n this.log.error(`Cannot fetch connection certificates: ${JSON.stringify(error.code)}`);\n throw error;\n }\n }\n\n if (response?.data?.certificates) {\n const awsCertificates: {\n certificateId: string;\n certificatePem: string;\n keyPair: { PublicKey: string; PrivateKey: string };\n } = response.data.certificates;\n await this.writeKeys(awsCertificates);\n\n return {\n private: awsCertificates.keyPair.PrivateKey,\n certificate: awsCertificates.certificatePem,\n };\n }\n this.log.error(`Cannot fetch connection certificates: ${JSON.stringify(response.data)}`);\n throw new Error(response.data);\n }\n\n async processMessage(\n type: string,\n request: any,\n ): Promise<{ error?: string; result?: string } | string | SOCKET_MESSAGE | SOCKET_TRUNK[] | AlexaCustomResponse> {\n if (request instanceof Buffer) {\n request = request.toString();\n }\n\n if (!request || !type) {\n this.log.debug(`Invalid request: ${JSON.stringify(request)}`);\n return { error: 'invalid request' };\n }\n\n if (type.startsWith('remote')) {\n const start = Date.now();\n\n this.log.debug(`Remote request: ${JSON.stringify(request)}`);\n\n if (this.remote) {\n return this.remote\n .process(request, type as `remote${string}`)\n .then(response => {\n if (response !== NONE) {\n this.log.debug(\n `[REMOTE] Response in: ${Date.now() - start}ms (Length: ${Array.isArray(response) ? `A ${response.length}` : JSON.stringify(response).length}) for ${request}`,\n );\n }\n return response;\n })\n .catch(err => {\n this.log.error(`Error in processing of remote request: ${err.toString()}`);\n return NONE;\n });\n }\n this.log.error(`Received command, but remote already closed.`);\n } else if (type.startsWith('nightscout')) {\n this.log.debug(`Nightscout request: ${JSON.stringify(request)}`);\n if (this.config.nightscout) {\n const state = await this.getForeignStateAsync(\n `system.adapter.nightscout.${this.config.nightscout}.alive`,\n );\n if (state?.val) {\n return this.sendToAsync(`nightscout.${this.config.nightscout}`, 'send', request) as {\n error?: string;\n result?: string;\n };\n }\n return { error: `nightscout.${this.config.nightscout} is offline` };\n }\n return { error: 'Service is disabled' };\n } else if (type.startsWith('alexa')) {\n if (typeof request === 'string') {\n try {\n request = JSON.parse(request);\n } catch {\n this.log.error(`Cannot parse request: ${JSON.stringify(request)}`);\n return { error: 'Cannot parse request' };\n }\n }\n\n const printRequest = JSON.parse(JSON.stringify(request));\n if (printRequest.directive?.header?.correlationToken) {\n printRequest.directive.header.correlationToken = '***';\n }\n if (printRequest.directive?.endpoint?.scope?.token) {\n printRequest.directive.endpoint.scope.token = '***';\n }\n this.log.debug(`${Date.now()} ALEXA: ${JSON.stringify(printRequest)}`);\n\n if (request?.directive) {\n if (this.alexaSH3) {\n try {\n const response = await this.alexaSH3.process(request);\n if (request.directive.header.messageId != response.event!.header.messageId) {\n throw new Error('Incoming and outgoing header message IDs are not equal!');\n }\n return response as any;\n } catch {\n this.log.error(`Cannot parse request: ${request}`);\n }\n }\n return { error: 'Service is disabled' };\n } else if (request?.error) {\n // answer from alexa3 events cloud actually just show it in log\n if (request.error.includes('You have no iobroker.iot license')) {\n // pause for 30 minutes send of the events\n this.alexaSH3?.pauseEvents();\n }\n this.log.error(`Error from Alexa events cloud: ${request.error}`);\n } else if (request && !request.header) {\n if (this.alexaCustom) {\n return this.alexaCustom.process(request, this.config.amazonCustom);\n }\n return { error: 'Service is disabled' };\n } else {\n if (this.alexaSH2) {\n return this.alexaSH2.process(request, this.config.amazonAlexa) as any;\n }\n return { error: 'Service is disabled' };\n }\n } else if (type.startsWith('ifttt')) {\n try {\n if (typeof request === 'object') {\n request = JSON.stringify(request);\n } else {\n request = request.toString();\n }\n } catch {\n this.log.error(`Cannot parse request: ${request}`);\n return { error: 'Cannot parse request' };\n }\n this.log.debug(`IFTTT request: ${JSON.stringify(request)}`);\n\n await this.processIfttt(request);\n return NONE;\n } else if (type.startsWith('ghome')) {\n if (typeof request === 'string') {\n try {\n request = JSON.parse(request);\n } catch {\n this.log.error(`Cannot parse request: ${request}`);\n return { error: 'Cannot parse request' };\n }\n }\n this.log.debug(`[GHOME] request: ${JSON.stringify(request)}`);\n\n if (this.googleHome) {\n return this.googleHome.process(request, this.config.googleHome);\n }\n return { error: 'Service is disabled' };\n } else if (type.startsWith('alisa')) {\n if (typeof request === 'string') {\n try {\n request = JSON.parse(request);\n } catch {\n this.log.error(`Cannot parse request: ${request}`);\n return { error: 'Cannot parse request' };\n }\n }\n this.log.debug(`[ALISA] request: ${JSON.stringify(request)}`);\n\n this.log.debug(`${Date.now()} ALISA: ${JSON.stringify(request)}`);\n if (this.yandexAlisa) {\n return this.yandexAlisa.process(request, this.config.yandexAlisa) as any;\n }\n return { error: 'Service is disabled' };\n } else {\n let isCustom = false;\n let _type = type;\n if (_type.startsWith('custom_')) {\n _type = _type.substring(7);\n isCustom = true;\n }\n if (_type === 'visu') {\n this.log.debug(`Received visu command: ${JSON.stringify(request)}`);\n if (typeof request === 'object') {\n request = JSON.stringify(request);\n } else {\n request = request.toString();\n }\n\n try {\n const visuData = JSON.parse(request);\n\n if (visuData.presence) {\n await handleGeofenceData(visuData, this);\n }\n\n if (visuData.devices) {\n await handleDevicesData(visuData, this);\n }\n\n if (visuData.command === 'getInstances') {\n const res = await handleGetInstances(visuData, this);\n return { result: 'Ok', ...res };\n }\n\n if (visuData.command === 'sendToAdapter') {\n return await handleSendToAdapter(visuData, this);\n }\n } catch (e) {\n this.log.error(`Could not handle data \"${request}\" by Visu App: ${e.message}`);\n return { error: e.message };\n }\n\n return { result: 'Ok' };\n } else if (\n this.config.allowedServices[0] === '*' ||\n this.config.allowedServices.includes(_type) ||\n ALLOWED_SERVICES.includes(_type)\n ) {\n if (typeof request === 'object') {\n request = JSON.stringify(request);\n } else {\n request = request.toString();\n }\n this.log.debug(`Custom request: ${JSON.stringify(request)}`);\n\n if (SPECIAL_ADAPTERS.includes(_type)) {\n try {\n await this.setStateAsync(`services.${_type}`, request, true);\n } catch (err) {\n return { result: err };\n }\n\n return { result: 'Ok' };\n } else if (type.startsWith('text2command')) {\n if (this.config.text2command !== undefined && (this.config.text2command as string) !== '') {\n try {\n await this.setForeignStateAsync(`text2command.${this.config.text2command}.text`, request);\n } catch (err) {\n return { result: err };\n }\n return { result: 'Ok' };\n }\n this.log.warn('Received service text2command, but instance is not defined');\n return { result: 'but instance is not defined' };\n } else if (type.startsWith('simpleApi')) {\n return { result: 'not implemented' };\n } else if (isCustom) {\n let obj;\n try {\n obj = await this.getObjectAsync(`services.custom_${_type}`);\n } catch (e) {\n this.log.error(`Cannot get object services.custom_${_type}: ${e}`);\n }\n\n if (!obj) {\n try {\n await this.setObjectNotExistsAsync(`services.custom_${_type}`, {\n _id: `${this.namespace}.services.custom_${_type}`,\n type: 'state',\n common: {\n name: `Service for ${_type}`,\n write: false,\n read: true,\n type: 'mixed',\n role: 'value',\n },\n native: {},\n });\n await this.setStateAsync(`services.custom_${_type}`, request, true);\n } catch (err) {\n this.log.error(`Cannot control .services.custom_${_type}: ${JSON.stringify(err)}`);\n return { error: err };\n }\n } else {\n await this.setStateAsync(`services.custom_${_type}`, request, true);\n return { result: 'Ok' };\n }\n } else {\n this.log.warn(`Received service \"${type}\", but it is not allowed`);\n return { error: 'not allowed' };\n }\n } else {\n this.log.warn(`Received service \"${type}\", but it is not found in whitelist`);\n return { error: 'Unknown service' };\n }\n }\n\n this.log.warn(`Received message of unknown type: ${type}`);\n return { error: 'Unknown message type' };\n }\n\n closeDevice(): Promise<void> {\n return new Promise<void>(resolve => {\n if (this.device) {\n try {\n this.device.end(true, () => {\n this.device = null;\n resolve();\n });\n } catch {\n this.device = null;\n resolve();\n }\n } else {\n resolve();\n }\n });\n }\n\n async startDevice(clientId: string, login: string, password: string, retry?: number): Promise<void> {\n retry ||= 0;\n let certs:\n | {\n private: string;\n certificate: string;\n }\n | undefined;\n\n try {\n certs = await this.readCertificates();\n } catch (error) {\n if (error.message === 'Not exists') {\n try {\n certs = await this.fetchCertificates(login, password);\n } catch {\n // ignore\n }\n } else {\n throw error;\n }\n }\n\n // destroy the old device\n await this.closeDevice();\n\n if (!certs) {\n return this.log.error(`Cannot read connection certificates`);\n }\n\n try {\n this.connectStarted = Date.now();\n this.device = new DeviceModule({\n privateKey: Buffer.from(certs.private),\n clientCert: Buffer.from(certs.certificate),\n caCert: readFileSync(`${__dirname}/../keys/root-CA.crt`),\n clientId,\n username: 'ioBroker',\n host: this.config.cloudUrl,\n debug: !!this.config.debug,\n baseReconnectTimeMs: 5000,\n keepalive: 60,\n });\n this.remote?.registerDevice(this.device);\n\n this.device.subscribe(`command/${clientId}/#`);\n this.device.on('connect', () => this.onConnect(clientId));\n this.device.on('close', (): void => this.onDisconnect());\n this.device.on('reconnect', () => this.log.debug('reconnect'));\n this.device.on('offline', () => this.log.debug('offline'));\n this.device.on('error', error => {\n const errorTxt =\n ((error as Error)?.message && JSON.stringify((error as Error).message)) || JSON.stringify(error);\n this.log.error(`Error by device connection: ${errorTxt}`);\n\n // restart the iot device if DNS cannot be resolved\n if (errorTxt.includes('EAI_AGAIN')) {\n this.log.error(\n `DNS name of ${this.config.cloudUrl} cannot be resolved: connection will be retried in 10 seconds.`,\n );\n setTimeout(() => this.startDevice(clientId, login, password), 10000);\n }\n });\n\n this.device.on('message', async (topic: string, request: string | Buffer): Promise<void> => {\n this.log.debug(`Request ${topic}`);\n if (topic.startsWith(`command/${clientId}/`)) {\n const type = topic.substring(clientId.length + 9); // 9 === 'command//'.length\n\n try {\n const response = await this.processMessage(type, request);\n\n if (this.common!.loglevel === 'debug' && !type.startsWith('remote')) {\n this.log.debug(`Response: ${JSON.stringify(response)}`);\n }\n\n if (this.device && response !== NONE) {\n // It is a big file - send in trunks\n if (Array.isArray(response)) {\n try {\n for (let m = 0; m < response.length; m++) {\n const trunk = response[m];\n await new Promise<void>((resolve, reject) =>\n this.device!.publish(\n `response/${clientId}/${type}`,\n typeof trunk !== 'string' ? JSON.stringify(trunk) : trunk,\n { qos: 1 },\n error => {\n if (error) {\n reject(error);\n } else {\n resolve();\n }\n },\n ),\n );\n }\n } catch (err) {\n this.log.error(`[REMOTE] Cannot send packet: ${err}`);\n }\n } else {\n const printResponse = JSON.parse(JSON.stringify(response));\n if (printResponse?.event?.header?.correlationToken) {\n printResponse.event.header.correlationToken = '***';\n }\n if (printResponse?.event?.endpoint?.scope?.token) {\n printResponse.event.endpoint.scope.token = '***';\n }\n this.log.debug(\n `[REMOTE] Response to 'response/${clientId}/${type}: ${JSON.stringify(\n printResponse,\n )}`,\n );\n\n const msg = JSON.stringify(response);\n if (msg && msg.length > MAX_IOT_MESSAGE_LENGTH) {\n const packed = deflateSync(msg).toString('base64');\n this.log.debug(\n `[REMOTE] Content was packed from ${msg.length} bytes to ${packed.length} bytes`,\n );\n if (packed.length > MAX_IOT_MESSAGE_LENGTH) {\n this.log.warn(\n `[REMOTE] Content was packed to ${packed.length} bytes which is still near/over the message limit!`,\n );\n }\n this.device.publish(`response/${clientId}/${type}`, packed);\n } else {\n // console.log(`Publish to \"response/${clientId}/${type}\": ${msg}`);\n this.device.publish(`response/${clientId}/${type}`, msg);\n }\n }\n }\n } catch (error) {\n this.log.debug(`Error processing request ${topic}`);\n this.log.debug(`${error}`);\n }\n }\n });\n } catch (error) {\n if (error && typeof error === 'object' && error.message) {\n this.log.error(`Cannot read connection certificates: ${error.message}`);\n } else {\n this.log.error(\n `Cannot read connection certificates: ${JSON.stringify(error)} / ${error && error.toString()}`,\n );\n }\n\n if ((error === 'timeout' || error.message?.includes('timeout')) && retry < 10) {\n setTimeout(() => this.startDevice(clientId, login, password, retry + 1), 10000);\n }\n }\n }\n\n async updateNightscoutSecret(): Promise<void> {\n if (!this.config.nightscout) {\n return;\n }\n\n const email = this.config.login.replace(/[^\\w\\d-_]/g, '_');\n const secret = this.config.nightscoutPass;\n const apiSecret = email + (secret ? `-${secret}` : '');\n const URL = `https://generate-key.iobroker.in/v1/generateUrlKey?user=${encodeURIComponent(this.config.login)}&pass=${encodeURIComponent(this.config.pass)}&apisecret=${encodeURIComponent(apiSecret)}`;\n let response;\n\n try {\n response = await axios.get(URL, {\n timeout: 15000,\n validateStatus: status => status < 400,\n });\n if (response.data.error) {\n this.log.error(`Api-Secret cannot be updated: ${response.data.error}`);\n } else {\n this.log.debug(`Api-Secret updated: ${JSON.stringify(response.data)}`);\n }\n } catch (error) {\n if (error.response) {\n this.log.warn(\n `Cannot update api-secret: ${error.response.data ? JSON.stringify(error.response.data) : error.response.status}`,\n );\n } else {\n this.log.warn(`Cannot update api-secret: ${error.code}`);\n }\n }\n }\n\n async createStateForAdapter(adapterName: string): Promise<void> {\n // find any instance of this adapter\n const instances = await this.getObjectViewAsync('system', 'instance', {\n startkey: `system.adapter.${adapterName}.`,\n endkey: `system.adapter.${adapterName}.\\u9999`,\n });\n if (instances?.rows?.length) {\n let obj;\n try {\n obj = await this.getObjectAsync(`service.${adapterName}`);\n } catch {\n // ignore\n }\n if (!obj) {\n try {\n await this.setForeignObjectAsync(`${this.namespace}.services.${adapterName}`, {\n type: 'state',\n common: {\n name: `Service for ${adapterName}`,\n write: false,\n read: true,\n type: 'mixed',\n role: 'value',\n },\n native: {},\n });\n } catch {\n // ignore\n }\n }\n } else {\n try {\n // delete if object exists\n const obj = await this.getObjectAsync(`service.${adapterName}`);\n if (obj) {\n await this.delObjectAsync(`service.${adapterName}`);\n }\n } catch {\n // ignore\n }\n }\n }\n\n async syncServiceStates(): Promise<void> {\n const states = await this.getObjectViewAsync('system', 'state', {\n startkey: `${this.namespace}.services.`,\n endkey: `${this.namespace}.services.\\u9999`,\n });\n // Create new states\n for (let s = 0; s < this.config.allowedServices.length; s++) {\n const type = this.config.allowedServices[s];\n if (type !== '*' && !states.rows.find(st => st.id === `${this.namespace}.services.custom_${type}`)) {\n await this.setObjectNotExistsAsync(`services.custom_${type}`, {\n _id: `${this.namespace}.services.custom_${type}`,\n type: 'state',\n common: {\n name: `Service for ${type}`,\n write: false,\n read: true,\n type: 'mixed',\n role: 'value',\n },\n native: {},\n });\n }\n }\n\n // delete all service states\n for (let s = 0; s < (states?.rows?.length || 0); s++) {\n const id = states.rows[s].id;\n if (id.startsWith(`${this.namespace}.services.custom_`)) {\n const stateId = id.substring(`${this.namespace}.services.custom_`.length);\n if (!this.config.allowedServices.includes(stateId)) {\n await this.delStateAsync(id);\n }\n }\n }\n }\n\n async main(): Promise<void> {\n if (this.config.googleHome === undefined) {\n this.config.googleHome = false;\n }\n\n if (this.config.amazonAlexa === undefined) {\n this.config.amazonAlexa = true;\n }\n\n if (this.config.yandexAlisa === undefined) {\n this.config.yandexAlisa = false;\n }\n\n // Workaround for amazonCustom\n if (this.config.amazonCustom === undefined) {\n // get current config\n const obj = await this.getForeignObjectAsync(`system.adapter.${this.namespace}`);\n if (obj) {\n this.log.info(\n `Migrating amazonCustom configuration to ${this.config.amazonAlexa || this.config.amazonAlexaV3}`,\n );\n obj.native.amazonCustom = !!(this.config.amazonAlexa || this.config.amazonAlexaV3);\n await this.setForeignObjectAsync(`system.adapter.${this.namespace}`, obj);\n return;\n }\n }\n\n this.config.pingTimeout = parseInt(this.config.pingTimeout as string, 10) || 5000;\n\n if (this.config.pingTimeout < 3000) {\n this.config.pingTimeout = 3000;\n }\n\n if (this.config.deviceOffLevel === undefined) {\n this.config.deviceOffLevel = 30;\n }\n\n if (this.config.login !== (this.config.login || '').trim().toLowerCase()) {\n this.log.error('Please write your login only in lowercase!');\n }\n if (!this.config.login || !this.config.pass) {\n return this.log.error('No cloud credentials found. Please get one on https://iobroker.pro');\n }\n\n let systemConfig = await this.getForeignObjectAsync('system.config');\n if (!systemConfig) {\n this.log.warn('Object system.config not found. Please check your installation!');\n systemConfig = { common: {} } as ioBroker.SystemConfigObject;\n }\n\n // create service state for netatmo if any instance exists\n for (let a = 0; a < SPECIAL_ADAPTERS.length; a++) {\n await this.createStateForAdapter(SPECIAL_ADAPTERS[a]);\n }\n\n this.secret = systemConfig?.native?.secret || 'Zgfr56gFe87jJOM';\n\n this.config.pass = this.decryptOwn(this.secret, this.config.pass);\n this.config.deviceOffLevel = parseFloat(this.config.deviceOffLevel as string) || 0;\n this.config.concatWord = (this.config.concatWord || '').toString().trim();\n this.config.apikey = (this.config.apikey || '').trim();\n this.config.replaces = this.config.replaces ? (this.config.replaces as string).split(',') : null;\n this.config.cloudUrl = (this.config.cloudUrl || '').toString();\n this.config.nightscout = this.config.nightscout || '';\n\n if (this.config.replaces) {\n const text: string[] = [];\n for (let r = 0; r < this.config.replaces.length; r++) {\n text.push(`\"${this.config.replaces[r]}\"`);\n }\n this.log.debug(`Following strings will be replaced in names: ${text.join(', ')}`);\n }\n if (this.config.yandexAlisa) {\n this.yandexAlisa = new YandexAlisa(this);\n }\n\n this.remote = new Remote(this, this.config.login.replace(/[^-_:a-zA-Z1-9]/g, '_'));\n\n this.config.allowedServices = ((this.config.allowedServices as string) || '')\n .split(/[,\\s]+/)\n .map(s => s.trim())\n .filter(s => s);\n\n await this.syncServiceStates();\n\n await this.setStateAsync('info.connection', false, true);\n this.config.cloudUrl = this.config.cloudUrl || 'a18wym7vjdl22g.iot.eu-west-1.amazonaws.com';\n\n if (!this.config.login || !this.config.pass) {\n return this.log.error('No cloud credentials found. Please get one on https://iobroker.pro');\n }\n\n if (this.config.iftttKey) {\n await this.subscribeStatesAsync('services.ifttt');\n // create ifttt object\n const iftttObj = await this.getObjectAsync('.services.ifttt');\n if (!iftttObj) {\n await this.setObjectNotExistsAsync('services.ifttt', {\n _id: `${this.namespace}.services.ifttt`,\n type: 'state',\n common: {\n name: 'IFTTT value',\n write: true,\n role: 'state',\n read: true,\n type: 'mixed',\n desc: 'All written data will be sent to IFTTT. If no state specified all requests from IFTTT will be saved here',\n },\n native: {},\n });\n }\n }\n\n // detect netatmo creation\n await this.subscribeForeignObjectsAsync('system.adapter.*');\n\n await this.subscribeStatesAsync('smart.*');\n\n this.log.info(`Connecting with ${this.config.cloudUrl}`);\n\n if (this.config.language) {\n this.translate = true;\n this.lang = this.config.language;\n } else {\n this.lang = systemConfig.common.language;\n }\n\n if (this.lang !== 'en' && this.lang !== 'de' && this.lang !== 'ru') {\n this.lang = 'en';\n }\n\n if (this.config.amazonAlexa) {\n this.alexaSH2 = new AlexaSH2(this);\n this.alexaSH2.setLanguage(this.lang, this.translate);\n this.alexaSH2.updateDevices();\n } else {\n // Check that update result is empty\n const state = await this.getStateAsync('smart.updatesResult');\n if (state?.val) {\n await this.setStateAsync('smart.updatesResult', '', true);\n }\n }\n\n this.remote?.setLanguage(this.lang);\n // check password\n if (\n this.config.pass.length < 8 ||\n !this.config.pass.match(/[a-z]/) ||\n !this.config.pass.match(/[A-Z]/) ||\n !this.config.pass.match(/\\d/)\n ) {\n return this.log.error(\n 'The password must be at least 8 characters long and have numbers, upper and lower case letters. Please change the password in the profile https://iobroker.pro/accountProfile.',\n );\n }\n\n await this.updateNightscoutSecret();\n\n const iotClientId = this.config.login.replace(/[^-_:a-zA-Z1-9]/g, '_');\n // user will be created here\n await this.startDevice(iotClientId, this.config.login, this.config.pass);\n\n // after the user created, we can try to generate URL key\n // read URL keys from server\n try {\n this.urlKey = await this.readUrlKey();\n } catch {\n if (\n this.config.googleHome ||\n this.config.yandexAlisa ||\n this.config.allowedServices.length ||\n this.config.iftttKey\n ) {\n try {\n this.urlKey = await this.createUrlKey(this.config.login, this.config.pass);\n } catch (err) {\n return this.log.error(\n `Cannot read URL key: ${typeof err === 'object' ? JSON.stringify(err) : err}`,\n );\n }\n }\n }\n\n if (this.config.amazonAlexaV3) {\n this.alexaSH3 = new AlexaSH3({\n adapter: this,\n iotClientId,\n iotDevice: this.device!,\n });\n this.alexaSH3.setLanguage(this.lang);\n await this.alexaSH3.updateDevices();\n } else {\n // Check that update result is empty\n const state = await this.getStateAsync('smart.updates3');\n if (state?.val) {\n await this.setStateAsync('smart.updates3', '', true);\n }\n }\n\n if (this.config.amazonCustom) {\n this.alexaCustom = new AlexaCustom(this);\n this.alexaCustom.setLanguage(this.lang);\n }\n\n if (this.config.googleHome) {\n this.googleHome = new GoogleHome(this, this.urlKey);\n } else {\n // Check that update result is empty\n const state = await this.getStateAsync('smart.updatesGH');\n if (state?.val) {\n await this.setStateAsync('smart.updatesGH', '', true);\n }\n }\n if (this.config.yandexAlisa) {\n this.yandexAlisa = new YandexAlisa(this, this.urlKey);\n } else {\n // Check that update result is empty\n const state = await this.getStateAsync('smart.updatesYA');\n if (state?.val) {\n await this.setStateAsync('smart.updatesYA', '', true);\n }\n }\n\n this.googleHome?.setLanguage(this.lang);\n this.googleHome?.updateDevices();\n\n this.yandexAlisa?.setLanguage(this.lang);\n this.yandexAlisa?.updateDevices();\n\n await this.subscribeStatesAsync('app.message');\n }\n}\n\nif (require.main !== module) {\n // Export the constructor in compact mode\n module.exports = (options: Partial<AdapterOptions> | undefined) => new IotAdapter(options);\n} else {\n // otherwise start the instance directly\n (() => new IotAdapter())();\n}\n"]}
|