been ‘inspecting’ the html page of the above cartridge-status page, but it seems there’s no mentioning of any percentages. Might that explain the output-less outcome of the above scripts?
Does anyone of you see any percentages in the epson driver page at all? I only have these cartridge icons, and no reference in the underlying code…
Cheers,
Marius
tarbax
February 27, 2018, 12:38pm
22
can’t get this to working on my XP-900 and i have an extra PBK cartridge.
can anyone help me ?
Hello,
could some of you help me to get this running for my WF-5690?
Following is my html (https://192.168.0.101/PRESENTATION/ADVANCED/INFO_PRTINFO/TOP ):
Thanks in advance
Edit: curl -k (ignore selfsigned cert) solved my problem
@rpitera Thanks for the great icons! Could you also create one for the ink waste container?
Icon in WebGui:
Thanks in advance
cheese
August 6, 2018, 11:03am
25
i’ve editet @rpitera graphic to this one for my interface. hope it helps
2 Likes
hi community,
trying to get this right for once, I can’t use any of the posted curl commands, or better, they wont give any useful feedback.
I have a wf 5710 printer, and the page is on https://192.168.1.42/PRESENTATION/HTML/TOP/PRTINFO.HTML
If i insect that page this is the result, I can see all cartridges with a ‘height’ which I take it is the ink level?
please help me creating the correct curl command, cause i really dont understand what awk -f does or the rest of the lines that follow that command…
—edit----
yess!! getting there:
had to use this:
sensor:
- platform: command_line
name: Epson ink level Black
command: /usr/bin/curl -k https://192.168.1.42/PRESENTATION/HTML/TOP/PRTINFO.HTML | awk -F"'" '/Ink_K.PNG/ && $6+0 == $6 { printf "%.0f\n", $6 / 50 * 100 }'
unit_of_measurement: '%'
scan_interval: 14400
created binary_sensors, to be able to use the slider in an automation:
binary_sensor:
- platform: template
sensors:
ink_level_black_threshold:
friendly_name: 'Ink level black threshold'
value_template: >
{{(states('sensor.epson_ink_level_black') | float) <
(states('input_number.ink_level') | float)}}
automation:
- alias: 'Printer Ink Alert'
trigger:
platform: state
entity_id:
- binary_sensor.ink_level_black_threshold
- binary_sensor.ink_level_magenta_threshold
- binary_sensor.ink_level_yellow_threshold
- binary_sensor.ink_level_cyan_threshold
- binary_sensor.ink_level_waste_threshold
to: 'on'
condition:
condition: template
value_template: >
{{ is_state('input_boolean.notify_system', 'on')}}
action:
- service: notify.notify
data_template:
title: 'Low ink'
message: >
{% set color = trigger.entity_id[24:-10] %}
{{ trigger.to_state.attributes.friendly_name }} is low at
{{states('sensor.epson_ink_level_' + color)}}
- condition: template
value_template: >
{{ is_state('input_boolean.persistent_notification_create', 'on')}}
- service: persistent_notification.create
data_template:
title: 'Low ink'
message: >
{{ trigger.to_state.attributes.friendly_name }} is low
notification_id: low-printer-ink-level-alert
customized the sensors to show a red_flag icon:
homeassistant:
customize:
sensor.epson_ink_level_black:
templates:
entity_picture: >
if (state > entities['input_number.ink_level'].state ) return '/local/devices/epson/ink_k.png';
return '/local/devices/epson/ink_k_alert.png';
have fun!
legoracers
(Daan Tholenaars)
October 12, 2018, 10:25pm
29
How do I set these icons in lovelace? using the png as icon does not give me an error but it show up blank.
you can set .png files as entity_picture (either in known_devices, in templates when using template sensors, or by using customize.
Icons are only useable with the mdi: icons
cjsimmons
(Chris Simmons)
December 29, 2018, 1:13am
31
Just came across this. Thanks for the icons. I have a HP printer and was needing some nice icons for the ink, and I should be able to adapt some of this for my printer.
tarbax
December 30, 2018, 3:43pm
33
how do i fix this for my black and photo black ?
printer epson XP-900
home assistant:
the numbers of the black and photo black are behind eachother.
Hi @tarbax , I don’t own an Epson XP-900 so what I’m going to suggest has not been tested. It seems that black and photo black information cannot be properly split because Ink_K.PNG appears twice so I would suggest to modify the command a little bit: using head and tail commands. What about this?
/usr/bin/curl -k https://myprintersipadress/PRESENTATION/HTML/TOP/PRTINFO.HTML | grep Ink_K.PNG | head -1 | awk -F"’" ‘/Ink_K.PNG/ && $6+0 == $6 { printf “%.0f\n”, $6 / 50 * 100 }’
and this?
/usr/bin/curl -k https://myprintersipadress/PRESENTATION/HTML/TOP/PRTINFO.HTML | grep Ink_K.PNG | tail -1 | awk -F"’" ‘/Ink_K.PNG/ && $6+0 == $6 { printf “%.0f\n”, $6 / 50 * 100 }’
Good luck!
tarbax
December 30, 2018, 10:56pm
35
Thanks! i just tested and i get unknown state.
Wow, quick reply! I had to edit my post twice because, although I cannont test, I knew it wasn’t going to run with my two first replies. Have you tried my last edit?
tarbax
December 30, 2018, 11:01pm
37
yes i tried the latest version.
Can you paste the output of this?
/usr/bin/curl -k https://myprintersipadress/PRESENTATION/HTML/TOP/PRTINFO.HTML
so I can play a little bit with it in my computer.
Not an expert but willing to help
1 Like
tarbax
December 30, 2018, 11:09pm
39
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN "
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Author" content="SEIKO EPSON">
<meta name="viewport" content="width=device-width, user-scalable=yes, initial-scale=1.0">
<meta name="format-detection" content="telephone=no">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<script type="text/javascript"><!--
var current = new Date();
document.write("<link rel='stylesheet' type='text/css' href='../../STYLE/SMT.CSS&tm=" + current.getTime() + "' media='only screen and (max-device-width:800px)'>");
document.write("<link rel='stylesheet' type='text/css' href='../../STYLE/PC.CSS&tm=" + current.getTime() + "' media='only screen and (min-device-width:801px)'>");
document.write("<!--[if IE ]>" +"<link rel='stylesheet' type='text/css' href='../../STYLE/PC.CSS&tm=" + current.getTime() + "'>" +"<![endif]-->");
// --></script>
<noscript>
<link rel='stylesheet' type='text/css' href='../../STYLE/SMT.CSS' media='only screen and (max-device-width:800px)'>
<link rel='stylesheet' type='text/css' href='../../STYLE/PC.CSS' media='only screen and (min-device-width:801px)'>
<!--[if IE ]>
<link rel='stylesheet' type='text/css' href='../../STYLE/PC.CSS'>
<![endif]-->
</noscript>
<title>XP-900 Series</title>
<script type="text/javascript" src="../../SCRIPT/MENT.JS"></script>
</head>
<body onload="(function(){setTimeout(function(){if(window.pageYOffset==0){window.scrollTo(0,1);}},100);})()" onunload="(function(){})()">
<div class="wrap">
<div class="header">
<h1 class="font-size-14em">
<img class="logo" src='../../IMAGE/EPSONLOGO.PNG' width='83' height='21' alt="EPSON">
<img class="separatpr" src='../../IMAGE/SEPARATOR.PNG' width='2' height='58' alt="">
<span class="separatpr"></span>
<span class="header">XP-900 Series</span>
</h1>
</div>
<div class="section">
<h2><img class="link-title" src='../../IMAGE/PRTINFO_ILL.PNG' width='48' height='48' alt="">Productstatus</h2>
<table class="navi"><tr>
<td id="tab-item-main" class="tab-item-main-on-sprtwfd" onclick="info_main_sprtwfd()">Basis</td>
<td id="tab-item-network" class="tab-item-network-off-sprtwfd" onclick="info_network_sprtwfd()">Netwerk</td>
<td id="tab-item-wfd" class="tab-item-wfd-off" onclick="info_wfd()">Wi-Fi Direct</td>
</tr></table>
<div id="info-main">
<div class="information-first">
<form method='get' name='form_select_language' action='./PRTINFO.HTML'>
<select class="list-full text" name='SEL_LANGB' onchange='return document.form_select_language.submit();'>
<option value='1' >English</option>
<option value='2' >Français</option>
<option value='4' >Deutsch</option>
<option value='3' >Italiano</option>
<option value='5' >Español</option>
<option value='6' >Português</option>
<option value='7' selected>Nederlands</option>
<option value='12' >Norsk</option>
<option value='13' >Svenska</option>
<option value='14' >Suomi</option>
<option value='15' >polski</option>
<option value='16' >Čeština</option>
<option value='17' >Magyar</option>
<option value='18' >Dansk</option>
<option value='20' >Ελληνικά</option>
<option value='21' >Slovensky</option>
<option value='22' >Română</option>
</select>
</form>
</div>
<div class="information">
<fieldset id="PRTSCN_STATUS" class="information-first clearfix"><legend class="key">Printerstatus</legend>
<ul class='clearfix'><li><div class="preserve-white-space">Beschikbaar.</div></li></ul></fieldset>
<div id="ELSE_STATUS"><fieldset class="information-last clearfix"><legend class="key">Andere status</legend>
<ul class='clearfix'><li><noscript><div>Schakel JavaScript in de browser in.</div></noscript></li>
</ul></fieldset></div>
</div>
<script type="text/javascript">
<!--$N
HideElseStatus();
//-->$N
</script>
<div class="information-last clearfix">
<ul class="inksection">
<li class='tank'>
<div class='tank'>
<img class='color' src='../../IMAGE/Ink_K.PNG' height='34' style=''>
</div>
<div class='clrname'>BK</div>
</li><!--
--><li class='tank'>
<div class='tank'>
<img class='color' src='../../IMAGE/Ink_C.PNG' height='43' style=''>
</div>
<div class='clrname'>C</div>
</li><!--
--><li class='tank'>
<div class='tank'>
<img class='color' src='../../IMAGE/Ink_Y.PNG' height='43' style=''>
</div>
<div class='clrname'>Y</div>
</li><!--
--><li class='tank'>
<div class='tank'>
<img class='color' src='../../IMAGE/Ink_M.PNG' height='48' style=''>
</div>
<div class='clrname'>M</div>
</li><!--
--><li class='tank'>
<div class='tank'>
<img class='color' src='../../IMAGE/Ink_K.PNG' height='38' style=''>
</div>
<div class='clrname'>PBK</div>
</li>
</ul>
</div>
</div>
<div id="info-network">
<table style="border-collapse: collapse; width: 100%;">
<tr class="item clearfix"><td class="item-key"><bdi>Apparaatnaam</bdi>&nbsp;:</td><td class="item-value">EPSON0B85F7</td></tr>
<tr class="item clearfix"><td class="item-key"><bdi>Verbindingsstatus</bdi>&nbsp;:</td><td class="item-value">Wi-Fi-72Mbps</td></tr>
<tr class="item clearfix"><td class="item-key"><bdi>Signaalsterkte</bdi>&nbsp;:</td><td class="item-value">Uitstekend</td></tr>
<tr class="item clearfix"><td class="item-key"><bdi>IP-adres opvragen</bdi>&nbsp;:</td><td class="item-value">Automatisch</td></tr>
<tr class="item clearfix"><td class="item-key"><bdi>IP-adres</bdi>&nbsp;:</td><td class="item-value">192.168.1.131</td></tr>
<tr class="item clearfix"><td class="item-key"><bdi>Subnetmasker</bdi>&nbsp;:</td><td class="item-value">255.255.255.0</td></tr>
<tr class="item clearfix"><td class="item-key"><bdi>Standaardgateway</bdi>&nbsp;:</td><td class="item-value">192.168.1.1</td></tr>
<tr class="item clearfix"><td class="item-key"><bdi>Instelling DNS-server</bdi>&nbsp;:</td><td class="item-value">Automatisch</td></tr>
<tr class="item clearfix"><td class="item-key"><bdi>Primaire DNS-server</bdi>&nbsp;:</td><td class="item-value">1.1.1.1</td></tr>
<tr class="item clearfix"><td class="item-key"><bdi>Secundaire DNS-server</bdi>&nbsp;:</td><td class="item-value">&nbsp;</td></tr>
<tr class="item clearfix"><td class="item-key"><bdi>Proxyserver</bdi>&nbsp;:</td><td class="item-value">Niet gebruiken
</td></tr>
<tr class="item clearfix"><td class="item-key"><bdi>Wi-Fi instellen</bdi>&nbsp;:</td><td class="item-value">Handmatig</td></tr>
<tr class="item clearfix"><td class="item-key"><bdi>SSID</bdi>&nbsp;:</td><td class="item-value">Black_Ubiquiti_2.4Ghz</td></tr>
<tr class="item clearfix"><td class="item-key"><bdi>Beveiligingsniveau</bdi>&nbsp;:</td><td class="item-value">WPA2-PSK (AES)</td></tr>
<tr class="item clearfix"><td class="item-key"><bdi>Wachtwoord</bdi>&nbsp;:</td><td class="item-value">**********</td></tr>
<tr class="item clearfix"><td class="item-key"><bdi>Bestandsdeling</bdi>&nbsp;:</td><td class="item-value">Inschakelen</td></tr>
<tr class="item clearfix"><td class="item-key"><bdi>Modus voor bestandsdeling</bdi>&nbsp;:</td><td class="item-value">Alleen lezen</td></tr>
<tr class="item-last clearfix"><td class="item-key"><bdi>MAC-adres</bdi>&nbsp;:</td><td class="item-value">9C:AE:D3:0B:85:F7</td></tr>
</table>
</div>
<div id="info-wfd">
<table style="border-collapse: collapse; width: 100%;">
<tr class="item clearfix"><td class="item-key"><bdi>Apparaatnaam</bdi>&nbsp;:</td><td class="item-value">EPSON0B85F7</td></tr>
<tr class="item clearfix"><td class="item-key"><bdi>Verbindingsmethode</bdi>&nbsp;:</td><td class="item-value">Niet ingesteld</td></tr>
</table>
</div>
</div>
<ul class="with-padding clearfix">
<li id="button-latest" class="list"><a class="button" href="javascript:void(0)" onclick="javascript:update(); return false;">Vernieuwen</a></li>
<noscript><li class="list"><a class="button" href="./PRTINFO.HTML">Vernieuwen</a></li></noscript>
<li class="list-last"><a class="button" href="./INDEX.html">Hoofdmenu</a></li>
</ul>
<ul>
<a class="license" target="_blank" href="/PRESENTATION/ADVANCED/LICENSE/TOP">Softwarelicenties</a>
</ul>
</div>
<script type="text/javascript">
<!--
initialize();
//-->
</script>
</body>
Ok, so I do:
$ cat kk.txt | awk -F"'" '/Ink_K.PNG/ && $6+0 == $6 { printf "%.0f\n", $6 / 50 * 100 }'
and get:
68
76
So I would try to put head and tail at the end:
command: /usr/bin/curl -k https://myprintersipadress/PRESENTATION/HTML/TOP/PRTINFO.HTML | awk -F"’" ‘/Ink_K.PNG/ && $6+0 == $6 { printf “%.0f\n”, $6 / 50 * 100 }’ | head -1
and:
command: /usr/bin/curl -k https://myprintersipadress/PRESENTATION/HTML/TOP/PRTINFO.HTML | awk -F"’" ‘/Ink_K.PNG/ && $6+0 == $6 { printf “%.0f\n”, $6 / 50 * 100 }’ | tail -1
Good luck!
1 Like