wifi trigger, memorize most recent ssid

This commit is contained in:
jens 2022-05-07 02:06:17 +02:00
parent 62c97832a9
commit d5ce04f80b
2 changed files with 5 additions and 4 deletions

View File

@ -40,8 +40,9 @@ public class WifiBroadcastReceiver extends BroadcastReceiver
{ {
if(newWifiSsid.startsWith("\"") && newWifiSsid.endsWith("\"")) if(newWifiSsid.startsWith("\"") && newWifiSsid.endsWith("\""))
newWifiSsid = newWifiSsid.substring(1, newWifiSsid.length()-1); newWifiSsid = newWifiSsid.substring(1, newWifiSsid.length()-1);
WifiBroadcastReceiver.lastWifiSsid = newWifiSsid; if(newWifiSsid.length() > 0)
WifiBroadcastReceiver.lastWifiSsid = newWifiSsid;
} }
public static boolean isWifiListenerActive() public static boolean isWifiListenerActive()

View File

@ -52,7 +52,7 @@ public class DateTimeListener extends BroadcastReceiver implements AutomationLis
Miscellaneous.logEvent("i", "AlarmListener", "Alarm received", 2); Miscellaneous.logEvent("i", "AlarmListener", "Alarm received", 2);
ArrayList<Rule> allRulesWithNowInTimeFrame = Rule.findRuleCandidates(Trigger_Enum.timeFrame); ArrayList<Rule> allRulesWithNowInTimeFrame = Rule.findRuleCandidates(Trigger_Enum.timeFrame);
for(int i=0; i<allRulesWithNowInTimeFrame.size(); i++) for(int i=0; i < allRulesWithNowInTimeFrame.size(); i++)
{ {
if(allRulesWithNowInTimeFrame.get(i).getsGreenLight(context)) if(allRulesWithNowInTimeFrame.get(i).getsGreenLight(context))
allRulesWithNowInTimeFrame.get(i).activate(automationServiceRef, false); allRulesWithNowInTimeFrame.get(i).activate(automationServiceRef, false);
@ -139,7 +139,7 @@ public class DateTimeListener extends BroadcastReceiver implements AutomationLis
} }
i++; i++;
i=(int)System.currentTimeMillis(); i = (int)System.currentTimeMillis();
sdf.format(calSetWorkingCopy.getTime()); sdf.format(calSetWorkingCopy.getTime());
String.valueOf(i); String.valueOf(i);