Skip to content

Instantly share code, notes, and snippets.

@thiseldo
thiseldo / gist:3eafef51ac8c4439870b
Created June 12, 2014 21:36
Example train signal data
Sample data logged from Networkrail train descriptor feed.
2 trains are shown, the columns show the from and to berths/Signals.
For example, C104 is the signal on platform 1 at Thatcham station.
DW = Down Westbury, i.e. route is heading from Reading to Westbury.
UW = Up Westbury, i.e. route is heading form Westbury to Reading.
Reading to Newbury, starting 06:13
Timestamp,Train,From,To
1402550357000,2K24,DW39,0800
@thiseldo
thiseldo / gist:7402637
Created November 10, 2013 19:25
A quick CurrentCost to Node-RED function to read each channel and split out to topic/payload. Next node could be to publish to a mqtt topic that has already been defined in this node.
var result = msg.payload;
try {
msg.topic="ccost/" + result.msg.sensor;
msg.payload = (result.msg.ch1[0].watts[0])*1;
return msg;
} catch( e )
{
// console.log("Looks like history data");
}
return null;