Is it possible to get notified when a device comes online?

Hello, we have a device that is offline and i’d like to get notified when it comes back online. It was actually stolen.

Hello @mgoldbach actually we do not provide notifications, however you can share your details on the roadmap issue, vote it and real ideas from other balena users to see if that might work for you.

Let us know how you solve this!

Hi,

One thing you could consider is to set up a script with the balena-cli that checks whether it comes online.

Something like

#!/bin/bash
UUID=<device uuid>

prev_online=false
while true; do
  # get value of IS ONLINE
  dev_online=$(balena device ${UUID} | grep "IS ONLINE" | awk '{print $3}')
  if [[ ${dev_online} == true && ${prev} == false ]]; then
    # changed from offline to online, send a notification
    sendmail ...
  fi

  prev_online=${dev_online}
  # Some delay
  sleep 10
done
1 Like