Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix parsing of UNDEF states from OpenHab -> JRule #45

Merged
merged 1 commit into from
Sep 7, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,9 @@ public JRuleUpDownValue getUpDownValue(String itemName) {
}

public JRulePlayPauseValue getPlayPauseValueFromState(State state) {
if (state instanceof UnDefType) {
return JRulePlayPauseValue.UNDEF;
}
final PlayPauseType playPauseType = PlayPauseType.valueOf(state.toFullString());
switch (playPauseType) {
case PLAY:
Expand All @@ -288,6 +291,9 @@ public JRulePlayPauseValue getPlayPauseValueFromState(State state) {
}

private JRuleOnOffValue getOnOffValueFromState(State state) {
if (state instanceof UnDefType) {
return JRuleOnOffValue.UNDEF;
}
OnOffType onOffType = OnOffType.from(state.toFullString());
switch (onOffType) {
case OFF:
Expand All @@ -301,6 +307,9 @@ private JRuleOnOffValue getOnOffValueFromState(State state) {
}

private JRuleOpenClosedValue getOpenClosedValueFromState(State state) {
if (state instanceof UnDefType) {
return JRuleOpenClosedValue.UNDEF;
}
OpenClosedType openClosedType = OpenClosedType.valueOf(state.toFullString());
switch (openClosedType) {
case OPEN:
Expand All @@ -314,6 +323,9 @@ private JRuleOpenClosedValue getOpenClosedValueFromState(State state) {
}

private JRuleUpDownValue getUpDownValueFromState(State state) {
if (state instanceof UnDefType) {
return JRuleUpDownValue.UNDEF;
}
final UpDownType playPauseType = UpDownType.valueOf(state.toFullString());
switch (playPauseType) {
case UP:
Expand Down