NEWS

js-controller 3.2 jetzt im Latest!


  • @apollon77 sagte in js-controller 3.2 jetzt im Latest!:

    Bei Fehlern:
    Wenn bei der Installation Fehler wegen fehlender Zugriffsrechte auftreten, am besten den Installation-Fixer (iobroker fix wer schon einen js-controller 2.x oder höher hat, alternativ weiterhin manuell via curl -sL https://iobroker.net/fix.sh | bash -) nutzen und die Installation wiederholen.



  • @ilovegym @Latzi

    Das geht damit natürlich auch nicht, denn es muss zuerst der iobroker beendet werden. Und iobroker stop geht ja nicht


  • @waterchill Hi, also da ist anscheinend mehr faul .. bitte eigenen Thread öffnen, dann schauen wir detalliert mal weiter.
    Dankeschön.


  • @apollon77 said in js-controller 3.2 jetzt im Latest!:

    @homecineplexx Falls du globale Scripts hast werden die ja davorgehängt. du versuchst auf irgendetwas zuzugreifen was falsch ist. von solchen Javascripts hab ich auch einiges im Sentry wo versucht wird ein state zuzugreifen mit nem "." am ende - das ist jetzt verboten. Muss im javascript adapter wohl noch abgefangen werden

    ich hab den fehler jetzt gefunden.
    ich verwende scripts die mir quasi virtuelle Devices anlegt (ähnlich wie alias) sieht code und ich bekomme zb den Error für Calculation.JahresVerbrauch_7 also immer wenn ein Datenpunkt angelegt weden soll, wo ein "." dazwischen ist (sprich ein anderes "Verzeichnis"). kann ich das irgendwie umgehen?

    //generic virtual device        
    function VirtualDevice(config) {
        //sanity check
        if (typeof config !== 'object' || typeof config.namespace !== 'string' || typeof config.name !== 'string' || typeof config.states !== 'object') {
            log('sanity check failed, no device created', 'warn');
            return;
        }
     
        this.config = config;
        this.namespace = 'VirtualDevice.0.' + config.namespace + '.' + config.name;
        this.name = config.name;
     
        //create virtual device
        log('creating virtual device ' + this.namespace);
        this.createDevice(function () {
            this.createStates(function () {
                log('created virtual device ' + this.namespace);
            }.bind(this));
        }.bind(this));
    }
     
    VirtualDevice.prototype.createDevice = function (callback) {
        log('creating object for device ' + this.namespace, 'debug');
        //create device object
        var obj = this.config.copy ? getObject(this.config.copy) : {common: {}, native: {}};
        delete obj.common.custom;
        if (typeof this.config.common === 'object') {
            obj.common = Object.assign(obj.common, this.config.common);
        }
        if (typeof this.config.native === 'object') {
            obj.native = Object.assign(obj.native, this.config.native);
        }
        extendObject(this.namespace, {
            //type: 'device',
            type: 'channel',
            common: obj.common,
            native: obj.native
        }, function (err) {
            if (err) {
                log('could not create virtual device: ' + this.namespace, 'warn');
                return;
            }
            log('created object for device ' + this.namespace, 'debug');
            if (typeof this.config.onCreate === 'function') {
                this.config.onCreate(this, callback);
            } else {
                callback();
            }
        }.bind(this));
    };
      
    VirtualDevice.prototype.createStates = function (callback) {
        'use strict';
        log('creating states for device ' + this.namespace, 'debug');
        var stateIds = Object.keys(this.config.states);
        log('creating states ' + JSON.stringify(stateIds), 'debug');
        var countCreated = 0;
        for (var i = 0; i < stateIds.length; i++) {
            let stateId = stateIds[i];
            this.normalizeState(stateId);
            var id = this.namespace + '.' + stateId;
            log('creating state ' + id, 'debug');
            var obj = this.config.states[stateId].copy ? getObject(this.config.states[stateId].copy) : {
                type: 'state',
                common: {},
                native: {}
            };
            delete obj.common.custom;
            if (typeof this.config.states[stateId].common === 'object') {
                obj.common = Object.assign(obj.common, this.config.states[stateId].common);
            }
            if (typeof this.config.states[stateId].native === 'object') {
                obj.native = Object.assign(obj.native, this.config.states[stateId].native);
            }
    
           // var checkObj = getObject(id);
    
        	//if (!checkObj) {
        		setObject(id, obj, function(err, checkObj) {
        			if (err) {
                        log('skipping creation of state ' + id, 'debug');
                    } else {
                        log('created state ' + id, 'debug');
                    }
                    if (!err && checkObj) {
                        //setTimeout(function(){
                            this.connectState(stateId);
                            countCreated++;
                            if (countCreated >= stateIds.length) {
                                log('created ' + countCreated + ' states for device ' + this.namespace, 'debug');
                                callback();
                            }
    
                            var newId = checkObj.id;
                            var helper = newId.substr(newId.lastIndexOf('.') + 1, newId.length);
    
                            var stateValueNew = this.config.states[helper].stateValue;
                            
                            if (stateValueNew !== undefined) {
                                setStateDelayed(newId, stateValueNew, 1000);
                                log('set default: ' + stateValueNew + ' for ' + newId);
                            }
                        //}.bind(this), 500);
                    }
        		}.bind(this)); 
        	//} 
        }
    };
     
    VirtualDevice.prototype.normalizeState = function (state) {
        log('normalizing state ' + state, 'debug');
        if (typeof this.config.states[state].read !== 'object') {
            this.config.states[state].read = {};
        }
        if (typeof this.config.states[state].write !== 'object') {
            this.config.states[state].write = {};
        }
     
        var readIds = Object.keys(this.config.states[state].read);
        for (var i = 0; i < readIds.length; i++) {
            var readId = this.config.states[state].read[readIds[i]];
            if (typeof readId.before !== 'function') {
                this.config.states[state].read[readIds[i]].before = function (device, value, callback) {
                    callback();
                };
            }
            if (typeof readId.after !== 'function') {
                this.config.states[state].read[readIds[i]].after = function (device, value) {
                };
            }
        }
        var writeIds = Object.keys(this.config.states[state].write);
        for (i = 0; i < writeIds.length; i++) {
            var writeId = this.config.states[state].write[writeIds[i]];
            if (typeof writeId.before !== 'function') {
                this.config.states[state].write[writeIds[i]].before = function (device, value, callback) {
                    callback()
                };
            }
            if (typeof writeId.after !== 'function') {
                this.config.states[state].write[writeIds[i]].after = function (device, value) {
                };
            }
        }
        log('normalized state ' + state, 'debug');
    };
     
    
    VirtualDevice.prototype.connectState = function (state) {
        setTimeout(function(){
            log('connecting state ' + state, 'debug');
            var id = this.namespace + '.' + state;
        
            //subscribe to read ids
            var readIds = Object.keys(this.config.states[state].read);
            for (var i = 0; i < readIds.length; i++) {
                if (readIds[i] === null || readIds[i] === undefined || readIds[i] === '') {
                    continue;
                }
                if (getState(readIds[i]).notExist === true) { //check if state exists
                    log('cannot connect to not existing state: ' + readIds[i], 'warn');
                    continue;
                }
                var readObj = this.config.states[state].read[readIds[i]];
                var trigger = readObj.trigger || {change: 'any'};
                trigger.ack = true;
                trigger.id = readIds[i];
                this.subRead(trigger, readObj, state);
                log('connected ' + readIds[i] + ' to ' + id, 'debug');
            }
        
            //subscribe to this state and write to write ids
            var writeIds = Object.keys(this.config.states[state].write);
            var trigger = {id: this.namespace + '.' + state, change: 'any', ack: false};
            //original var trigger = {id: 'javascript.' + instance + '.' + this.namespace + '.' + state, change: 'any', ack: false};
            on(trigger, function (obj) {
                'use strict';
                log('detected change of ' + state, 'debug');
                for (var i = 0; i < writeIds.length; i++) {
                    let writeObj = this.config.states[state].write[writeIds[i]];
                    let val = this.convertValue(obj.state.val, writeObj.convert);
                    let writeId = writeIds[i];
                    log('executing function before for ' + writeId, 'debug');
                    writeObj.before(this, val, function (newVal, newDelay) {
                        if (newVal !== undefined && newVal !== null) val = newVal;
                        var delay = writeObj.delay;
                        if (newDelay !== undefined && newDelay !== null) delay = newDelay;
                        log(newVal + 'writing value ' + val + ' to ' + writeId + ' with delay ' + delay, 'debug');
                        setStateDelayed(writeId, val, false, delay || 0, true, function () {
                            log('executing function after for ' + writeId, 'debug');
                            writeObj.after(this, val);
                        }.bind(this));
                    }.bind(this));
                }
            }.bind(this));
    
            log('connected ' + state + ' to ' + JSON.stringify(writeIds), 'debug');
        }.bind(this), 500);
    };
      
    VirtualDevice.prototype.subRead = function (trigger, readObj, state) {
        var func = function (obj) {
            var val = this.convertValue(obj.state.val, readObj.convert);
     
            //@todo aggregations
     
            log('executing function before for ' + trigger.id, 'debug');
            readObj.before(this, val, function (newVal, newDelay) {
                if (newVal !== undefined && newVal !== null) val = newVal;
                if (newDelay !== undefined && newDelay !== null) writeObj.delay = newDelay;
                log('reading value ' + val + ' to ' + this.namespace + '.' + state, 'debug');
                setStateDelayed(this.namespace + '.' + state, val, true, readObj.delay || 0, true, function () {
                    log('executing function after for ' + trigger.id, 'debug');
                    readObj.after(this, val);
                }.bind(this));
            }.bind(this));
        }.bind(this);
        func({state: getState(trigger.id)});
        on(trigger, func);
    };
     
    VirtualDevice.prototype.convertValue = function (val, func) {
        if (typeof func !== 'function') {
            return val;
        }
        return func(val);
    };
    
    var deviceId = 'watermeter';
    
    new VirtualDevice({
        namespace: 'ESP',
        name: deviceId,
        states: {
            'isTelegramInfo': {
                common: {name: 'TelegramInfo wird durch JavaScript gesetzt', role: 'state', type: 'boolean', desc: 'TelegramInfo', read: true, write: true, def: true},
                stateValue: true
            },
            'name': {
                common: {name: 'VirtualDevice.0.ESP.' + deviceId, role: 'text', type: 'string', desc: 'name', read: true, write: false, def: 'Keller Waschraum - Wasserzähler'},
                stateValue: 'Keller Waschraum - Wasserzähler'
            },
            'Zaehlerstand': {
                common: {name: 'VirtualDevice.0.ESP.' + deviceId + '.Zaehlerstand', role: 'variable', type: 'number', desc: 'Zaehlerstand', read: true, write: false, def: '0', 'unit': 'm³',
                    custom: {
                        'influxdb.0': {
                            'enabled': true,
                            'changesOnly': true,
                            'debounce': 0,
                            'maxLength': 10,
                            'retention': 0,
                            'changesRelogInterval': 0,
                            'changesMinDelta': 0,
                            'storageType': '',
                            'aliasId': ''
                        }
                    }
                },
                read: {
                    'mqtt.0.wasserzaehler.zaehlerstand': {
                        convert: function (val) {
                            return Number(val);
                        },
                    },
                },
            },
            'online': {
                common: {name: 'VirtualDevice.0.ESP.' + deviceId + '.online', role: 'variable', type: 'boolean', desc: 'online', read: true, write: false, def: false,
                    custom: {
                            'influxdb.0': {
                                'enabled': true,
                                'changesOnly': true,
                                'debounce': 0,
                                'maxLength': 10,
                                'retention': 0,
                                'changesRelogInterval': 30,
                                'changesMinDelta': 0,
                                'storageType': '',
                                'aliasId': ''
                            }
                        }
                },
                read: {
                    'mqtt.0.wasserzaehler.error': {
                        convert: function (val) {
                            return val != 'connection lost';
                        },
                        trigger: setTimeout(function(){
                                on({id:'VirtualDevice.0.ESP.' + deviceId + '.online', change: 'ne'}, function (obj) {
                                    var value = obj.state.val;
    
                                    if (getState('VirtualDevice.0.ESP.' + deviceId + '.isTelegramInfo').val === true) {
                                        var name = getState('VirtualDevice.0.ESP.' + deviceId + '.name').val;
    
                                        _sendLogToTelegram(_findCorrectEmoji('OnlineStatus: ' + name + ' ist ' + (value === true ? 'wieder' : 'nicht') + ' erreichbar.'));
                                    } 
                                })
                            }, 500)
                    },
                },
                write: {}
            },
            'error': {
                common: {name: 'VirtualDevice.0.ESP.' + deviceId + '.error', role: 'text', type: 'string', desc: 'error', read: true, write: false, def: ''},
                read: {
                    'mqtt.0.wasserzaehler.error': {
                    },
                },
                write: {}
            },
            'Calculation.TageszaehlStand': {
                common: {name: 'VirtualDevice.0.ESP.' + deviceId + '.Calculation.TageszaehlStand', role: 'variable', type: 'number', desc: 'TageszaehlStand', read: true, write: true, def: 0, min: 0, max: 999999, 'unit': 'm³'},
            },
            'Calculation.aktuellerTagesVerbrauch': {
                common: {name: 'VirtualDevice.0.ESP.' + deviceId + '.Calculation.aktuellerTagesVerbrauch', role: 'variable', type: 'number', desc: 'aktuellerTagesVerbrauch', read: true, write: true, def: 0, min: 0, max: 999999, 'unit': 'm³'},
            },
            'Calculation.TagesVerbrauch_1': {
                common: {name: 'VirtualDevice.0.ESP.' + deviceId + '.Calculation.TagesVerbrauch_1', role: 'variable', type: 'number', desc: 'TagesVerbrauch_1', read: true, write: true, def: 0, min: 0, max: 999999, 'unit': 'm³'},
            },
            'Calculation.TagesVerbrauch_2': {
                common: {name: 'VirtualDevice.0.ESP.' + deviceId + '.Calculation.TagesVerbrauch_2', role: 'variable', type: 'number', desc: 'TagesVerbrauch_2', read: true, write: true, def: 0, min: 0, max: 999999, 'unit': 'm³'},
            },
            'Calculation.TagesVerbrauch_3': {
                common: {name: 'VirtualDevice.0.ESP.' + deviceId + '.Calculation.TagesVerbrauch_3', role: 'variable', type: 'number', desc: 'TagesVerbrauch_3', read: true, write: true, def: 0, min: 0, max: 999999, 'unit': 'm³'},
            },
            'Calculation.TagesVerbrauch_4': {
                common: {name: 'VirtualDevice.0.ESP.' + deviceId + '.Calculation.TagesVerbrauch_4', role: 'variable', type: 'number', desc: 'TagesVerbrauch_4', read: true, write: true, def: 0, min: 0, max: 999999, 'unit': 'm³'},
            },
            'Calculation.TagesVerbrauch_5': {
                common: {name: 'VirtualDevice.0.ESP.' + deviceId + '.Calculation.TagesVerbrauch_5', role: 'variable', type: 'number', desc: 'TagesVerbrauch_5', read: true, write: true, def: 0, min: 0, max: 999999, 'unit': 'm³'},
            },
            'Calculation.TagesVerbrauch_6': {
                common: {name: 'VirtualDevice.0.ESP.' + deviceId + '.Calculation.TagesVerbrauch_6', role: 'variable', type: 'number', desc: 'TagesVerbrauch_6', read: true, write: true, def: 0, min: 0, max: 999999, 'unit': 'm³'},
            },
            'Calculation.TagesVerbrauch_7': {
                common: {name: 'VirtualDevice.0.ESP.' + deviceId + '.Calculation.TagesVerbrauch_7', role: 'variable', type: 'number', desc: 'TagesVerbrauch_7', read: true, write: true, def: 0, min: 0, max: 999999, 'unit': 'm³'},
            },
    
            'Calculation.WochenzaehlStand': {
                common: {name: 'VirtualDevice.0.ESP.' + deviceId + '.Calculation.WochenzaehlStand', role: 'variable', type: 'number', desc: 'WochenzaehlStand', read: true, write: true, def: 0, min: 0, max: 999999, 'unit': 'm³'},
            },
             'Calculation.aktuellerWochenVerbrauch': {
                common: {name: 'VirtualDevice.0.ESP.' + deviceId + '.Calculation.aktuellerWochenVerbrauch', role: 'variable', type: 'number', desc: 'aktuellerWochenVerbrauch', read: true, write: true, def: 0, min: 0, max: 999999, 'unit': 'm³'},
            },
            'Calculation.WochenVerbrauch_1': {
                common: {name: 'VirtualDevice.0.ESP.' + deviceId + '.Calculation.WochenVerbrauch_1', role: 'variable', type: 'number', desc: 'WochenVerbrauch_1', read: true, write: true, def: 0, min: 0, max: 999999, 'unit': 'm³'},
            },
            'Calculation.WochenVerbrauch_2': {
                common: {name: 'VirtualDevice.0.ESP.' + deviceId + '.Calculation.WochenVerbrauch_2', role: 'variable', type: 'number', desc: 'WochenVerbrauch_2', read: true, write: true, def: 0, min: 0, max: 999999, 'unit': 'm³'},
            },
            'Calculation.WochenVerbrauch_3': {
                common: {name: 'VirtualDevice.0.ESP.' + deviceId + '.Calculation.WochenVerbrauch_3', role: 'variable', type: 'number', desc: 'WochenVerbrauch_3', read: true, write: true, def: 0, min: 0, max: 999999, 'unit': 'm³'},
            },
            'Calculation.WochenVerbrauch_4': {
                common: {name: 'VirtualDevice.0.ESP.' + deviceId + '.Calculation.WochenVerbrauch_4', role: 'variable', type: 'number', desc: 'WochenVerbrauch_4', read: true, write: true, def: 0, min: 0, max: 999999, 'unit': 'm³'},
            },
            'Calculation.WochenVerbrauch_5': {
                common: {name: 'VirtualDevice.0.ESP.' + deviceId + '.Calculation.WochenVerbrauch_5', role: 'variable', type: 'number', desc: 'WochenVerbrauch_5', read: true, write: true, def: 0, min: 0, max: 999999, 'unit': 'm³'},
            },
            'Calculation.WochenVerbrauch_6': {
                common: {name: 'VirtualDevice.0.ESP.' + deviceId + '.Calculation.WochenVerbrauch_6', role: 'variable', type: 'number', desc: 'WochenVerbrauch_6', read: true, write: true, def: 0, min: 0, max: 999999, 'unit': 'm³'},
            },
            'Calculation.WochenVerbrauch_7': {
                common: {name: 'VirtualDevice.0.ESP.' + deviceId + '.Calculation.WochenVerbrauch_7', role: 'variable', type: 'number', desc: 'WochenVerbrauch_7', read: true, write: true, def: 0, min: 0, max: 999999, 'unit': 'm³'},
            },
    
            'Calculation.MonatzaehlStand': {
                common: {name: 'VirtualDevice.0.ESP.' + deviceId + '.Calculation.MonatzaehlStand', role: 'variable', type: 'number', desc: 'MonatzaehlStand', read: true, write: true, def: 0, min: 0, max: 999999, 'unit': 'm³'},
            },
             'Calculation.aktuellerMonatVerbrauch': {
                common: {name: 'VirtualDevice.0.ESP.' + deviceId + '.Calculation.aktuellerMonatVerbrauch', role: 'variable', type: 'number', desc: 'aktuellerMonatVerbrauch', read: true, write: true, def: 0, min: 0, max: 999999, 'unit': 'm³'},
            },
            'Calculation.MonatVerbrauch_1': {
                common: {name: 'VirtualDevice.0.ESP.' + deviceId + '.Calculation.MonatVerbrauch_1', role: 'variable', type: 'number', desc: 'MonatVerbrauch_1', read: true, write: true, def: 0, min: 0, max: 999999, 'unit': 'm³'},
            },
            'Calculation.MonatVerbrauch_2': {
                common: {name: 'VirtualDevice.0.ESP.' + deviceId + '.Calculation.MonatVerbrauch_2', role: 'variable', type: 'number', desc: 'MonatVerbrauch_2', read: true, write: true, def: 0, min: 0, max: 999999, 'unit': 'm³'},
            },
            'Calculation.MonatVerbrauch_3': {
                common: {name: 'VirtualDevice.0.ESP.' + deviceId + '.Calculation.MonatVerbrauch_3', role: 'variable', type: 'number', desc: 'MonatVerbrauch_3', read: true, write: true, def: 0, min: 0, max: 999999, 'unit': 'm³'},
            },
            'Calculation.MonatVerbrauch_4': {
                common: {name: 'VirtualDevice.0.ESP.' + deviceId + '.Calculation.MonatVerbrauch_4', role: 'variable', type: 'number', desc: 'MonatVerbrauch_4', read: true, write: true, def: 0, min: 0, max: 999999, 'unit': 'm³'},
            },
            'Calculation.MonatVerbrauch_5': {
                common: {name: 'VirtualDevice.0.ESP.' + deviceId + '.Calculation.MonatVerbrauch_5', role: 'variable', type: 'number', desc: 'MonatVerbrauch_5', read: true, write: true, def: 0, min: 0, max: 999999, 'unit': 'm³'},
            },
            'Calculation.MonatVerbrauch_6': {
                common: {name: 'VirtualDevice.0.ESP.' + deviceId + '.Calculation.MonatVerbrauch_6', role: 'variable', type: 'number', desc: 'MonatVerbrauch_6', read: true, write: true, def: 0, min: 0, max: 999999, 'unit': 'm³'},
            },
            'Calculation.MonatVerbrauch_7': {
                common: {name: 'VirtualDevice.0.ESP.' + deviceId + '.Calculation.MonatVerbrauch_7', role: 'variable', type: 'number', desc: 'MonatVerbrauch_7', read: true, write: true, def: 0, min: 0, max: 999999, 'unit': 'm³'},
            },
            'Calculation.MonatVerbrauch_8': {
                common: {name: 'VirtualDevice.0.ESP.' + deviceId + '.Calculation.MonatVerbrauch_8', role: 'variable', type: 'number', desc: 'MonatVerbrauch_8', read: true, write: true, def: 0, min: 0, max: 999999, 'unit': 'm³'},
            },
            'Calculation.MonatVerbrauch_9': {
                common: {name: 'VirtualDevice.0.ESP.' + deviceId + '.Calculation.MonatVerbrauch_9', role: 'variable', type: 'number', desc: 'MonatVerbrauch_9', read: true, write: true, def: 0, min: 0, max: 999999, 'unit': 'm³'},
            },
            'Calculation.MonatVerbrauch_10': {
                common: {name: 'VirtualDevice.0.ESP.' + deviceId + '.Calculation.MonatVerbrauch_10', role: 'variable', type: 'number', desc: 'MonatVerbrauch_10', read: true, write: true, def: 0, min: 0, max: 999999, 'unit': 'm³'},
            },
            'Calculation.MonatVerbrauch_11': {
                common: {name: 'VirtualDevice.0.ESP.' + deviceId + '.Calculation.MonatVerbrauch_11', role: 'variable', type: 'number', desc: 'MonatVerbrauch_11', read: true, write: true, def: 0, min: 0, max: 999999, 'unit': 'm³'},
            },
            'Calculation.MonatVerbrauch_12': {
                common: {name: 'VirtualDevice.0.ESP.' + deviceId + '.Calculation.MonatVerbrauch_12', role: 'variable', type: 'number', desc: 'MonatVerbrauch_12', read: true, write: true, def: 0, min: 0, max: 999999, 'unit': 'm³'},
            },
    
            'Calculation.JahreszaehlStand': {
                common: {name: 'VirtualDevice.0.ESP.' + deviceId + '.Calculation.JahreszaehlStand', role: 'variable', type: 'number', desc: 'JahreszaehlStand', read: true, write: true, def: 0, min: 0, max: 999999, 'unit': 'm³'},
            },
             'Calculation.aktuellerJahresVerbrauch': {
                common: {name: 'VirtualDevice.0.ESP.' + deviceId + '.Calculation.aktuellerJahresVerbrauch', role: 'variable', type: 'number', desc: 'aktuellerJahresVerbrauch', read: true, write: true, def: 0, min: 0, max: 999999, 'unit': 'm³'},
            },
            'Calculation.JahresVerbrauch_1': {
                common: {name: 'VirtualDevice.0.ESP.' + deviceId + '.Calculation.JahresVerbrauch_1', role: 'variable', type: 'number', desc: 'JahresVerbrauch_1', read: true, write: true, def: 0, min: 0, max: 999999, 'unit': 'm³'},
            },
            'Calculation.JahresVerbrauch_2': {
                common: {name: 'VirtualDevice.0.ESP.' + deviceId + '.Calculation.JahresVerbrauch_2', role: 'variable', type: 'number', desc: 'JahresVerbrauch_2', read: true, write: true, def: 0, min: 0, max: 999999, 'unit': 'm³'},
            },
            'Calculation.JahresVerbrauch_3': {
                common: {name: 'VirtualDevice.0.ESP.' + deviceId + '.Calculation.JahresVerbrauch_3', role: 'variable', type: 'number', desc: 'JahresVerbrauch_3', read: true, write: true, def: 0, min: 0, max: 999999, 'unit': 'm³'},
            },
            'Calculation.JahresVerbrauch_4': {
                common: {name: 'VirtualDevice.0.ESP.' + deviceId + '.Calculation.JahresVerbrauch_4', role: 'variable', type: 'number', desc: 'JahresVerbrauch_4', read: true, write: true, def: 0, min: 0, max: 999999, 'unit': 'm³'},
            },
            'Calculation.JahresVerbrauch_5': {
                common: {name: 'VirtualDevice.0.ESP.' + deviceId + '.Calculation.JahresVerbrauch_5', role: 'variable', type: 'number', desc: 'JahresVerbrauch_5', read: true, write: true, def: 0, min: 0, max: 999999, 'unit': 'm³'},
            },
            'Calculation.JahresVerbrauch_6': {
                common: {name: 'VirtualDevice.0.ESP.' + deviceId + '.Calculation.JahresVerbrauch_6', role: 'variable', type: 'number', desc: 'JahresVerbrauch_6', read: true, write: true, def: 0, min: 0, max: 999999, 'unit': 'm³'},
            },
            'Calculation.JahresVerbrauch_7': {
                common: {name: 'VirtualDevice.0.ESP.' + deviceId + '.Calculation.JahresVerbrauch_7', role: 'variable', type: 'number', desc: 'JahresVerbrauch_7', read: true, write: true, def: 0, min: 0, max: 999999, 'unit': 'm³'},
            },
        }
    });
    
    
    
    

    Könnte mir da bitte jemand weiterhelfen, wäre sehr dankbar.
    lg


  • Hallo zusammen,

    leider klappt mein Update von 3.1.6 auf 3.2.16 nicht.
    Hab´s ausprobiert, wie beschrieben, aber auch nach dem fix funktioniert es genaus wenig wie mit "sudo -H -u iobroker npm install iobroker.js-controller":

    pi@ioBroker-Pi:/opt/iobroker/node_modules/.bin $ curl -sL https://iobroker.net/f                                                                                                                               ix.sh | bash -
    library: loaded
    Library version=2021-01-23
    
    ==========================================================================
    
        Welcome to the ioBroker installation fixer!
        Script version: 2020-12-07
    
        You might need to enter your password a couple of times.
    
    ==========================================================================
    
    
    ==========================================================================
        Installing prerequisites (1/3)
    ==========================================================================
    
    Holen:1 http://archive.raspberrypi.org/debian stretch InRelease [25,3 kB]
    Holen:2 http://mirrordirector.raspbian.org/raspbian stretch InRelease [15,0 kB]
    Holen:3 http://archive.raspberrypi.org/debian stretch/main armhf Packages [192 k                                                                                                                               B]
    Holen:4 http://archive.raspberrypi.org/debian stretch/ui armhf Packages [44,6 kB                                                                                                                               ]
    Holen:5 https://deb.nodesource.com/node_10.x stretch InRelease [4.585 B]
    Holen:6 http://mirrordirector.raspbian.org/raspbian stretch/main armhf Packages                                                                                                                                [11,7 MB]
    Holen:7 https://deb.nodesource.com/node_10.x stretch/main armhf Packages [765 B]
    Holen:8 http://mirrordirector.raspbian.org/raspbian stretch/non-free armhf Packa                                                                                                                               ges [98,9 kB]
    Es wurden 12,0 MB in 15 s geholt (766 kB/s).
    Paketlisten werden gelesen... Fertig
    Installed gcc-c++
    Installed libcairo2-dev
    Installed libpango1.0-dev
    Installed libjpeg-dev
    Installed libgif-dev
    Installed librsvg2-dev
    
    ==========================================================================
        Checking ioBroker user and directory permissions (2/3)
    ==========================================================================
    
    Created /etc/sudoers.d/iobroker
    Fixing directory permissions...
    
    ==========================================================================
        Checking autostart (3/3)
    ==========================================================================
    
    Enabling autostart...
    Autostart enabled!
    
    ==========================================================================
    
        Your installation was fixed successfully
        Run iobroker start to start ioBroker again!
    
    ==========================================================================
    
    pi@ioBroker-Pi:/opt/iobroker/node_modules/.bin $
    pi@ioBroker-Pi:/opt/iobroker/node_modules/.bin $
    pi@ioBroker-Pi:/opt/iobroker/node_modules/.bin $ iobroker upgrade self
    Update js-controller from @3.1.6 to @3.2.16
    NPM version: 6.14.4
    npm install iobroker.js-controller@3.2.16 --loglevel error --unsafe-perm --prefi                                                                                                                               x "/opt/iobroker" (System call)
    npm ERR! code EEXIST
    npm ERR! path /opt/iobroker/node_modules/.bin/iobroker
    npm ERR! Refusing to delete /opt/iobroker/node_modules/.bin/iobroker: is outside /opt/iobroker/node_modules/iobroker.js-controller and not a link
    npm ERR! File exists: /opt/iobroker/node_modules/.bin/iobroker
    npm ERR! Remove the existing file and try again, or run npm
    npm ERR! with --force to overwrite files recklessly.
    
    npm ERR! A complete log of this run can be found in:
    npm ERR!     /home/iobroker/.npm/_logs/2021-03-25T19_56_16_277Z-debug.log
    Starting node restart.js
    pi@ioBroker-Pi:/opt/iobroker/node_modules/.bin $ sudo -H -u iobroker npm install iobroker.js-controller
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.1 (node_modules/chokidar/node_modules/fsevents):
    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm"})
    
    npm ERR! code EEXIST
    npm ERR! path /opt/iobroker/node_modules/.bin/iobroker
    npm ERR! Refusing to delete /opt/iobroker/node_modules/.bin/iobroker: is outside /opt/iobroker/node_modules/iobroker.js-controller and not a link
    npm ERR! File exists: /opt/iobroker/node_modules/.bin/iobroker
    npm ERR! Remove the existing file and try again, or run npm
    npm ERR! with --force to overwrite files recklessly.
    
    npm ERR! A complete log of this run can be found in:
    npm ERR!     /home/iobroker/.npm/_logs/2021-03-25T19_58_22_934Z-debug.log
    pi@ioBroker-Pi:/opt/iobroker/node_modules/.bin $
    
    

    "Lösche" ich /opt/iobroker/node_modules/.bin/iobroker, kommt dann die Fehlermeldung:

    pi@ioBroker-Pi:/opt/iobroker/node_modules/.bin $ sudo -H -u iobroker npm install iobroker.js-controller
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.1 (node_modules/chokidar/node_modules/fsevents):
    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm"})
    
    npm ERR! code EEXIST
    npm ERR! path /opt/iobroker/node_modules/iobroker.js-controller/node_modules/.bin/semver
    npm ERR! Refusing to delete /opt/iobroker/node_modules/iobroker.js-controller/node_modules/.bin/semver: is outside /opt/iobroker/node_modules/iobroker.js-controller/node_modules/semver and not a link
    npm ERR! File exists: /opt/iobroker/node_modules/iobroker.js-controller/node_modules/.bin/semver
    npm ERR! Remove the existing file and try again, or run npm
    npm ERR! with --force to overwrite files recklessly.
    
    npm ERR! A complete log of this run can be found in:
    npm ERR!     /home/iobroker/.npm/_logs/2021-03-25T20_09_00_166Z-debug.log
    
    

    Hat jemand eine Idee? Was kann ich ausprobieren?

    Viele Grüße und danke im Voraus,
    Christian

  • Most Active

    @christians

    stretch EOL: 2020-07-06

    Vermutlich solltest du die angemeckerten Dateien manuell löschen.
    Und du solltest nicht in dem Verzeichnis stehen. Stell dich in dein /home.


  • @christians sagte in js-controller 3.2 jetzt im Latest!:

    /opt/iobroker/node_modules/.bin

    Ja ... das nicht in dem verzeichnis machen ?! 😉

    /opt/iobroker


  • @apollon77

    Leider ändert es nichts, wenn ich das Ganze aus dem /opt/iobroker Verzeichnis heraus mache.

    Erstmal "normal":

    pi@ioBroker-Pi:/opt/iobroker $ iobroker upgrade self
    Update js-controller from @3.1.6 to @3.2.16
    NPM version: 6.14.4
    npm install iobroker.js-controller@3.2.16 --loglevel error --unsafe-perm --prefix "/opt/iobroker" (System call)
    npm ERR! code EEXIST
    npm ERR! path /opt/iobroker/node_modules/.bin/iobroker
    npm ERR! Refusing to delete /opt/iobroker/node_modules/.bin/iobroker: is outside /opt/iobroker/node_modules/iobroker.js-controller and not a link
    npm ERR! File exists: /opt/iobroker/node_modules/.bin/iobroker
    npm ERR! Remove the existing file and try again, or run npm
    npm ERR! with --force to overwrite files recklessly.
    
    npm ERR! A complete log of this run can be found in:
    npm ERR!     /home/iobroker/.npm/_logs/2021-03-26T21_24_38_839Z-debug.log
    Starting node restart.js
    

    Dann fix.sh inkl. nächstem Versuch:

    pi@ioBroker-Pi:/opt/iobroker $ curl -sL https://iobroker.net/fix.sh | bash -
    library: loaded
    Library version=2021-01-23
    
    ==========================================================================
    
        Welcome to the ioBroker installation fixer!
        Script version: 2020-12-07
    
        You might need to enter your password a couple of times.
    
    ==========================================================================
    
    
    ==========================================================================
        Installing prerequisites (1/3)
    ==========================================================================
    
    OK:1 http://archive.raspberrypi.org/debian stretch InRelease
    OK:2 http://mirrordirector.raspbian.org/raspbian stretch InRelease
    OK:3 https://deb.nodesource.com/node_10.x stretch InRelease
    Paketlisten werden gelesen... Fertig
    Installed gcc-c++
    
    ==========================================================================
        Checking ioBroker user and directory permissions (2/3)
    ==========================================================================
    
    Created /etc/sudoers.d/iobroker
    Fixing directory permissions...
    
    ==========================================================================
        Checking autostart (3/3)
    ==========================================================================
    
    Enabling autostart...
    Autostart enabled!
    
    ==========================================================================
    
        Your installation was fixed successfully
        Run iobroker start to start ioBroker again!
    
    ==========================================================================
    
    pi@ioBroker-Pi:/opt/iobroker $
    pi@ioBroker-Pi:/opt/iobroker $
    pi@ioBroker-Pi:/opt/iobroker $
    pi@ioBroker-Pi:/opt/iobroker $ iobroker upgrade self
    Update js-controller from @3.1.6 to @3.2.16
    NPM version: 6.14.4
    npm install iobroker.js-controller@3.2.16 --loglevel error --unsafe-perm --prefix "/opt/iobroker" (System call)
    npm ERR! code EEXIST
    npm ERR! path /opt/iobroker/node_modules/.bin/iobroker
    npm ERR! Refusing to delete /opt/iobroker/node_modules/.bin/iobroker: is outside /opt/iobroker/node_modules/iobroker.js-controller and not a link
    npm ERR! File exists: /opt/iobroker/node_modules/.bin/iobroker
    npm ERR! Remove the existing file and try again, or run npm
    npm ERR! with --force to overwrite files recklessly.
    
    npm ERR! A complete log of this run can be found in:
    npm ERR!     /home/iobroker/.npm/_logs/2021-03-26T21_28_21_744Z-debug.log
    Starting node restart.js
    

    Und dann noch "mit "sudo -H -u iobroker npm install iobroker.js-controller"

    pi@ioBroker-Pi:/opt/iobroker $ sudo -H -u iobroker npm install iobroker.js-controller
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.1 (node_modules/chokidar/node_modules/fsevents):
    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm"})
    
    npm ERR! code EEXIST
    npm ERR! path /opt/iobroker/node_modules/.bin/iobroker
    npm ERR! Refusing to delete /opt/iobroker/node_modules/.bin/iobroker: is outside /opt/iobroker/node_modules/iobroker.js-controller and not a link
    npm ERR! File exists: /opt/iobroker/node_modules/.bin/iobroker
    npm ERR! Remove the existing file and try again, or run npm
    npm ERR! with --force to overwrite files recklessly.
    
    npm ERR! A complete log of this run can be found in:
    npm ERR!     /home/iobroker/.npm/_logs/2021-03-26T21_30_13_878Z-debug.log
    
    

    Versuche das jetzt mal mit dem manuellen Löschen, wie @Thomas-Braun gesagt hat.

    Viele Grüße,
    Christian


  • Aber das manuelle Löschen hat wirklich geholfen.
    Ich musste folgende Files aus dem Verzeichnis /opt/iobroker/node_modules/iobroker.js-controller/node_modules/.bin/ löschen:

    iobroker
    mime
    mkdirp
    semver

    Danach lief die Installation durch:

    pi@ioBroker-Pi:/opt/iobroker $ iobroker upgrade self
    Update js-controller from @3.1.6 to @3.2.16
    NPM version: 6.14.4
    npm install iobroker.js-controller@3.2.16 --loglevel error --unsafe-perm --prefix "/opt/iobroker" (System call)
    Starting node restart.js
    

    iobroker ließ sich starten und ....

    pi@ioBroker-Pi:/opt/iobroker $ iobroker version
    3.2.16
    

    Danke Euch für die Unterstützung!

    Viele Grüße,
    Christian

Suggested Topics

  • 14
  • 18
  • 9
  • 9
  • 4
  • 6
  • 3
  • 2

1.7k
Online

38.3k
Users

43.7k
Topics

611.2k
Posts