Firebase.DataChanged Query

Hello! Can anyone please help me how can I utilize properly this block with ".DataChanged"? I am considering to use it for a real-time monitoring but I only need to retrieve the value of a certain tag. Will this block be of use for that?

Thanks!

What have you tried ?

Things to know:

  1. DataChanged event will only fire if you have interacted with Firebase from the app in some way
  2. Set a condition (e.g. tag name) to capture only the tag value you want when dataChanged is returned

Screenshot 2023-02-05 193508

  1. The original intention was to read the data in Firebase sent by NodeMCU :slight_smile:
  2. In the picture (I hope I've done it right and was uploaded), those were the moves I have been figuring. I still cannot get only the value of MLOAD. Whenever the other tags changed their value, that's what the Label2 displays.

Use an if/else block....

if tag = MLOAD, then set Label = value

datachanged may not always work if data comes into firebase from other sources, YMMV

1 Like

Thanks, it worked! Yay :partying_face:

But what about this, I want to create a string composed of the values from MLOAD through MLVL_06?

It should go like this...
If I changed MLV_03 to 1, Label2 will display 0111600.
If MLVL_03 changed back to 0 and MLOAD and MLVL_04 changed to 1, Label2 will be 1110100

I couldn't find any vid on YT regarding this so your help would be greatly appreciated :smiley:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.