Skip to content

Commit

Permalink
closes #11
Browse files Browse the repository at this point in the history
  • Loading branch information
nibi79 committed Apr 11, 2020
1 parent 0b8d2fd commit 2b37461
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ Currently following **Channels** are supported on the **Worx Landroid Mower**:
|------------|-----------|-----------|-----------|
| online | `Switch` | common#online | |
| lastUpdateOnlineStatus | `DateTime` | common#lastUpdateOnlineStatus | |
| poll | `Switch` | common#poll | |
| action | `String` | common#action | START, STOP, HOME |
| lock | `Switch` | common#lock | |

Expand Down Expand Up @@ -264,6 +265,7 @@ Bridge worxlandroid:worxlandroidBridge:MyWorxBridge "MyWorx Bridge" [ webapiUser
```
String LandroidAction "Action" <movecontrol> {channel="worxlandroid:mower:MyWorxBridge:MySerialNumber:common#action"}
String LandroidLastUpdate "Last Update Data [%s]" <calendar> {channel="worxlandroid:mower:MyWorxBridge:MySerialNumber:cfgCommon#lastUpdate"}
Switch LandroidPoll "Poll" <flowpipe> {channel="worxlandroid:mower:MyWorxBridge:MySerialNumber:common#poll"}
Switch LandroidLock "Lock" <lock> {channel="worxlandroid:mower:MyWorxBridge:MySerialNumber:common#lock"}
//
Expand Down Expand Up @@ -370,6 +372,7 @@ sitemap landroid label="Landroid"
Switch item=LandroidAction label="Action" mappings=[START="Start"] visibility=[LandroidStatusDescription=="Home"]
Switch item=LandroidAction label="Action" mappings=[START="Start",STOP="Stop",HOME="Home"] visibility=[LandroidStatusDescription!="Home"]
Text item=LandroidLastUpdate
Switch item=LandroidPoll label="Refresh" mappings=[ON="Poll"]
Switch item=LandroidLock label="Lock" mappings=[ON="LOCK",OFF="UNLOCK"]
}
Frame {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ public class WorxLandroidBindingConstants {
// common
public static final String CHANNELNAME_ONLINE = "common#online";
public static final String CHANNELNAME_LAST_UPDATE_ONLINE_STATUS = "common#lastUpdateOnlineStatus";
public static final String CHANNEL_ACTION = "common#action";
public static final String CHANNELNAME_POLL = "common#poll";
public static final String CHANNELNAME_ACTION = "common#action";
public static final String CHANNELNAME_LOCK = "common#lock";

// cfgCommon
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -425,12 +425,18 @@ public void handleCommand(ChannelUID channelUID, Command command) {
switch (channelUID.getId()) {

// start action
case CHANNEL_ACTION:
case CHANNELNAME_ACTION:
WorxLandroidActionCodes actionCode = WorxLandroidActionCodes.valueOf(command.toString());
logger.debug("{}", actionCode.toString());
cmd = String.format("{\"cmd\":%s}", actionCode.getCode());
break;

// poll
case CHANNELNAME_POLL:
cmd = AWSMessage.EMPTY_PAYLOAD;
updateState(CHANNELNAME_POLL, OnOffType.OFF);
break;

// update rainDelay
case CHANNELNAME_RAIN_DELAY:
cmd = String.format("{\"rd\":%s}", command);
Expand Down
8 changes: 8 additions & 0 deletions src/main/resources/ESH-INF/thing/mower.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
<channels>
<channel id="online" typeId="chOnline" />
<channel id="lastUpdateOnlineStatus" typeId="chLastUpdateOnlineStatus" />
<channel id="poll" typeId="chPoll" />
<channel id="action" typeId="chAction" />
<channel id="lock" typeId="chLock" />
</channels>
Expand Down Expand Up @@ -516,4 +517,11 @@
<label>Lock mower</label>
<description>Lock or unlock your mower.</description>
</channel-type>

<channel-type id="chPoll">
<item-type>Switch</item-type>
<label>Poll Worx AWS</label>
<description>Poll Worx AWS</description>
</channel-type>

</thing:thing-descriptions>

0 comments on commit 2b37461

Please sign in to comment.