NEWS
Adapter-Einstellungen zur Laufzeit verändern
-
-
@hansmann2401 War schon richtig nur dort die Objekt-Eigenschaften.
->
->
Also bei Dir system.adapter.ford und ...ford.0 -
Ahhh, ok:
{
"_id": "system.adapter.ford",
"type": "adapter",
"common": {
"name": "ford",
"version": "0.0.14",
"title": "Ford",
"titleLang": {
"en": "Ford",
"de": "Ford",
"ru": "Форд",
"pt": "Ford",
"nl": "Ford",
"fr": "Gué",
"it": "Guado",
"es": "Vado",
"pl": "Bród",
"zh-cn": "福特"
},
"desc": {
"en": "Adapter for FordPass",
"de": "Adapter für FordPass",
"ru": "Адаптер для FordPass",
"pt": "Adaptador para FordPass",
"nl": "Adapter voor FordPass",
"fr": "Adaptateur pour FordPass",
"it": "Adattatore per FordPass",
"es": "Adaptador para FordPass",
"pl": "Adapter do FordPass",
"zh-cn": "FordPass 适配器"
},
"authors": [
"TA2k tombox2020@gmail.com"
],
"keywords": [
"ford",
"FordPass"
],
"license": "MIT",
"platform": "Javascript/Node.js",
"main": "main.js",
"icon": "ford.png",
"enabled": true,
"extIcon": "https://raw.githubusercontent.com/TA2k/ioBroker.ford/master/admin/ford.png",
"readme": "https://github.com/TA2k/ioBroker.ford/blob/master/README.md",
"loglevel": "info",
"mode": "daemon",
"type": "vehicle",
"compact": true,
"connectionType": "cloud",
"dataSource": "poll",
"materialize": true,
"plugins": {
"sentry": {
"dsn": "https://c6109f629f7f4212ba9375a55670d6ce@sentry.iobroker.net/158"
}
},
"dependencies": [
{
"js-controller": ">=3.0.0"
}
],
"globalDependencies": [
{
"admin": ">=4.0.9"
}
],
"installedFrom": "iobroker.ford@0.0.14",
"installedVersion": "0.0.14"
},
"native": {
"username": "",
"password": "",
"interval": 5,
"forceUpdate": true
},
"from": "system.host.iobroker_prod.cli",
"ts": 1677440595962,
"acl": {
"object": 1636,
"owner": "system.user.admin",
"ownerGroup": "system.group.administrator"
},
"protectedNative": [
"password"
],
"encryptedNative": [
"password"
],
"notifications": [],
"instanceObjects": [
{
"_id": "info",
"type": "channel",
"common": {
"name": "Information"
},
"native": {}
},
{
"_id": "info.connection",
"type": "state",
"common": {
"role": "indicator.connected",
"name": "Device or service connected",
"type": "boolean",
"read": true,
"write": false,
"def": false
},
"native": {}
}
],
"objects": []
} -
-
Und hier von der 0.Instanz:
{
"_id": "system.adapter.ford.0",
"type": "instance",
"common": {
"name": "ford",
"version": "0.0.14",
"title": "Ford",
"titleLang": {
"en": "Ford",
"de": "Ford",
"ru": "Форд",
"pt": "Ford",
"nl": "Ford",
"fr": "Gué",
"it": "Guado",
"es": "Vado",
"pl": "Bród",
"zh-cn": "福特"
},
"desc": {
"en": "Adapter for FordPass",
"de": "Adapter für FordPass",
"ru": "Адаптер для FordPass",
"pt": "Adaptador para FordPass",
"nl": "Adapter voor FordPass",
"fr": "Adaptateur pour FordPass",
"it": "Adattatore per FordPass",
"es": "Adaptador para FordPass",
"pl": "Adapter do FordPass",
"zh-cn": "FordPass 适配器"
},
"authors": [
"TA2k tombox2020@gmail.com"
],
"keywords": [
"ford",
"FordPass"
],
"license": "MIT",
"platform": "Javascript/Node.js",
"main": "main.js",
"icon": "ford.png",
"enabled": true,
"extIcon": "https://raw.githubusercontent.com/TA2k/ioBroker.ford/master/admin/ford.png",
"readme": "https://github.com/TA2k/ioBroker.ford/blob/master/README.md",
"loglevel": "info",
"mode": "daemon",
"type": "vehicle",
"compact": true,
"connectionType": "cloud",
"dataSource": "poll",
"materialize": true,
"plugins": {
"sentry": {
"dsn": "https://c6109f629f7f4212ba9375a55670d6ce@sentry.iobroker.net/158"
}
},
"dependencies": [
{
"js-controller": ">=3.0.0"
}
],
"globalDependencies": [
{
"admin": ">=4.0.9"
}
],
"installedFrom": "iobroker.ford@0.0.14",
"installedVersion": "0.0.14",
"host": "iobroker_prod"
},
"native": {
"username": "@",
"password": "xxxxxx",
"interval": 20, <- das möchte ich verändern!
"forceUpdate": true
},
"from": "system.host.iobroker_prod.cli",
"ts": xxxxxxxxxxxxxxxxxxxxxxxxxxx,
"acl": {
"object": 1636,
"owner": "system.user.admin",
"ownerGroup": "system.group.administrator"
},
"protectedNative": [
"password"
],
"encryptedNative": [
"password"
],
"notifications": [],
"instanceObjects": [
{
"_id": "info",
"type": "channel",
"common": {
"name": "Information"
},
"native": {}
},
{
"_id": "info.connection",
"type": "state",
"common": {
"role": "indicator.connected",
"name": "Device or service connected",
"type": "boolean",
"read": true,
"write": false,
"def": false
},
"native": {}
}
],
"objects": [],
"user": "system.user.admin"
} -
@hansmann2401 javascript ist ok?
Solche Daten bitte grundsätzlich in Code-Tags
-> markieren und klicken. Danke. -
@mcu
Ok, sorry, war schon spät...;-)Javascript ist ok.
-
@hansmann2401 sagte: "interval": 20, <- das möchte ich verändern!
const idInst = 'system.adapter.ford.0'; const objInst = getObject(idInst); schedule('0 * * * *', function() { let interval = 20; let hour = new Date().getHours(); if(hour >= 6 && hour <= 10) interval = 30; // Tageszeit if(objInst.native.interval != interval) { objInst.common.enabled = false; //stop objInst.native.interval = interval; setObject(idInst, objInst); setTimeout(function() { objInst.common.enabled = true; // start setObject(idInst, objInst); }, 500); } });
-
Vielen lieben Dank!
Ich werde es ausprobieren und berichten...
VG vom Niederrhein! -
@paul53 :
Hallo, das Auslesen des Ist-Wertes klappt, aber das Stoppen, Interval-Verändern und wieder Starten klappen leider nicht...
Keine Veränderung und kein Neustart. -
@hansmann2401 sagte: Stoppen, Interval-Verändern und wieder Starten klappen leider nicht...
In der Konfiguration der JS-Instanz ist "setObject" freigegeben?
-
@paul53 :
Das war es gewesen....jetzt funzt es!
Vielen Dank Paul53!