0

I have an ESP32 that scans Bluetooth devices, and upload it to Firebase Realtime Database. Because it constantly uploads the information, I need to keep deleting old scanned devices. Tried to set the Rules on Firebase to delete devices older than 1 minute, but it didn't work.

The data upload in the following format:

`{
  "beacons": {
    "00:22:8c:f3:26:a2": {
      "3C:61:05:64:4F:14": {
        "rssi": -95,
        "time": 1682528088
      }
    }
  }
}`

I am trying to set the rules to delete the objects after 1 minute they were uploaded. Using the following rules, but it don't delete automatically:

`{
  "rules": {
    "beacons": {
  "$beaconId": {
        ".read": true,
        ".write": true,
        ".validate": true,
        "$deviceId": {
          ".validate": true,
          ".write": "data.child('time').val() > (now - 60000)",
          ".read": true
        }
      }
    }   
  }
}`

Tried setting the time to my timezone (-3), and also timezone 0, but it didn't work either.

  • 1
    Rules are not capable of deleting anything at all. The best they can do is stop a client from writing invalid data. You're going to need a different product to schedule the deletion of data. – Doug Stevenson Apr 26 '23 at 20:21

0 Answers0