mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +01:00
Change status channel from hash map values to state description options. (#11739)
Signed-off-by: Stewart Cossey <stewart.cossey@gmail.com>
This commit is contained in:
parent
1d65e10bba
commit
dc11890f32
@ -65,7 +65,7 @@ public class HPProductUsageFeatures {
|
||||
final String inkName = currInk.getElementsByTagName("dd:MarkerColor").item(0).getTextContent();
|
||||
final String consumeType = currInk.getElementsByTagName("dd:ConsumableTypeEnum").item(0).getTextContent();
|
||||
|
||||
if (consumeType.equalsIgnoreCase("printhead")) {
|
||||
if ("printhead".equalsIgnoreCase(consumeType)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -12,9 +12,6 @@
|
||||
*/
|
||||
package org.openhab.binding.hpprinter.internal.api;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
import org.w3c.dom.Document;
|
||||
@ -30,8 +27,6 @@ import org.w3c.dom.NodeList;
|
||||
public class HPStatus {
|
||||
public static final String ENDPOINT = "/DevMgmt/ProductStatusDyn.xml";
|
||||
|
||||
private static final Map<String, String> STATUS_MESSAGES = initializeStatus();
|
||||
|
||||
private final String printerStatus;
|
||||
private final boolean trayEmptyOrOpen;
|
||||
|
||||
@ -44,7 +39,7 @@ public class HPStatus {
|
||||
Element element = (Element) nodes.item(i);
|
||||
String statusCategory = element.getElementsByTagName("pscat:StatusCategory").item(0).getTextContent();
|
||||
if (!"genuineHP".equals(statusCategory) && !"trayEmpty".equals(statusCategory)) {
|
||||
localPrinterStatus = STATUS_MESSAGES.getOrDefault(statusCategory, statusCategory);
|
||||
localPrinterStatus = statusCategory;
|
||||
}
|
||||
if ("trayEmpty".equals(statusCategory)) {
|
||||
localTrayEmptyOrOpen = true;
|
||||
@ -54,20 +49,6 @@ public class HPStatus {
|
||||
printerStatus = localPrinterStatus;
|
||||
}
|
||||
|
||||
private static Map<String, String> initializeStatus() {
|
||||
Map<String, String> statusMap = new HashMap<>();
|
||||
|
||||
statusMap.put("processing", "Printing...");
|
||||
statusMap.put("scanProcessing", "Scanning...");
|
||||
statusMap.put("inPowerSave", "Power Save");
|
||||
statusMap.put("ready", "Idle");
|
||||
statusMap.put("initializing", "Initializing...");
|
||||
statusMap.put("closeDoorOrCover", "Door/Cover Open");
|
||||
statusMap.put("inkSystemInitializing", "Loading Ink...");
|
||||
statusMap.put("shuttingDown", "Shutting Down...");
|
||||
return statusMap;
|
||||
}
|
||||
|
||||
public boolean getTrayEmptyOrOpen() {
|
||||
return trayEmptyOrOpen;
|
||||
}
|
||||
|
@ -35,7 +35,19 @@
|
||||
<item-type>String</item-type>
|
||||
<label>Status</label>
|
||||
<description>Printer Status</description>
|
||||
<state readOnly="true"/>
|
||||
<state readOnly="true">
|
||||
<options>
|
||||
<option value="ready">Idle</option>
|
||||
<option value="processing">Printing</option>
|
||||
<option value="scanProcessing">Scanning</option>
|
||||
<option value="inPowerSave">Power Save</option>
|
||||
<option value="initializing">Initializing</option>
|
||||
<option value="closeDoorOrCover">Door/Cover</option>
|
||||
<option value="inkSystemInitializing">Loading Ink</option>
|
||||
<option value="shuttingDown">Shutting Down</option>
|
||||
<option value="replaceCartridgeOut">Cartridge Depleted</option>
|
||||
</options>
|
||||
</state>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="readonlyswitch" advanced="true">
|
||||
|
Loading…
Reference in New Issue
Block a user