Can I associate sensor value directly to arduino node device?

  • I searched the forums but can't seem to find this addressed anywhere.

    I am currently setting battery percentage by calling sendBatterlyLevel(), this sets a a variable BatteryLevel variable on my arduino node device on Vera Edge.
    I also created a sensor to set a voltage variable on a sensor device for this arduino node:

    • MyMessage voltageMsg(CHILD_ID_BATTERY, V_VOLTAGE);
    • ...
    • present(CHILD_ID_BATTERY, S_POWER);
    • ...
    • send(voltageMsg.set(setVoltage, 1)); //set voltage and how many decimals (1 in our case)

    This works fine but all I care about is voltage so would be nice if I could simply set a voltage variable on the arduino node device in vera and dispense and have one less sensor device (the S_POWER sensor device).

    If I assign a specific node id NODE_ID to my arduino node device could I do something like:

    • #define MY_NODE_ID 1
    • ...
    • MyMessage voltageMsg(MY_NODE_ID, V_VOLTAGE); or maybe MyMessage voltageMsg(MY_NODE_ID, V_VAR1);
    • ...
    • send(voltageMsg.set(12.1, 1)); //set voltage and how many decimals (1 in our case)

    FYI - the reason I want voltage in addition to battery percentage is to get something more specific AND because I've chosen to limit battery percentage range to vals corresponding to 0 - 12.5 volts (typical for my battery when NOT charging) while the voltages I see actually go well over that when my solar system is charging.


  • Mod

    What you've already done is the way to do it.

    If you have a temperature node and all you care about is temperature, you have a single child sensor with temperature.
    If you have a voltage node and all you care about is voltage you have a single child sensor with voltage.

  • Yeah, I realize that is preferred way but in this case, since battery percentage is already going to the arduino node device in vera, why not set voltage there as well?
    On the other hand, I realize I used the wrong sensor device type S_POWER when I should have used S_MULTIMETER. I will switch this and
    hopefully voltage will show up in the vera UI directly for that sensor device without having to drill down to view variables.

    Did more searching and found Push Data to Vera Node
    where @hek reveals one can use child id 255 for the arduino node so I may try this as well.

  • Mod

    sendBatteryLevel actually uses child id 255. You can see that if you look at the debug output from the node or the gateway. I am not sure how controllers handle getting other values than battery percentage on that child id though.

  • I verified a variable named Voltage DOES get created and is set on the Vera arduino node device if I create MyMessage with:

    • MyMessage voltageMsg(255, V_VOLTAGE);

    and send value with:

    • send(voltageMsg.set(12.1, 1));

Log in to reply

Suggested Topics

  • 7
  • 5
  • 30
  • 42
  • 4
  • 9
  • 2
  • 108