main.js
/**
     * createVOC
     *
     * creates the data fields for the values itself and the index if the device has a VOC sensor
     *
     * @param message {object} the received mqtt message
     * @param row     {string} the current data row
     * @param device  {object} the device object the data is valid for
     */
createVOC
creates the data fields for the values itself and the index if the device has a VOC sensor

@param message {object} the received mqtt message
@param row     {string} the current data row
@param device  {object} the device object the data is valid for
createVOC creates the data fields for the values itself and the index if the device has a VOC sensor @param message { object } the received mqtt message @param row { string } the current data row @param device { object } the device object the data is valid for
createVOC(message, row, device) {
        let VOCIndex = 0;
        if (message[row].va10 < 40) {
            VOCIndex = 0;
        } else if (message[row].va10 >= 40 && message[row].va10 < 70) {
            VOCIndex = 1;
        } else if (message[row].va10 >= 70 && message[row].va10 < 90) {
            VOCIndex = 2;
        } else if (message[row].va10 >= 90) {
            VOCIndex = 3;
        }
        this.createOrExtendObject(device.Serial + '.Sensor.VOCIndex', {
            type: 'state',
            common: {
                name: 'VOC QualityIndex. 0-39: Good, 40-69: Medium, 70-89: Bad, >90: very Bad',
                'read': true,
                'write': false,
                'role': 'value',
                'type': 'number',
                'states' : {0:'Good', 1:'Medium', 2:'Bad', 3:'very Bad', 4:'extremely Bad', 5:'worrying'}
            },
            native: {}
        }, VOCIndex);
        VOC = VOCIndex;
        this.subscribeStates(device.Serial + '.Sensor.VOCIndex' );
    }
createVOC ( message , row , device ) { let VOCIndex = 0 ; if ( message [ row ] . va10 < 40 ) { VOCIndex = 0 ; } else if ( message [ row ] . va10 >= 40 && message [ row ] . va10 < 70 ) { VOCIndex = 1 ; } else if ( message [ row ] . va10 >= 70 && message [ row ] . va10 < 90 ) { VOCIndex = 2 ; } else if ( message [ row ] . va10 >= 90 ) { VOCIndex = 3 ; } this . createOrExtendObject ( device . Serial + '.Sensor.VOCIndex' , { type : 'state' , common : { name : 'VOC QualityIndex. 0-39: Good, 40-69: Medium, 70-89: Bad, >90: very Bad' , 'read' : true , 'write' : false , 'role' : 'value' , 'type' : 'number' , 'states' : { 0 : 'Good' , 1 : 'Medium' , 2 : 'Bad' , 3 : 'very Bad' , 4 : 'extremely Bad' , 5 : 'worrying' } } , native : { } } , VOCIndex ) ; VOC = VOCIndex ; this . subscribeStates ( device . Serial + '.Sensor.VOCIndex' ) ; }
createVOC
 creates the data fields for the values itself and the index if the device has a VOC sensor
createVOC creates the data fields for the values itself and the index if the device has a VOC sensor
// VOC QualityIndex // 0-3: Good, 4-6: Medium, 7-8, Bad, >9: very Bad