[ { "id": "c89ef65ac7d40c72", "type": "tab", "label": "NCD IO - 27 Environmental", "disabled": false, "info": "", "env": [] }, { "id": "e5d1d022d80dd449", "type": "debug", "z": "c89ef65ac7d40c72", "name": "Debug Sensor", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 600, "y": 420, "wires": [] }, { "id": "a2587ab93c553a3f", "type": "mqtt out", "z": "c89ef65ac7d40c72", "name": "", "topic": "ds/Battery", "qos": "", "retain": "", "respTopic": "", "contentType": "", "userProps": "", "correl": "", "expiry": "", "broker": "98b7a230daa84efa", "x": 880, "y": 220, "wires": [] }, { "id": "79cf4bf7569ab0e2", "type": "mqtt out", "z": "c89ef65ac7d40c72", "name": "", "topic": "ds/Temperature", "qos": "", "retain": "", "respTopic": "", "contentType": "", "userProps": "", "correl": "", "expiry": "", "broker": "98b7a230daa84efa", "x": 900, "y": 280, "wires": [] }, { "id": "6e561b2ad649185c", "type": "function", "z": "c89ef65ac7d40c72", "name": "data_process", "func": "// Check if the message payload is a string, and parse it if necessary\nlet parsedMsg;\nif (typeof msg.payload === 'string') {\n parsedMsg = JSON.parse(msg.payload);\n} else {\n parsedMsg = msg.payload;\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 (sensorType === 27 && 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];\n", "outputs": 12, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 600, "y": 300, "wires": [ [ "f37aae910013b59d" ], [ "a2587ab93c553a3f" ], [ "79cf4bf7569ab0e2" ], [ "c98a3c8d85c73adc" ], [ "c4a169da17b7876c" ], [ "91e2bdd8c8d76e8b" ], [ "94a6bb022db1c542" ], [ "5517752c074d9597" ], [ "bf26dc4a294ade9f" ], [ "b6a51c31bc156a4e" ], [ "d80df312f7fe1555" ], [ "5f1a9827d072380e" ] ] }, { "id": "94a6bb022db1c542", "type": "mqtt out", "z": "c89ef65ac7d40c72", "name": "", "topic": "ds/IAQ", "qos": "", "retain": "", "respTopic": "", "contentType": "", "userProps": "", "correl": "", "expiry": "", "broker": "98b7a230daa84efa", "x": 870, "y": 520, "wires": [] }, { "id": "c98a3c8d85c73adc", "type": "mqtt out", "z": "c89ef65ac7d40c72", "name": "", "topic": "ds/Pressure", "qos": "", "retain": "", "respTopic": "", "contentType": "", "userProps": "", "correl": "", "expiry": "", "broker": "98b7a230daa84efa", "x": 890, "y": 340, "wires": [] }, { "id": "91e2bdd8c8d76e8b", "type": "mqtt out", "z": "c89ef65ac7d40c72", "name": "", "topic": "ds/Gas_resistance", "qos": "", "retain": "", "respTopic": "", "contentType": "", "userProps": "", "correl": "", "expiry": "", "broker": "98b7a230daa84efa", "x": 910, "y": 460, "wires": [] }, { "id": "c4a169da17b7876c", "type": "mqtt out", "z": "c89ef65ac7d40c72", "name": "", "topic": "ds/Humidity", "qos": "", "retain": "", "respTopic": "", "contentType": "", "userProps": "", "correl": "", "expiry": "", "broker": "98b7a230daa84efa", "x": 890, "y": 400, "wires": [] }, { "id": "5517752c074d9597", "type": "mqtt out", "z": "c89ef65ac7d40c72", "name": "", "topic": "ds/Temperature/prop/color", "qos": "", "retain": "", "respTopic": "", "contentType": "", "userProps": "", "correl": "", "expiry": "", "broker": "98b7a230daa84efa", "x": 930, "y": 580, "wires": [] }, { "id": "bf26dc4a294ade9f", "type": "mqtt out", "z": "c89ef65ac7d40c72", "name": "", "topic": "ds/Pressure/prop/color", "qos": "", "retain": "", "respTopic": "", "contentType": "", "userProps": "", "correl": "", "expiry": "", "broker": "98b7a230daa84efa", "x": 920, "y": 640, "wires": [] }, { "id": "b6a51c31bc156a4e", "type": "mqtt out", "z": "c89ef65ac7d40c72", "name": "", "topic": "ds/Humidity/prop/color", "qos": "", "retain": "", "respTopic": "", "contentType": "", "userProps": "", "correl": "", "expiry": "", "broker": "98b7a230daa84efa", "x": 920, "y": 700, "wires": [] }, { "id": "d80df312f7fe1555", "type": "mqtt out", "z": "c89ef65ac7d40c72", "name": "", "topic": "ds/Gas_resistance/prop/color", "qos": "", "retain": "", "respTopic": "", "contentType": "", "userProps": "", "correl": "", "expiry": "", "broker": "98b7a230daa84efa", "x": 940, "y": 760, "wires": [] }, { "id": "5f1a9827d072380e", "type": "mqtt out", "z": "c89ef65ac7d40c72", "name": "", "topic": "ds/IAQ/prop/color", "qos": "", "retain": "", "respTopic": "", "contentType": "", "userProps": "", "correl": "", "expiry": "", "broker": "98b7a230daa84efa", "x": 910, "y": 820, "wires": [] }, { "id": "f37aae910013b59d", "type": "mqtt out", "z": "c89ef65ac7d40c72", "name": "", "topic": "ds/Air Quality Image", "qos": "", "retain": "", "respTopic": "", "contentType": "", "userProps": "", "correl": "", "expiry": "", "broker": "98b7a230daa84efa", "x": 920, "y": 160, "wires": [] }, { "id": "dc96a0aaada2e083", "type": "comment", "z": "c89ef65ac7d40c72", "name": "NCD Sensor Node", "info": "", "x": 290, "y": 240, "wires": [] }, { "id": "9cd0f749c7597204", "type": "comment", "z": "c89ef65ac7d40c72", "name": "Process data from sensor", "info": "", "x": 570, "y": 180, "wires": [] }, { "id": "9cb8e5de15c06f47", "type": "comment", "z": "c89ef65ac7d40c72", "name": "MQTT-OUT", "info": "", "x": 890, "y": 120, "wires": [] }, { "id": "1837cf9c692e99fb", "type": "ncd-wireless-node", "z": "c89ef65ac7d40c72", "name": "", "connection": "3a158777559a1790", "config_comm": "3a158777559a1790", "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", "cm_calibration": "60.6", "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": "", "acceleration_interrupt_threshold_84_active": "", "acceleration_interrupt_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, "x": 290, "y": 280, "wires": [ [ "e5d1d022d80dd449" ] ] }, { "id": "715dc7e746915c25", "type": "ncd-gateway-node", "z": "c89ef65ac7d40c72", "name": "", "connection": "3a158777559a1790", "unknown_devices": 0, "outputs": 1, "x": 270, "y": 140, "wires": [ [ "b59c4aa396a0893e", "6e561b2ad649185c" ] ] }, { "id": "05ebfd2730809ed4", "type": "comment", "z": "c89ef65ac7d40c72", "name": "NCD Gateway Node", "info": "", "x": 270, "y": 100, "wires": [] }, { "id": "b59c4aa396a0893e", "type": "debug", "z": "c89ef65ac7d40c72", "name": "Debug Gateway", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 600, "y": 140, "wires": [] }, { "id": "98b7a230daa84efa", "type": "mqtt-broker", "name": "Blynk.cloud", "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": "3a158777559a1790", "type": "ncd-gateway-config", "name": "", "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": "" } ]