Auf jeden Fall besteht Interesse
Gesendet von meinem HUAWEI VNS-L31 mit Tapatalk
Auf jeden Fall besteht Interesse
Gesendet von meinem HUAWEI VNS-L31 mit Tapatalk
Hi,
mich würde das Script auch interessieren. kannst du mir das auch bitte zur verfügung stellen.
Danke
VSCode. Wenn das einmal ordentlich eingerichtet ist, gibts nix einfacheres IMO. Git-Integration, optional Type-Checking, etc…
Könntest Du mal Deine Einrichtung erläutern?
Konsole und Git sind ja von Haus aus drin. Mag zwar nicht jeder, aber ich bin damit einfach am schnellsten.Installierte Erweiterungen:
Auto Close Tag (für HTML/React)
Bookmarks
Coverage Gutters + Run on Save (Automatische Test-Coverage-Anzeige wenn package.json entsprechend konfiguriert ist)
ESLint (JS-Datei-Prüfung)
TSLint (TypeScript-Datei-Prüfung auf stilistische und typische Syntax-Fehler)
TypeChecking erfordert eine entsprechend konfigurierte tsconfig.json-Datei im Projektordner, siehe https://github.com/ioBroker/ioBroker.cl … onfig.json oder https://github.com/AlCalzone/ioBroker.t ... onfig.json und "typescript" als devDependency. Dann meckert VSCode beim Öffnen von Dateien, wenn es Fehler findet, die über einfache Fehler wie ( vergessen hinausgehen.
Für Adapter-Aktualisierung auf dem Zielhost hab ich auch ein kleines Skript.
package.json => scripts:
"deploy_local": "node --require ts-node/register maintenance/deploy_local.ts",
maintenance/deploy_local.ts sieht so aus:
! ````
// tslint:disable:no-var-requires
/*
Allows easier local debugging over SSH.
Runningnpm run deploy_local
updates remote adapter files
and restarts the instance
/
! /
CONFIGURATION:
- provide a deploy_password.json file in the local dir with contents
{
"host": "<hostname>",
"username": "<username>",
"password": "<password>"
}
- specify which dirs and files should be uploaded
- specify where the root dir is relative to this script
*/
const uploadDirs = ["admin", "build"];
const uploadFiles = ["package.json", "io-package.json", "main.js"];
const rootDir = "../";
! // =========================
// CAN'T TOUCH THIS
// =========================
! import * as nodeSSH from "node-ssh";
import * as path from "path";
! const localRoot = path.resolve(__dirname, rootDir);
! const ioPack = require(path.join(rootDir, "io-package.json"));
const ADAPTER_NAME = ioPack.common.name;
! const ssh = new nodeSSH();
const sshConfig = require(path.join(_dirname, "deploy_password.json"));
! const remoteRoot =/opt/iobroker/node_modules/iobroker.${ADAPTER_NAME}
;
! (async function main() {
await ssh.connect(sshConfig);
! for (const dir of uploadDirs) {
console.log(cleaning ${dir} dir...
);
await ssh.execCommand(rm -rf ${path.join(remoteRoot, dir)}
);
console.log(uploading ${dir} dir...
);
try {
await ssh.putDirectory(path.join(localRoot, dir), path.join(remoteRoot, dir), {
recursive: true,
concurrency: 10,
validate: (pathname) => {
const basename = path.basename(pathname);
if (basename.startsWith("deploy")) return false;
if (basename.endsWith("Thumbs.db")) return false;
if (basename.endsWith(".map") && basename.indexOf(".bundle.") === -1) return false;
if (basename.indexOf(".test.") > -1) return false;
if (basename === "src") return false;
return true;
},
});
} catch (e) {
console.error(e);
}
}
for (const file of uploadFiles) {
console.log(uploading ${file}...
);
await ssh.putFile(path.join(localRoot, file), path.join(remoteRoot, file));
}
! // update in-mem adapter
let execResult;
console.log("updating in-mem adapter");
execResult = await ssh.execCommand(iobroker upload ${ADAPTER_NAME}
);
console.log(execResult.stdout);
console.log(execResult.stderr);
if (process.argv.indexOf("--norestart") === -1) {
execResult = await ssh.execCommand(iobroker restart ${ADAPTER_NAME}
);
console.log(execResult.stdout);
console.log(execResult.stderr);
}
! console.log("done");
process.exit(0);
})();</password></username></hostname>und erfordert in package.json
"devDependencies": {
"node-ssh": "^5.0.0",
"ts-node": "^4.1.0",
"typescript": "^2.6.2",
}Wenn das Skript konfiguriert ist (siehe Kommentare am Skript-Anfang), reicht ein "npm run deploy_local" und die aktualisierten Adapterdateien werden per SSH auf dem Zielhost hochgeladen und der Adapter dort aktualisiert/neu gestartet. Für dein Vorhaben musst du vermutlich vorher noch 1-2 Skripte lokal ausführen, um die Übersetzungsdateien umzuwandeln. ` Wau danke werde mir das morgen Mal anschauen
Gesendet von meinem HUAWEI VNS-L31 mit Tapatalk
Halo zusammen,
Welche Entwicklerumgebung benutzt ihr um Adapter zu entwickeln?
Gesendet von meinem HUAWEI VNS-L31 mit Tapatalk
Hallo zusammen,
hat einer von euch es schon geschaft den Wetty Adapther über die iobroker cloud zu betreiben. Wenn ich den tab öffne, bleibt leider die Seite leer.
Ich vermute es hat was mit dem port zutun bin mir da aber nicht ganz sicher.
LG
Tobias
Genau das gleiche Problem habe ich auch. Ich habe das iobroker Image auf dem pi3 und benutze WLAN als Netzanschluss
Gesendet von meinem HUAWEI VNS-L31 mit Tapatalk
Hallo zusammen,
hat einer eine Idee bei mir lauft der Adapther immer noch nicht. Es liegt auch nicht an Dash Button. Habe mal in die main.js eine andere mac eingetragen, die immer online ist und leider wird auch von dem kein Objekt angelegt.
2891_unbenannt.png
Leider zeigte mir VIS nicht ann wenn ich den Sonoff übers Webinterface vom Sonoff geschaltet habe.
Firmware: tasmota
Es liegt dadran, dass der Wert vom objekt cmnd.0.Sonoff.POWER nciht geändert wird wenn man manuell schaltet.
Ich habe jetzt ein kleines javascript geschrieben um das zu ändern.
on({id: 'mqtt.0.POWDrucker.POWER', change: "any"}, function (obj) {
if (getState('mqtt.0.POWDrucker.POWER').val == "OFF" ){
setState('mqtt.0.POWDrucker.cmnd.POWER', false);
}
else if (getState('mqtt.0.POWDrucker.POWER').val == "ON" )
{
setState('mqtt.0.POWDrucker.cmnd.POWER', true);
}
});
ich hoffe es hilft den ein oder anderen.
2891_sonoff.png
Ah super danke dir dann habe ich es jetzt verstanden.
Gesendet von meinem HUAWEI VNS-L31 mit Tapatalk