Re: Connecting a variable to a mysensors child
I’m trying the approach as mentioned in this thread obove.
I use this rule:
If $weerstation.Temperatuur gets updated then send custom "V_VAR1" nodeid: "100" sensorid: "1" cmdcode: "$weerstation.Temperatuur"
In the Display node (100) I have following receive function to fetch the message:
void receive(const MyMessage &message)
{
// Explore message
switch (message.sensor)
{
case 0: // Humidity sensor
{
lcd.setCursor(13, 1);
lcd.print(message.getFloat());
break;
}
case 1: // Temperature sensor
{
lcd.setCursor(13, 0);
lcd.print(message.getFloat());
break;
}
case 2: // Light sensor
{
lcd.setCursor(10, 3);
lcd.print(message.getUInt());
break;
}
case 3: // Barometer sensor
{
lcd.setCursor(10, 2);
lcd.print(message.getFloat());
break;
}
case 4: // Barometer Temperature sensor
{
break;
}
case 5: // Rain sensor
{
break;
}
}
}
this is working fine for case 1: temperature.
Where do I need the V_VAR1 for?
This method I would call a push mechanisme: controller is sending to node.
Is there also a pull mechanisme possible where I would like the node to request a value from the controller?