Issue connecting Temp/Hum to Ubidots

Hello,

I have been having trouble connecting my Temp/Hum sensors to Ubidots, after following every resource I have been able to find on both the NCD and Ubidots website I am still unable to connect the sensors.

Below is the Node-Red flow that I have made to connect the sensors to Ubidots.

I think the problem may lie in the function node or possibly the switch.

Note: I have removed the authentication tokens but those are correct on my version. I have done tests to confirm that the setup of the Ubidots out node is correct.

[{“id”:“6916e621.e57ba8”,“type”:“tab”,“label”:“Flow 1”,“disabled”:false,“info”:“”},{“id”:“90fbf011.afe89”,“type”:“ubidots_out”,“z”:“6916e621.e57ba8”,“name”:“Body Fuel”,“token”:“”,“label_device”:“”,“device_label”:“bodyfuel”,“tier”:“business”,“tls_checkbox”:true,“x”:840,“y”:500,“wires”:[]},{“id”:“c8adab0c.863478”,“type”:“switch”,“z”:“6916e621.e57ba8”,“name”:“Sensor Output Control”,“property”:“payload.addr”,“propertyType”:“msg”,“rules”:[{“t”:“eq”,“v”:“00:13:a2:00:41:f3:a7:b7”,“vt”:“str”},{“t”:“eq”,“v”:“”,“vt”:“str”},{“t”:“eq”,“v”:“”,“vt”:“str”},{“t”:“eq”,“v”:“”,“vt”:“str”},{“t”:“eq”,“v”:“”,“vt”:“str”},{“t”:“eq”,“v”:“”,“vt”:“str”},{“t”:“eq”,“v”:“”,“vt”:“str”}],“checkall”:“true”,“repair”:false,“outputs”:7,“x”:460,“y”:280,“wires”:[[“9c99efe0.9053c”,“baf98e3b.b3abc”],[],[],[],[],[],[]]},{“id”:“98da0a02.8a5788”,“type”:“ncd-gateway-node”,“z”:“6916e621.e57ba8”,“name”:“”,“connection”:“837142ce.132b28”,“unknown_devices”:false,“outputs”:1,“x”:170,“y”:300,“wires”:[[“4825ef17.df1c2”,“6c271b99.fe4bf4”]]},{“id”:“4825ef17.df1c2”,“type”:“debug”,“z”:“6916e621.e57ba8”,“name”:“”,“active”:false,“tosidebar”:true,“console”:false,“tostatus”:false,“complete”:“payload”,“x”:430,“y”:180,“wires”:[]},{“id”:“2d13dd2.f96bf22”,“type”:“ncd-wireless-node”,“z”:“6916e621.e57ba8”,“name”:“Temp/Hum1”,“connection”:“837142ce.132b28”,“config_comm”:“837142ce.132b28”,“addr”:“00:13:a2:00:41:f3:a7:b7”,“sensor_type”:“1”,“auto_config”:false,“on_the_fly_enable”:“”,“node_id_delay_active”:true,“node_id”:0,“delay”:“60”,“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”:“0”,“impact_data_rate”:“4”,“impact_threshold”:25,“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,“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,“x”:130,“y”:140,“wires”:[[]]},{“id”:“9c99efe0.9053c”,“type”:“ui_gauge”,“z”:“6916e621.e57ba8”,“name”:“”,“group”:“e39490e1.d8282”,“order”:0,“width”:0,“height”:0,“gtype”:“gage”,“title”:“Temperature”,“label”:“Celcius”,“format”:“{{payload.sensor_data.temperature}}”,“min”:“-40”,“max”:“100”,“colors”:[“#00b500”,“#e6e600”,“#ca3838”],“seg1”:“”,“seg2”:“”,“x”:790,“y”:140,“wires”:[]},{“id”:“baf98e3b.b3abc”,“type”:“ui_gauge”,“z”:“6916e621.e57ba8”,“name”:“”,“group”:“e39490e1.d8282”,“order”:0,“width”:0,“height”:0,“gtype”:“gage”,“title”:“Humidity”,“label”:“Humidity”,“format”:“{{payload.sensor_data.humidity}}”,“min”:“0”,“max”:“100”,“colors”:[“#00b500”,“#e6e600”,“#ca3838”],“seg1”:“”,“seg2”:“”,“x”:780,“y”:180,“wires”:[]},{“id”:“7c77c2a1.ac325c”,“type”:“function”,“z”:“6916e621.e57ba8”,“name”:“Change level”,“func”:“// var newObj = {}; \n// newObj.payload = msg.payload;\n\n// //newObj.payload.ubidotsDeviceLabel = msg.payload.addr; \n\n// newObj.payload.temperature = msg.payload.sensor_data.temperature;\n// newObj.payload.humidity = msg.payload.sensor_data.humidity; \n\n// delete newObj.sensor_data;\n\n// return newObj;”,“outputs”:1,“noerr”:0,“x”:650,“y”:460,“wires”:[[“90fbf011.afe89”,“5d9cfcb5.4c7e94”]]},{“id”:“83badf22.4c66”,“type”:“switch”,“z”:“6916e621.e57ba8”,“name”:“Temp/Hum1”,“property”:“payload.addr”,“propertyType”:“msg”,“rules”:[{“t”:“eq”,“v”:“00:13:a2:00:41:f3:a7:b7”,“vt”:“str”}],“checkall”:“true”,“repair”:false,“outputs”:1,“x”:430,“y”:440,“wires”:[[]]},{“id”:“9a74037d.58cca”,“type”:“ubidots_out”,“z”:“6916e621.e57ba8”,“name”:“Temp/Hum1”,“token”:“”,“label_device”:“”,“device_label”:“Temp/Hum1”,“tier”:“business”,“tls_checkbox”:true,“x”:850,“y”:340,“wires”:[]},{“id”:“6c271b99.fe4bf4”,“type”:“switch”,“z”:“6916e621.e57ba8”,“name”:“”,“property”:“payload”,“propertyType”:“msg”,“rules”:[{“t”:“eq”,“v”:“”,“vt”:“str”}],“checkall”:“true”,“repair”:false,“outputs”:1,“x”:410,“y”:380,“wires”:[[“7c77c2a1.ac325c”]]},{“id”:“5d9cfcb5.4c7e94”,“type”:“debug”,“z”:“6916e621.e57ba8”,“name”:“”,“active”:true,“tosidebar”:true,“console”:false,“tostatus”:false,“complete”:“false”,“x”:840,“y”:600,“wires”:[]},{“id”:“837142ce.132b28”,“type”:“ncd-gateway-config”,“z”:“”,“name”:“”,“comm_type”:“tcp”,“ip_address”:“”,“tcp_port”:“2101”,“port”:“/dev/ttyS1”,“baudRate”:“115200”,“pan_id”:“7FFF”,“rssi”:true},{“id”:“e39490e1.d8282”,“type”:“ui_group”,“z”:“”,“name”:“Cooler”,“tab”:“4efc529b.b0387c”,“order”:1,“disp”:true,“width”:“6”,“collapse”:false},{“id”:“4efc529b.b0387c”,“type”:“ui_tab”,“z”:“”,“name”:“Body Fuel”,“icon”:“dashboard”,“order”:1,“disabled”:false,“hidden”:false}]

Hi,

I’m not able to import that flow to evaluate. Can you attempt exporting the flow again?

Or just explain further the error you are getting?

I took a look at it, the way the current flow is setup all of the code in the function node is commented out and the switch that is in place will only pass through messages with a blank payload.

Are you getting data in your debug pane from the msg.payload debug node?

It may be that the address of the sensor doesn’t match your other switch node.

You can add additional debugs after the switch node and function node to see if the messages are making it that far.

After adding Debug nodes after the Temp/Hum1 switch and adding that back to the flow then uncommenting the code in the function. Yes the data does make it past the function.

For some reason after adding these debug nodes I know see the sensor in ubidots although.

The humidity reading has gone through but the temperature reading has not.

Could that be a problem with the code in the function?

It’s possible, can you check the property name of your temperature data in the msg.payload node before the function?

This line in the function node needs to match it:
newObj.payload.temperature = msg.payload.sensor_data.temperature;

Particularly look and make sure that it is in the property sensor_data and then inside the property temperature. This is case sensitive as well.

If you can tell me the sensor_type of your sensor or copy over a payload from the debug directly after the wireless gateway I can take a look.

I found the problem with the temperature reading, it had to do with my Ubidots account. Thank you for the prompt assistance.