Skip to content

Commit

Permalink
removed got
Browse files Browse the repository at this point in the history
* removed got
* added axios as replacement
* contact modified

iobroker-community-adapters#19 solved, iobroker-community-adapters#18 solved
  • Loading branch information
oelison committed Nov 25, 2022
1 parent 4d5ffb6 commit a100a70
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 444 deletions.
1 change: 1 addition & 0 deletions io-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@
"zh-cn": "控制设备更智能:通过分组(包括动作,打开窗口等)进行分组,并相应地设置目标设备"
},
"authors": [
"oelison <iobrokersmartcontrol(at)sciphy.de"
"Mic-M <iob.micm@gmail.com>"
],
"keywords": [
Expand Down
6 changes: 2 additions & 4 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ class SmartControl extends utils.Adapter {
Trigger: require('./lib/trigger-class.js'), // Class for Triggers and Target devices handling
mSuncalc: require('suncalc2'), // /~https://github.com/andiling/suncalc2
mSchedule: require('node-schedule'), // /~https://github.com/node-schedule/node-schedule
//ToDo: need to be replaced by axios
mGot: require('@esm2cjs/got'), // /~https://github.com/sindresorhus/got || This is a 'request' replacement due to https://nodesource.com/blog/express-going-into-maintenance-mode#alternativestorequest

axios: require('axios').default,
// {object} timers - All timer objects.
timersZoneOn: {}, // for option "onAfter" in Zones table
timersZoneOff: {}, // for option "offAfter" in Zones table
Expand Down Expand Up @@ -809,7 +807,7 @@ class SmartControl extends utils.Adapter {
try {
this.log.debug(`Trying to call target URL (name: '${name}', URL: '${url}')`);
// @ts-ignore This expression is not callable.
const response = await this.x.mGot(url); // This is a 'request' replacement due to https://nodesource.com/blog/express-going-into-maintenance-mode#alternativestorequest
const response = await this.x.axios.get(url);
this.log.debug(`Calling target URL was successful (name: '${name}', URL: '${url}')`);
// Set response to state smartcontrol.x.targetURLs.xxxxxxx.response
if (this.x.helper.isLikeEmpty(response.body)) {
Expand Down
Loading

0 comments on commit a100a70

Please sign in to comment.