class DeviceLowBatteryGenerator extends AlertGenerator {

   @Override
   protected void handleModelChanged(SubsystemContext<PlaceMonitorSubsystemModel> context, Model model, AlertScratchPad scratchPad) {
      Map<String, Date> lowBatteries = context.model().getLowBatteryNotificationSent();

      // remove all previous alerts for which we now have no record of a low battery notification
      scratchPad.alerts(alert -> SmartHomeAlert.ALERTTYPE_DEV_WARN_BATTERY_LOW.equals(alert.getAlerttype()))
         .stream()
         .filter(alert -> !lowBatteries.containsKey(alert.getSubjectaddr()))
         .forEach(alert -> scratchPad.removeAlert(alert.getAlertkey()));

      lowBatteries.keySet().forEach(addr -> addAlert(context, scratchPad, addr));
   }

   @Inject public  DeviceLowBatteryGenerator(ProductCatalogManager prodCat);

}