NEWS
[Gelöst:] Adjust settings in the .env File
-
Servus,
ich wollte heute den Ds18b20 die Sensoren auf einem anderen System anzeigen lassen.
Soweit bin ich bisher, aber ich kann mir keinen Reim auf "Please adjust the settings in the .env file." machen.Kann mir jemand weiterhelfen?
pi@pi4-Master:~ $ mkdir ~/ds18b20-remote pi@pi4-Master:~ $ cd ~/ds18b20-remote pi@pi4-Master:~/ds18b20-remote $ wget -O remote-client-setup.js http://192.168.178.68:8081/adapter/ds18b20/remote-client-setup.js --2022-11-23 09:48:58-- http://192.168.178.68:8081/adapter/ds18b20/remote-client-setup.js Connecting to 192.168.178.68:8081... connected. HTTP request sent, awaiting response... 200 OK Length: 39797 (39K) [application/javascript] Saving to: ‘remote-client-setup.js’ remote-client-setup 100%[===================>] 38.86K --.-KB/s in 0.003s 2022-11-23 09:48:58 (14.5 MB/s) - ‘remote-client-setup.js’ saved [39797/39797] pi@pi4-Master:~/ds18b20-remote $ node remote-client-setup.js - ioBroker.ds18b20 remote client - Basic setup done. Please adjust the settings in the .env file. To manually start the client just run: node ds18b20-remote-client.js To setup the SystemD service, please run: sudo cp iobroker-ds18b20-remote.service /etc/systemd/system/iobroker-ds18b20-remote.service sudo systemctl daemon-reload sudo systemctl enable iobroker-ds18b20-remote.service sudo systemctl start iobroker-ds18b20-remote.service
pi@pi4-Master:~/ds18b20-remote $ sudo nano remote-client-setup.js
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const fs = require("fs"); const os = require("os"); const path = require("path"); const SYSTEMD_SERVICE_NAME = 'iobroker-ds18b20-remote.service'; const files = { 'common.js': 'InVzZSBzdHJpY3QiOwpPYmplY3QuZGVmaW5lUHJvcGVydHkoZXhwb3J0cywgIl9fZXNNb2R1bGUiLCB7IHZhbHVlOiB0cnVlIH0pOwpleHBvcnRzLmRlY3J5cHQgPSBleHBvcnRzLmVuY3J5cHQgPSBleHBvcnRzLlJFTU9URV9QUk9UT0NPTF9WRVJTSU9OID0gdm9pZCAwOwpjb25zdCBjcnlwdG8gPSByZXF1aXJlKCJjcnlwdG8iKTsKZ> 'ds18b20-remote-client.js': 'InVzZSBzdHJpY3QiOwp2YXIgX19hd2FpdGVyID0gKHRoaXMgJiYgdGhpcy5fX2F3YWl0ZXIpIHx8IGZ1bmN0aW9uICh0aGlzQXJnLCBfYXJndW1lbnRzLCBQLCBnZW5lcmF0b3IpIHsKICAgIGZ1bmN0aW9uIGFkb3B0KHZhbHVlKSB7IHJldHVybiB2YWx1ZSBpbnN0YW5jZW9mIFAgPyB2YWx1ZSA6IG5ldyBQKGZ1bmN0aW> 'logger.js': 'InVzZSBzdHJpY3QiOwpPYmplY3QuZGVmaW5lUHJvcGVydHkoZXhwb3J0cywgIl9fZXNNb2R1bGUiLCB7IHZhbHVlOiB0cnVlIH0pOwpleHBvcnRzLkxvZ2dlciA9IHZvaWQgMDsKY2xhc3MgTG9nZ2VyIHsKICAgIGxvZyguLi5hcmdzKSB7CiAgICAgICAgY29uc29sZS5sb2coLi4uYXJncyk7CiAgICB9CiAgICBkZWJ1ZyguLi5hcmdzKSB7C> }; for (const f in files) { const content = Buffer.from(files[f], 'base64').toString('utf-8'); fs.writeFileSync(f, content, { encoding: 'utf-8' }); } const systemDContent = `[Unit] Description=ioBroker.ds18b20 remote client Documentation=https://github.com/crycode-de/ioBroker.ds18b20 After=network.target [Service] Type=simple User=${os.userInfo().username} WorkingDirectory=${__dirname} ExecStart=${process.execPath} ${path.join(__dirname, 'ds18b20-remote-client.js')} Restart=on-failure [Install] WantedBy=multi-user.target `; const systemDFile = path.join(__dirname, SYSTEMD_SERVICE_NAME); fs.writeFileSync(systemDFile, systemDContent, { encoding: 'utf-8' }); const dotEnvContent = `# Settings for the ioBroker.ds18b20 remote client # Unique ID for this remote system SYSTEM_ID=my-remote # IP or hostname of the ioBroker host running the adapter ADAPTER_HOST=192.168.178.68 # Port from the adapter config ADAPTER_PORT=1820 # Encryption key from the adapter config ADAPTER_KEY=35305d096dc8eef7db46d575417926bafxxxxxxxxxxxxxxxxxxxxxx # Enable debug log output #DEBUG=1 # System path of the 1-wire devices #W1_DEVICES_PATH=/sys/bus/w1/devices `; const dotEnvFile = path.join(__dirname, '.env'); if (!fs.existsSync(dotEnvFile)) { fs.writeFileSync(dotEnvFile, dotEnvContent, { encoding: 'utf-8' }); } console.log(`- ioBroker.ds18b20 remote client - Basic setup done. Please adjust the settings in the .env file. To manually start the client just run: node ds18b20-remote-client.js To setup the SystemD service, please run: sudo cp ${SYSTEMD_SERVICE_NAME} /etc/systemd/system/${SYSTEMD_SERVICE_NAME} sudo systemctl daemon-reload sudo systemctl enable ${SYSTEMD_SERVICE_NAME} sudo systemctl start ${SYSTEMD_SERVICE_NAME} `); //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2V0dXAuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvcmVtb3RlL3NldHVwLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBTUEseUJBQXlCO0FBQ3pCLHlCQUF5QjtBQUN6Qiw2QkFBNkI7QUFFN0IsTUFBTSxvQkFBb>
pi@pi4-Master:~/ds18b20-remote $ node ds18b20-remote-client.js - ioBroker.ds18b20 remote client - [Error] No ADAPTER_HOST given!
pi@pi4-Master:~/ds18b20-remote $ sudo systemctl status iobroker-ds18b20-remote.service ● iobroker-ds18b20-remote.service - ioBroker.ds18b20 remote client Loaded: loaded (/etc/systemd/system/iobroker-ds18b20-remote.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Wed 2022-11-23 10:56:00 CET; 23s ago Docs: https://github.com/crycode-de/ioBroker.ds18b20 Process: 10290 ExecStart=/usr/bin/node /home/pi/ds18b20-remote/ds18b20-remote-client.js (code=exited, status=1/FAILURE) Main PID: 10290 (code=exited, status=1/FAILURE) CPU: 183ms Nov 23 10:56:00 pi4-Master systemd[1]: iobroker-ds18b20-remote.service: Scheduled restart job, restart counter is at 5. Nov 23 10:56:00 pi4-Master systemd[1]: Stopped ioBroker.ds18b20 remote client. Nov 23 10:56:00 pi4-Master systemd[1]: iobroker-ds18b20-remote.service: Start request repeated too quickly. Nov 23 10:56:00 pi4-Master systemd[1]: iobroker-ds18b20-remote.service: Failed with result 'exit-code'. Nov 23 10:56:00 pi4-Master systemd[1]: Failed to start ioBroker.ds18b20 remote client. pi@pi4-Master:~/ds18b20-remote $
Für alle die auch nicht so gut auf Linux sind, die Lösung ist:
pi@pi4-Master:~/ds18b20-remote $ sudo nano .env
sieht dann so aus:
# Settings for the ioBroker.ds18b20 remote client # Unique ID for this remote system SYSTEM_ID=Pi-4-Master # IP or hostname of the ioBroker host running the adapter ADAPTER_HOST=192.168.178.68 # Port from the adapter config ADAPTER_PORT=1820 # Encryption key from the adapter config ADAPTER_KEY=dea3458098c294f22546bbd5367a224a4b9082808xxxxxxxxx # Enable debug log output #DEBUG=1 # System path of the 1-wire devices #W1_DEVICES_PATH=/sys/bus/w1/devices
Mfg
Tom