Skip to content

Suggestion - pass sensor id #2

Description

@juggledad

A suggestion, pass the sensor ID. You can do it very easily by editing 98-ds18b20.js and between the lines:
var msg = { payload: value }; node.send(msg);
add a new line so you have

                var msg = { payload: value };
                msg.sensorid = node.sensorid;
                node.send(msg);

Very simple case. Let's say you have multiple sensors and want to display the sensorid and the temperature in the debug log. Currently you would have the

ds18b20(sensor1) node->function (to add sensor1 ID to the payload)->debug

ds18b20(sensor2) node->function (to add sensor2  ID to the payload)->debug

if you pass the sensorid you could have

ds18b20(sensor1) node\
                       --->function (to add the ID to the payload)->debug
ds18b20(sensor2) node/

making the flow more compact and reusable.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions