Node-RED Decoder Encoder


Copyright Micropelt

Node-RED Decoder Encoder

Requirements:

  1. Node-RED

  2. base64 node should be installed

  3. This sample flow uses MQTT data from the Multitech MTCAP Gateway (Modify MQTT Broker and Topic as required).

Importing Flow and viewing Data

  1. Clone the following repository into your PC or download as a ZIP File

  1. The encoders and decoders are organized into three main folders, each representing the product line (MLR003R, MLRTPS and MLRTS). Inside each folder, you will find:

    1. Sample Node_RED flow in .json format

    2. Two JavaScript files for the Encoder and Decoder

  2. Import the JSON file into Node-RED

    1. Make sure to set the MQTT settings correspondingly in the MQTT IN and OUT Node

    2. Fill in the MQTT topic as required

    3. Enter the DEV EUI in the "Downlink Message" Inject node, to send Downlinks

  3. For Downlink JSON examples refer “Downlink Encoder Example” to section

Screenshots

import.png
Open Node-RED → Import
select_file.png
Select the .json file. Click ‘Import’
output.png
Viewing decoded messages

Downlink Encoder Example

// FPORT_1 { "userMode": "Ambient_Temperature", "safetyMode": "Ambient_Temperature", "setValue": 21, "roomTemperature": 20, "safetyValue": 19, "radioInterval": 5, "doReferenceRunNow": 0, "fPort": 1 } // FPORT 2 { "fPort": 2 } // FPORT 3 { "motor_operating_range": "1.456", "fPort": 3 } // FPORT 4 { "spreading_factor": "SF8", "fPort": 4 } // FPORT 5 { "opening_point_reset": false, "hot_water_availability": "ON" , "slow_harvesting": "DO_OPD_AND_SH", "max_flow_sensor_raw": 27, "fPort": 5 } // FPORT 6 { "tdd_action": "Close_to_0%_for_30_minutes", "tdd_beep": false, "tdd_period": 1, "fPort": 6 } // FPORT 7 { "kP": 20, "kI": 1.5, "kD": 21, "Closed_Percent": 32, "kD_when_closed": 14, "Offset_Percent": 42, "fPort": 7 } // FPORT 8 { "Flow_Raw_Value_Offset": 2.5, "fPort": 8 } // FPORT 9 { "External_temperature_sensor_expiry_minutes": 5. "fPort": 9 } // FPORT 10 { "Room_Temperature":22, "fPort": 10 } // FPORT 11 { "Beep":3, "fPort": 11 } // FPORT 15 { "device_will_operate_if_6_week_reference_run_fails": true, "do_recalibation_now": false, "turn_off_device": false, "fPort": 15 }

MLR003R Downlink Encoder Possible Fields and Values

FPORT 1

Fields

Possible Values

Description

Fields

Possible Values

Description

userMode

"Ambient_Temperature"

"Valve_Position"

 

setValue

0 to 40 for Ambient_Temperature

0 to 100 for Valve_Position

Set Point Value based on userMode

safetyMode

"Ambient_Temperature"

"Valve_Position"

 

safetyValue

0 to 40 for Ambient_Temperature

0 to 100 for Valve_Position

Safety Value based on safetyMode

roomTemperature

0 to 40

Room Temperature from External Sensor

radioInterval

5

10

60

120

480

Radio Communication Interval in Minutes

doReferenceRunNow

0 or 1

0 = No Reference Run

1 = Do Reference Run now

FPORT 2 Version

Fields

Possible Values

Description

Fields

Possible Values

Description

 

 

Sending an empty downlink to FPORT 2, will return the Version details

FPORT 3 Motor Travel Distance

Fields

Possible Values

Description

Fields

Possible Values

Description

motor_operating_range

"2.56048"

"0.624"

"0.832"

"1.040"

"1.248"

"1.456"

"1.664"

"1.872"

"2.080"

"2.288"

"2.496"

Motor operating range (in mm)

FPORT 4 LoRa Data Rate

Fields

Possible Values

Description

Fields

Possible Values

Description

spreading_factor

"SF7"

"SF8"

Change Spreading factor of device to SF7 or SF8

FPORT 5 Opening Point Detection and Slow Harvesting

Fields

Possible Values

Description

Fields

Possible Values

Description

opening_point_reset

true

false

If set to true, Device will set Opening Point Percent to Not Found.

hot_water_availability

"Use_time_of_year"

Use time of year to determine whether hot water is available. Request day/time from gateway.

"OFF"

Hot water is off

"ON"

Hot water is on

slow_harvesting

"DEFAULT"

Default Opening Point Detection and Slow Harvesting. Activation after 8 days of device continuously at 0%

"DO_OPD_AND_SH"

Do Opening Point Detection and

Slow Harvesting now

"DO_OPD_ONLY"

Do Opening Point Detection now.

Disable Slow Harvesting

"DISABLE_OPD_AND_SH"

Disable Opening Point Detection

Disable Slow Harvesting

max_flow_sensor_raw

0 to 33

Maximum Flow Sensor Raw Temperature

FPORT 6 Temperature Drop Detection

Fields

Possible Values

Description

Fields

Possible Values

Description

tdd_action

"No_Action"

Upon Detection of a Temperature Drop: Take No Action

"Close_to_0%_for_30_minutes"

close to 0% for 30 minutes and then resume normal operation

"Close_to_0%_for_60_minutes"

close to 0% for 60 minutes and then resume normal operation

tdd_beep

true

false

When set to true, Beep upon Resumption of Normal Operation

tdd_period

1

2

Activation of Temperature Drop Action after at least 1 or 2 consecutive temperature drops

FPORT 7 PID Temperature Controller

Fields

Possible Values

Description

Fields

Possible Values

Description

kP

0 to 255

P Coefficient

kI

0 to 5.1

I Coefficient

kD

0 to 51

D Coefficient

Closed_Percent

0 to 100

Minimum percent that device will close to

kD_when_closed

0 to 51

D Coefficient when closed

Offset_Percent

0 to 100

Percentage Offset to be added to PID Output

FPORT 8 Flow Sensor Offset

Fields

Possible Values

Description

Fields

Possible Values

Description

Flow_Raw_Value_Offset

-32.00 to 31.75

Flow Raw Value Offset to be added to the Flow Temperature estimation

FPORT 9 External Temperature Sensor Expiry

Fields

Possible Values

Description

Fields

Possible Values

Description

External_temperature_sensor_expiry_minutes

0 to 1275

External Temperature Sensor expiry.

(Enter in multiples of 5)

If a Room Temperature is sent by Downlink, continue using it until minutes specified in External_temperature_sensor_expiry_minutes field.

(Until a new room temperature is sent or device loses gateway communication)

 

FPORT 10 External Temperature

Fields

Possible Values

Description

Fields

Possible Values

Description

Room_Temperature

0 to 40

Room Temperature from External Sensor

FPORT 11 Beep

Fields

Possible Values

Description

Fields

Possible Values

Description

Beep

0 to 255

Instruct device to beep n times

FPORT 15 On/Off

Fields

Possible Values

Description

Fields

Possible Values

Description

device_will_operate_if_6_week_reference_run_fails

true

Device will stay on regardless of 6-week Reference Run results

false

If a 6-week Reference Run fails, device will switch off

do_recalibation_now

true

Do a Recalibration Now

false

Will not do a Recalibration

turn_off_device

true

Device will move to mounting position and switch OFF

false

Device will be in normal operation