[epsonprojector] Fix keycode channel to allow non-numeric characters (#9698)

* Fix keycode channel to allow non-numeric characters

Signed-off-by: Michael Lobstein <michael.lobstein@gmail.com>

* Add additional enum values

Signed-off-by: Michael Lobstein <michael.lobstein@gmail.com>
This commit is contained in:
mlobstein
2021-01-08 16:22:46 -06:00
committed by GitHub
parent 9368f44896
commit 8864566e18
7 changed files with 72 additions and 68 deletions

View File

@@ -31,7 +31,7 @@ public enum EpsonProjectorCommandType {
POWER("Power", SwitchItem.class),
POWER_STATE("PowerState", StringItem.class),
LAMP_TIME("LampTime", NumberItem.class),
KEY_CODE("KeyCode", NumberItem.class),
KEY_CODE("KeyCode", StringItem.class),
VKEYSTONE("VerticalKeystone", NumberItem.class),
HKEYSTONE("HorizontalKeystone", NumberItem.class),
AKEYSTONE("AutoKeystone", SwitchItem.class),

View File

@@ -232,8 +232,8 @@ public class EpsonProjectorDevice {
/*
* Key code
*/
public void sendKeyCode(int value) throws EpsonProjectorCommandException, EpsonProjectorException {
sendCommand(String.format("KEY %02X", value));
public void sendKeyCode(String value) throws EpsonProjectorCommandException, EpsonProjectorException {
sendCommand(String.format("KEY %s", value));
}
/*

View File

@@ -26,6 +26,7 @@ import org.eclipse.jdt.annotation.NonNullByDefault;
*/
@NonNullByDefault
public enum ColorMode {
AUTO(0x00),
SRGB(0x01),
NORMAL(0x02),
MEETING(0x03),

View File

@@ -32,6 +32,7 @@ public enum PowerStatus {
COOLDOWN(0x03),
STANDBYNETWORKON(0x04),
ABNORMALSTANDBY(0x05),
WIRELESSHDSTANDBY(0x07),
UNKNOWN(0xFF);
private final int value;

View File

@@ -351,7 +351,7 @@ public class EpsonProjectorHandler extends BaseThingHandler {
remoteController.setHorizontalReverse((command == OnOffType.ON ? Switch.ON : Switch.OFF));
break;
case KEY_CODE:
remoteController.sendKeyCode(((DecimalType) command).intValue());
remoteController.sendKeyCode(command.toString());
break;
case LAMP_TIME:
logger.warn("'{}' is read only parameter", commandType);

View File

@@ -130,7 +130,7 @@
<state readOnly="true" pattern="%d h"/>
</channel-type>
<channel-type id="keycode" advanced="true">
<item-type>Number</item-type>
<item-type>String</item-type>
<label>KeyCode</label>
<description>Send a KEY Operation Command to the Projector</description>
</channel-type>
@@ -271,6 +271,7 @@
<option value="SILVER">SILVER</option>
<option value="XVCOLOR">XVCOLOR</option>
<option value="DICOMSIM">DICOMSIM</option>
<option value="AUTO">AUTO</option>
</options>
</state>
</channel-type>