mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +01:00
[gpstracker] Fix handling ambigious region names (#17805)
* Fix regionname * Fix SAT * Improve log line Signed-off-by: Leo Siepel <leosiepel@gmail.com>
This commit is contained in:
parent
5a27b0e752
commit
d0ea14f441
@ -68,10 +68,16 @@ public class GPSTrackerTriggerSwitchProfile implements TriggerProfile {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTriggerFromHandler(String payload) {
|
public void onTriggerFromHandler(String payload) {
|
||||||
if (payload.startsWith(regionName)) {
|
if (!payload.contains("/")) {
|
||||||
OnOffType state = OnOffType.from(payload.endsWith("enter"));
|
logger.debug("Transition trigger with mallformed payload: '{}', missing '\''", payload);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String[] splitted = payload.split("/");
|
||||||
|
if (splitted[0].equals(regionName)) {
|
||||||
|
OnOffType state = OnOffType.from("enter".equals(splitted[1]));
|
||||||
callback.sendCommand(state);
|
callback.sendCommand(state);
|
||||||
logger.debug("Transition trigger {} handled for region {} by profile: {}", payload, regionName, state);
|
logger.debug("Transition trigger with payload: '{}' handled for region {} by profile: {}", payload,
|
||||||
|
regionName, state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user