[ { "id": "5a69a1e7bd42362f", "type": "tab", "label": "NCD IO - 27 Environmental", "disabled": false, "info": "", "env": [] }, { "id": "1ba983ca56d5a600", "type": "debug", "z": "5a69a1e7bd42362f", "name": "Debug Sensor", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 600, "y": 420, "wires": [] }, { "id": "6e16d01711fd5be6", "type": "mqtt out", "z": "5a69a1e7bd42362f", "name": "", "topic": "ds/Battery", "qos": "0", "retain": "", "respTopic": "", "contentType": "", "userProps": "", "correl": "", "expiry": "", "broker": "98b7a230daa84efa", "x": 880, "y": 200, "wires": [] }, { "id": "f4c203e7df10fa11", "type": "mqtt out", "z": "5a69a1e7bd42362f", "name": "", "topic": "ds/Temperature", "qos": "0", "retain": "", "respTopic": "", "contentType": "", "userProps": "", "correl": "", "expiry": "", "broker": "98b7a230daa84efa", "x": 900, "y": 240, "wires": [] }, { "id": "fd02454078a6c6f0", "type": "function", "z": "5a69a1e7bd42362f", "name": "data_process", "func": "// Check if the message payload is a string, and parse it if necessary\nlet parsedMsg;\nif (typeof msg.data === 'string') {\n parsedMsg = JSON.parse(msg.data);\n} else {\n parsedMsg = msg.data;\n}\n\n// Extract relevant data from the parsed message payload\nlet { \n nodeId, firmware, battery, battery_percent: batteryPercent, counter, sensor_type: sensorType,\n sensor_data: sensorData, sensor_name: sensorName, addr: sensorAddr, type \n} = parsedMsg;\n\n// Initialize color properties for different sensor data and image\nlet colorProp = {\n temperature: \"\",\n pressure: \"\",\n humidity: \"\",\n gas_resistance: \"\",\n iaq: \"\",\n image: \"\"\n};\n\n// Check if the sensor type is 27 and sensorData is defined\nif (sensorData !== undefined) {\n // Set color property and image for IAQ (Indoor Air Quality) if it's defined\n if (sensorData.iaq !== undefined) {\n if (sensorData.iaq <= 50) {\n colorProp.iaq = \"#5ca731\"; // Green for good IAQ\n colorProp.image = 0;\n } else if (sensorData.iaq <= 100) {\n colorProp.iaq = \"#ADB847\"; // Light green for moderate IAQ\n colorProp.image = 1;\n } else if (sensorData.iaq <= 150) {\n colorProp.iaq = \"#E6A22C\"; // Yellow for unhealthy for sensitive groups\n colorProp.image = 2;\n } else if (sensorData.iaq <= 200) {\n colorProp.iaq = \"#ED8125\"; // Orange for unhealthy\n colorProp.image = 3;\n } else if (sensorData.iaq <= 300) {\n colorProp.iaq = \"#D4403C\"; // Red for very unhealthy\n colorProp.image = 4;\n } else {\n colorProp.iaq = \"#A9364A\"; // Purple for hazardous\n colorProp.image = 5;\n }\n }\n\n // Set color property for Temperature if it's defined\n if (sensorData.temperature !== undefined) {\n if (sensorData.temperature >= 18 && sensorData.temperature <= 24) {\n colorProp.temperature = \"#5CA731\"; // Green for comfortable temperature\n } else if ((sensorData.temperature >= 15 && sensorData.temperature < 18) || \n (sensorData.temperature > 24 && sensorData.temperature <= 27)) {\n colorProp.temperature = \"#BE7E00\"; // Orange for slightly uncomfortable\n } else {\n colorProp.temperature = \"#A9364A\"; // Red for very uncomfortable\n }\n }\n\n // Set color property for Pressure if it's defined\n if (sensorData.pressure !== undefined) {\n if (sensorData.pressure >= 1010 && sensorData.pressure <= 1020) {\n colorProp.pressure = \"#5CA731\"; // Green for normal pressure\n } else if ((sensorData.pressure >= 1000 && sensorData.pressure < 1010) || \n (sensorData.pressure > 1020 && sensorData.pressure <= 1030)) {\n colorProp.pressure = \"#BE7E00\"; // Orange for slightly abnormal pressure\n } else {\n colorProp.pressure = \"#A9364A\"; // Red for very abnormal pressure\n }\n }\n\n // Set color property for Humidity if it's defined\n if (sensorData.humidity !== undefined) {\n if (sensorData.humidity >= 30 && sensorData.humidity <= 50) {\n colorProp.humidity = \"#5CA731\"; // Green for comfortable humidity\n } else if ((sensorData.humidity >= 20 && sensorData.humidity < 30) || \n (sensorData.humidity > 50 && sensorData.humidity <= 60)) {\n colorProp.humidity = \"#BE7E00\"; // Orange for slightly uncomfortable\n } else {\n colorProp.humidity = \"#A9364A\"; // Red for very uncomfortable\n }\n }\n\n // Set color property for Gas Resistance if it's defined\n if (sensorData.gas_resistance !== undefined) {\n if (sensorData.gas_resistance >= 70000 && sensorData.gas_resistance <= 100000) {\n colorProp.gas_resistance = \"#5CA731\"; // Green for good gas resistance\n } else if (sensorData.gas_resistance >= 30000 && sensorData.gas_resistance < 70000) {\n colorProp.gas_resistance = \"#BE7E00\"; // Orange for moderate gas resistance\n } else {\n colorProp.gas_resistance = \"#A9364A\"; // Red for poor gas resistance\n }\n }\n}\n\n// Send the formatted message to different MQTT outputs including color properties and image\nreturn [\n { payload: colorProp.image }, // Image index based on IAQ\n { payload: batteryPercent }, // Battery percentage\n { payload: sensorData?.temperature }, // Temperature data\n { payload: sensorData?.pressure }, // Pressure data\n { payload: sensorData?.humidity }, // Humidity data\n { payload: sensorData?.gas_resistance }, // Gas resistance data\n { payload: sensorData?.iaq }, // IAQ data\n { payload: colorProp.temperature }, // Temperature color property\n { payload: colorProp.pressure }, // Pressure color property\n { payload: colorProp.humidity }, // Humidity color property\n { payload: colorProp.gas_resistance }, // Gas resistance color property\n { payload: sensorAddr } // MAC\n];\n", "outputs": 13, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 600, "y": 300, "wires": [ [ "1845bdd8a0af10a2" ], [ "6e16d01711fd5be6" ], [ "f4c203e7df10fa11" ], [ "863c65ca3c1c1246" ], [ "8d1917444430a18b" ], [ "6bbc8623bbcfb306" ], [ "a5f2286c965ab98b" ], [ "c014bd974e9f55c2" ], [ "04ac7792279a5b72" ], [ "2b04067bc7bec11e" ], [ "3b7895456758f5c1" ], [ "0d00ea56344ac0c0" ], [ "651e7894fdd3acfd" ] ] }, { "id": "a5f2286c965ab98b", "type": "mqtt out", "z": "5a69a1e7bd42362f", "name": "", "topic": "ds/IAQ", "qos": "0", "retain": "", "respTopic": "", "contentType": "", "userProps": "", "correl": "", "expiry": "", "broker": "98b7a230daa84efa", "x": 870, "y": 400, "wires": [] }, { "id": "863c65ca3c1c1246", "type": "mqtt out", "z": "5a69a1e7bd42362f", "name": "", "topic": "ds/Pressure", "qos": "0", "retain": "", "respTopic": "", "contentType": "", "userProps": "", "correl": "", "expiry": "", "broker": "98b7a230daa84efa", "x": 890, "y": 280, "wires": [] }, { "id": "6bbc8623bbcfb306", "type": "mqtt out", "z": "5a69a1e7bd42362f", "name": "", "topic": "ds/Gas_resistance", "qos": "0", "retain": "", "respTopic": "", "contentType": "", "userProps": "", "correl": "", "expiry": "", "broker": "98b7a230daa84efa", "x": 910, "y": 360, "wires": [] }, { "id": "8d1917444430a18b", "type": "mqtt out", "z": "5a69a1e7bd42362f", "name": "", "topic": "ds/Humidity", "qos": "0", "retain": "", "respTopic": "", "contentType": "", "userProps": "", "correl": "", "expiry": "", "broker": "98b7a230daa84efa", "x": 890, "y": 320, "wires": [] }, { "id": "c014bd974e9f55c2", "type": "mqtt out", "z": "5a69a1e7bd42362f", "name": "", "topic": "ds/Temperature/prop/color", "qos": "0", "retain": "", "respTopic": "", "contentType": "", "userProps": "", "correl": "", "expiry": "", "broker": "98b7a230daa84efa", "x": 930, "y": 440, "wires": [] }, { "id": "04ac7792279a5b72", "type": "mqtt out", "z": "5a69a1e7bd42362f", "name": "", "topic": "ds/Pressure/prop/color", "qos": "0", "retain": "", "respTopic": "", "contentType": "", "userProps": "", "correl": "", "expiry": "", "broker": "98b7a230daa84efa", "x": 920, "y": 480, "wires": [] }, { "id": "2b04067bc7bec11e", "type": "mqtt out", "z": "5a69a1e7bd42362f", "name": "", "topic": "ds/Humidity/prop/color", "qos": "0", "retain": "", "respTopic": "", "contentType": "", "userProps": "", "correl": "", "expiry": "", "broker": "98b7a230daa84efa", "x": 920, "y": 520, "wires": [] }, { "id": "3b7895456758f5c1", "type": "mqtt out", "z": "5a69a1e7bd42362f", "name": "", "topic": "ds/Gas_resistance/prop/color", "qos": "0", "retain": "", "respTopic": "", "contentType": "", "userProps": "", "correl": "", "expiry": "", "broker": "98b7a230daa84efa", "x": 940, "y": 560, "wires": [] }, { "id": "0d00ea56344ac0c0", "type": "mqtt out", "z": "5a69a1e7bd42362f", "name": "", "topic": "ds/IAQ/prop/color", "qos": "0", "retain": "", "respTopic": "", "contentType": "", "userProps": "", "correl": "", "expiry": "", "broker": "98b7a230daa84efa", "x": 910, "y": 600, "wires": [] }, { "id": "1845bdd8a0af10a2", "type": "mqtt out", "z": "5a69a1e7bd42362f", "name": "", "topic": "ds/Air Quality Image", "qos": "0", "retain": "", "respTopic": "", "contentType": "", "userProps": "", "correl": "", "expiry": "", "broker": "98b7a230daa84efa", "x": 920, "y": 160, "wires": [] }, { "id": "04e4c54d8c04a680", "type": "comment", "z": "5a69a1e7bd42362f", "name": "NCD Sensor Node", "info": "", "x": 270, "y": 260, "wires": [] }, { "id": "fcc48d8829706644", "type": "comment", "z": "5a69a1e7bd42362f", "name": "Process data from sensor", "info": "", "x": 630, "y": 180, "wires": [] }, { "id": "4d2fbe2617930848", "type": "comment", "z": "5a69a1e7bd42362f", "name": "MQTT-OUT", "info": "", "x": 890, "y": 120, "wires": [] }, { "id": "6850662727f031f6", "type": "ncd-wireless-node", "z": "5a69a1e7bd42362f", "name": "", "connection": "0b47e914c1107fda", "config_comm": "0b47e914c1107fda", "addr": "", "sensor_type": "27", "auto_config": "", "on_the_fly_enable": "", "node_id_delay_active": "", "node_id": 0, "delay": 300, "form_network": "", "destination_active": "", "destination": "0000FFFF", "power_active": "", "power": 4, "retries_active": "", "retries": 10, "pan_id_active": "", "pan_id": "7FFF", "change_enabled": "", "change_pr": "0", "change_interval": "0", "bp_altitude": "0", "bp_pressure": "0", "bp_temp_prec": "0", "bp_press_prec": "0", "amgt_accel": "0", "amgt_mag": "0", "amgt_gyro": "0", "impact_accel_active": "", "impact_accel": "0", "impact_data_rate_active": "", "impact_data_rate": "4", "impact_threshold_active": "", "impact_threshold": 25, "impact_duration_active": "", "impact_duration": 1, "activ_interr_x": 1, "activ_interr_y": 2, "activ_interr_z": 4, "activ_interr_op": 8, "force_calibration_co2_auto_config": "", "force_calibration_co2": 400, "filtering": 0, "data_rate": 5, "time_series": 0, "reading_type": 1, "mode_80_active": "", "mode_80": 0, "measurement_mode_80_active": "", "measurement_mode_80": 0, "on_request_timeout_80_active": "", "on_request_timeout_80": 1, "sensor_boot_time_420ma_active": "", "sensor_boot_time_420ma": 0, "sensor_boot_time_78_active": "", "sensor_boot_time_78": 0, "deadband_80_active": "", "deadband_80": 0, "filter_80_active": "", "filter_80": 0, "output_data_rate_p1_81_active": "", "output_data_rate_p1_81": 0, "output_data_rate_p2_81_active": "", "output_data_rate_p2_81": 0, "sampling_duration_p1_81_active": "", "sampling_duration_p1_81": 0, "sampling_duration_p2_81_active": "", "sampling_duration_p2_81": 0, "led_alert_mode_84_active": "", "led_alert_mode_84": 0, "led_accelerometer_threshold_84_active": "", "led_accelerometer_threshold_84": "", "led_velocity_threshold_84_active": "", "led_velocity_threshold_84": "", "set_rtc_101": 0, "current_calibration_82": "", "current_calibration_82_active": false, "current_calibration_c1_80": 178, "current_calibration_c1_80_active": "", "current_calibration_c2_80": 178, "current_calibration_c2_80_active": "", "current_calibration_c3_80": 178, "current_calibration_c3_80_active": "", "output_data_rate_101_active": "", "output_data_rate_101": 0, "output_data_rate_101_m2_active": "", "output_data_rate_101_m2": 0, "sampling_duration_101_active": "", "sampling_duration_101": 1, "sampling_interval_101_active": "", "sampling_interval_101": 1, "full_scale_range_101_active": "", "full_scale_range_101": 1, "full_scale_range_101_m2_active": "", "full_scale_range_101_m2": 1, "x_axis_101": "", "y_axis_101": "", "z_axis_101": "", "low_pass_filter_80_active": "", "low_pass_filter_80": 0, "high_pass_filter_80_active": "", "high_pass_filter_80": 0, "low_pass_filter_81_p2_active": "", "low_pass_filter_81_p2": 0, "high_pass_filter_81_p2_active": "", "high_pass_filter_81_p2": 0, "roll_angle_threshold_47": 0, "roll_angle_threshold_47_active": "", "pitch_angle_threshold_47": 0, "pitch_angle_threshold_47_active": "", "counter_threshold_35": 50, "counter_threshold_35_active": "", "payload_length_80_active": "", "payload_length_80": 3, "motion_threshold_46_active": "", "motion_threshold_46": 100, "low_calibration_420ma_active": "", "low_calibration_420ma": 68805, "mid_calibration_420ma_active": "", "mid_calibration_420ma": 68724, "high_calibration_420ma_active": "", "high_calibration_420ma": 68714, "thermocouple_type_23_active": "", "thermocouple_type_23": 0, "acceleration_interrupt_threshold_84_active": "", "acceleration_interrupt_threshold_84": "", "x": 290, "y": 300, "wires": [ [ "1ba983ca56d5a600", "fd02454078a6c6f0" ] ] }, { "id": "db1070aeba9eed49", "type": "ncd-gateway-node", "z": "5a69a1e7bd42362f", "name": "", "connection": "0b47e914c1107fda", "unknown_devices": 0, "outputs": 1, "x": 290, "y": 200, "wires": [ [ "1c0267e963b91f57" ] ] }, { "id": "38fada901798fbc5", "type": "comment", "z": "5a69a1e7bd42362f", "name": "NCD Gateway Node", "info": "", "x": 270, "y": 160, "wires": [] }, { "id": "1c0267e963b91f57", "type": "debug", "z": "5a69a1e7bd42362f", "name": "Debug Gateway", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 600, "y": 140, "wires": [] }, { "id": "651e7894fdd3acfd", "type": "mqtt out", "z": "5a69a1e7bd42362f", "name": "", "topic": "meta/MAC", "qos": "0", "retain": "", "respTopic": "", "contentType": "", "userProps": "", "correl": "", "expiry": "", "broker": "98b7a230daa84efa", "x": 890, "y": 640, "wires": [] }, { "id": "98b7a230daa84efa", "type": "mqtt-broker", "name": "blynk.cloud - 27 free", "broker": "blynk.cloud", "port": "8883", "tls": "59176f5932c42a05", "clientid": "", "autoConnect": true, "usetls": true, "protocolVersion": "5", "keepalive": "60", "cleansession": true, "autoUnsubscribe": true, "birthTopic": "", "birthQos": "0", "birthRetain": "false", "birthPayload": "", "birthMsg": {}, "closeTopic": "", "closeQos": "0", "closeRetain": "false", "closePayload": "", "closeMsg": {}, "willTopic": "", "willQos": "0", "willRetain": "false", "willPayload": "", "willMsg": {}, "userProps": "", "sessionExpiry": "" }, { "id": "0b47e914c1107fda", "type": "ncd-gateway-config", "name": "gateway", "comm_type": "serial", "ip_address": "", "tcp_port": "2101", "port": "/dev/ttymxc2", "baudRate": "115200", "pan_id": "7fff", "rssi": false }, { "id": "59176f5932c42a05", "type": "tls-config", "name": "", "cert": "", "key": "", "ca": "", "certname": "", "keyname": "", "caname": "ISRG_Root_X1.der", "servername": "blynk.cloud", "verifyservercert": false, "alpnprotocol": "" } ]