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> Signed-off-by: Ciprian Pascu <contact@ciprianpascu.ro>
This commit is contained in:
parent
867786cb8c
commit
75e6bb781f
@ -68,10 +68,16 @@ public class GPSTrackerTriggerSwitchProfile implements TriggerProfile {
|
||||
|
||||
@Override
|
||||
public void onTriggerFromHandler(String payload) {
|
||||
if (payload.startsWith(regionName)) {
|
||||
OnOffType state = OnOffType.from(payload.endsWith("enter"));
|
||||
if (!payload.contains("/")) {
|
||||
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);
|
||||
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