While learning the new OH3 HTTP Binding I have managed to pull some of the details across from my Epson XP-352 printer web UI and thought it might be of use to others.
I expect it would work for other Epson Expression printers. Feedback good or bad appricated. Enjoy
epson.things
Thing http:url:epson352 [
baseURL="http://X.X.X.X/PRESENTATION/HTML/TOP/PRTINFO.HTML",
refresh=300,
commandMethod="GET" ]
{
// Other local URLs that could be used for additional details
// http://X.X.X.X/PRESENTATION/ADVANCED/INFO_PRTINFO/TOP
// http://X.X.X.X/PRESENTATION/ADVANCED/INFO_NWINFO/TOP
Channels:
Type string : status [ mode = "READONLY", stateTransformation = "REGEX:.*PRTSCN_STATUS.+?ce\">(.*?)<\\/div>.*" ]
Type number : inkLevelC [ mode = "READONLY", stateTransformation = "REGEX:.*Ink_C.+?='(.*?)'.*" ]
Type number : inkLevelM [ mode = "READONLY", stateTransformation = "REGEX:.*Ink_M.+?='(.*?)'.*" ]
Type number : inkLevelY [ mode = "READONLY", stateTransformation = "REGEX:.*Ink_Y.+?='(.*?)'.*" ]
Type number : inkLevelK [ mode = "READONLY", stateTransformation = "REGEX:.*Ink_K.+?='(.*?)'.*" ]
Type string : deviceName [ mode = "READONLY", stateTransformation = "REGEX:.*Device Name.+?\">(.*?)<\\/td>.*" ]
Type string : connectionStatus [ mode = "READONLY", stateTransformation = "REGEX:.*Connection Status.+?\">(.*?)<\\/td>.*" ]
Type string : signalStrength [ mode = "READONLY", stateTransformation = "REGEX:.*Signal Strength.+?\">(.*?)<\\/td>.*" ]
Type string : macAddress [ mode = "READONLY", stateTransformation = "REGEX:.*MAC Address.+?\">(.*?)<\\/td>.*" ]
Type string : ipAddress [ mode = "READONLY", stateTransformation = "REGEX:.*IP Address.+?\">(.*?)<\\/td>.*" ]
// There is a lot more network information that could be scraped from the prtinfo.html page if requred.
}
epson.items
String Epson352Status "Status [%s]" <status> {channel="http:url:epson352:status", expire="301s,state=Offline"}
Number Epson352InkLevelC "Cyan Ink Level [%.0f/50]" <rgb> {channel="http:url:epson352:inkLevelC"}
Number Epson352InkLevelM "Magenta Ink Level [%.0f/50]" <rgb> {channel="http:url:epson352:inkLevelM"}
Number Epson352InkLevelY "Yellow Ink Level [%.0f/50]" <rgb> {channel="http:url:epson352:inkLevelY"}
Number Epson352InkLevelK "Black Ink Level [%.0f/50]" <rgb> {channel="http:url:epson352:inkLevelK"}
String Epson352DeviceName "Device name [%s]" <keyring> {channel="http:url:epson352:deviceName"}
String Epson352ConnectionStatus "Connection status [%s]" <network> {channel="http:url:epson352:connectionStatus", expire="301s,state=Offline"}
String Epson352SignalStrength "Signal Strength [%s]" <qualityofservice> {channel="http:url:epson352:signalStrength", expire="301s,state=Offline"}
String Epson352IpAddress "IP address [%s]" <network> {channel="http:url:epson352:ipAddress"}
String Epson352MacAddress "MAC address [%s]" <network> {channel="http:url:epson352:macAddress"}
DateTime Epson352LastUpdated "Last updated [%1$td/%1$tm/%1$ty %1$tH:%1$tM]" <time> {channel="http:url:epson352:status" [profile="timestamp-update"] }
.sitemap
Frame label="Printer" {
Default item=Epson352Status
Slider item=Epson352InkLevelC maxValue=50
Slider item=Epson352InkLevelM maxValue=50
Slider item=Epson352InkLevelY maxValue=50
Slider item=Epson352InkLevelK maxValue=50
Default item=Epson352DeviceName
Default item=Epson352ConnectionStatus
Default item=Epson352SignalStrength
Default item=Epson352IpAddress
Default item=Epson352MacAddress
Default item=Epson352LastUpdated
}