Skip to content

Commit

Permalink
Fix regionname
Browse files Browse the repository at this point in the history
Signed-off-by: Leo Siepel <leosiepel@gmail.com>
  • Loading branch information
lsiepel committed Nov 25, 2024
1 parent fe91fc7 commit 2e05825
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,13 @@ public void onStateUpdateFromItem(State state) {

@Override
public void onTriggerFromHandler(String payload) {
if (payload.startsWith(regionName)) {
OnOffType state = OnOffType.from(payload.endsWith("enter"));
if (!payload.contains("/")) {
logger.debug("Transition trigger {} caught mallformed payload, missing '\''", payload, regionName);
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);
}
Expand Down

0 comments on commit 2e05825

Please sign in to comment.