Epson WF-3540 ink level monitoring

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

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):

image

Thanks in advance

Edit: curl -k (ignore selfsigned cert) solved my problem :slight_smile:

@rpitera Thanks for the great icons! Could you also create one for the ink waste container?

Icon in WebGui: image

Thanks in advance

patrone

i’ve editet @rpitera graphic to this one for my interface. hope it helps

2 Likes

Thank you!

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!

HI
edited @cheese’ s and @rpitera’s images to all transparent, with and without flags

to show up as nicely without the white background, in the frontend:

48

here they are if you can use them:

ink_c
ink_k
ink_m
ink_c_alert
patrone
ink_waste_alert
ink_m_alert
ink_k_alert
ink_y_alert
ink_y

4 Likes

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

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.

thought I’d post the relevant cartridge icons for my new WF printer:

ink_c ink_k ink_m ink_waste ink_y

48

1 Like

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!

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?

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 :slight_smile:

1 Like
&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN "

"http://www.w3.org/TR/html4/strict.dtd"&gt;

&lt;html&gt;

&lt;head&gt;

&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&gt;

&lt;meta name="Author" content="SEIKO EPSON"&gt;

&lt;meta name="viewport" content="width=device-width, user-scalable=yes, initial-scale=1.0"&gt;

&lt;meta name="format-detection" content="telephone=no"&gt;

&lt;meta http-equiv="X-UA-Compatible" content="IE=edge"&gt;

&lt;script type="text/javascript"&gt;&lt;!--

var current = new Date();

document.write("&lt;link rel='stylesheet' type='text/css' href='../../STYLE/SMT.CSS&amp;tm=" + current.getTime() + "' media='only screen and (max-device-width:800px)'&gt;");

document.write("&lt;link rel='stylesheet' type='text/css' href='../../STYLE/PC.CSS&amp;tm=" + current.getTime() + "' media='only screen and (min-device-width:801px)'&gt;");

document.write("&lt;!--[if IE ]&gt;" +"&lt;link rel='stylesheet' type='text/css' href='../../STYLE/PC.CSS&amp;tm=" + current.getTime() + "'&gt;" +"&lt;![endif]--&gt;");

// --&gt;&lt;/script&gt;

&lt;noscript&gt;

&lt;link rel='stylesheet' type='text/css' href='../../STYLE/SMT.CSS' media='only screen and (max-device-width:800px)'&gt;

&lt;link rel='stylesheet' type='text/css' href='../../STYLE/PC.CSS' media='only screen and (min-device-width:801px)'&gt;

&lt;!--[if IE ]&gt;

&lt;link rel='stylesheet' type='text/css' href='../../STYLE/PC.CSS'&gt;

&lt;![endif]--&gt;

&lt;/noscript&gt;

&lt;title&gt;XP-900 Series&lt;/title&gt;

&lt;script type="text/javascript" src="../../SCRIPT/MENT.JS"&gt;&lt;/script&gt;

&lt;/head&gt;

&lt;body onload="(function(){setTimeout(function(){if(window.pageYOffset==0){window.scrollTo(0,1);}},100);})()" onunload="(function(){})()"&gt;

&lt;div class="wrap"&gt;

&lt;div class="header"&gt;

&lt;h1 class="font-size-14em"&gt;

&lt;img class="logo" src='../../IMAGE/EPSONLOGO.PNG' width='83' height='21' alt="EPSON"&gt;

&lt;img class="separatpr" src='../../IMAGE/SEPARATOR.PNG' width='2' height='58' alt=""&gt;

&lt;span class="separatpr"&gt;&lt;/span&gt;

&lt;span class="header"&gt;XP-900 Series&lt;/span&gt;

&lt;/h1&gt;

&lt;/div&gt;

&lt;div class="section"&gt;

&lt;h2&gt;&lt;img class="link-title" src='../../IMAGE/PRTINFO_ILL.PNG' width='48' height='48' alt=""&gt;Productstatus&lt;/h2&gt;

&lt;table class="navi"&gt;&lt;tr&gt;

&lt;td id="tab-item-main" class="tab-item-main-on-sprtwfd" onclick="info_main_sprtwfd()"&gt;Basis&lt;/td&gt;

&lt;td id="tab-item-network" class="tab-item-network-off-sprtwfd" onclick="info_network_sprtwfd()"&gt;Netwerk&lt;/td&gt;

&lt;td id="tab-item-wfd" class="tab-item-wfd-off" onclick="info_wfd()"&gt;Wi-Fi Direct&lt;/td&gt;

&lt;/tr&gt;&lt;/table&gt;

&lt;div id="info-main"&gt;

&lt;div class="information-first"&gt;

&lt;form method='get' name='form_select_language' action='./PRTINFO.HTML'&gt;

&lt;select class="list-full text" name='SEL_LANGB' onchange='return document.form_select_language.submit();'&gt;

&lt;option value='1' &gt;English&lt;/option&gt;

&lt;option value='2' &gt;Français&lt;/option&gt;

&lt;option value='4' &gt;Deutsch&lt;/option&gt;

&lt;option value='3' &gt;Italiano&lt;/option&gt;

&lt;option value='5' &gt;Español&lt;/option&gt;

&lt;option value='6' &gt;Português&lt;/option&gt;

&lt;option value='7' selected&gt;Nederlands&lt;/option&gt;

&lt;option value='12' &gt;Norsk&lt;/option&gt;

&lt;option value='13' &gt;Svenska&lt;/option&gt;

&lt;option value='14' &gt;Suomi&lt;/option&gt;

&lt;option value='15' &gt;polski&lt;/option&gt;

&lt;option value='16' &gt;Čeština&lt;/option&gt;

&lt;option value='17' &gt;Magyar&lt;/option&gt;

&lt;option value='18' &gt;Dansk&lt;/option&gt;

&lt;option value='20' &gt;Ελληνικά&lt;/option&gt;

&lt;option value='21' &gt;Slovensky&lt;/option&gt;

&lt;option value='22' &gt;Română&lt;/option&gt;

&lt;/select&gt;

&lt;/form&gt;

&lt;/div&gt;

&lt;div class="information"&gt;

&lt;fieldset id="PRTSCN_STATUS" class="information-first clearfix"&gt;&lt;legend class="key"&gt;Printerstatus&lt;/legend&gt;

&lt;ul class='clearfix'&gt;&lt;li&gt;&lt;div class="preserve-white-space"&gt;Beschikbaar.&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/fieldset&gt;

&lt;div id="ELSE_STATUS"&gt;&lt;fieldset class="information-last clearfix"&gt;&lt;legend class="key"&gt;Andere status&lt;/legend&gt;

&lt;ul class='clearfix'&gt;&lt;li&gt;&lt;noscript&gt;&lt;div&gt;Schakel JavaScript in de browser in.&lt;/div&gt;&lt;/noscript&gt;&lt;/li&gt;

&lt;/ul&gt;&lt;/fieldset&gt;&lt;/div&gt;

&lt;/div&gt;

&lt;script type="text/javascript"&gt;

&lt;!--$N

HideElseStatus();

//--&gt;$N

&lt;/script&gt;

&lt;div class="information-last clearfix"&gt;

&lt;ul class="inksection"&gt;

&lt;li class='tank'&gt;

&lt;div class='tank'&gt;

&lt;img class='color' src='../../IMAGE/Ink_K.PNG' height='34' style=''&gt;

&lt;/div&gt;

&lt;div class='clrname'&gt;BK&lt;/div&gt;

&lt;/li&gt;&lt;!--

--&gt;&lt;li class='tank'&gt;

&lt;div class='tank'&gt;

&lt;img class='color' src='../../IMAGE/Ink_C.PNG' height='43' style=''&gt;

&lt;/div&gt;

&lt;div class='clrname'&gt;C&lt;/div&gt;

&lt;/li&gt;&lt;!--

--&gt;&lt;li class='tank'&gt;

&lt;div class='tank'&gt;

&lt;img class='color' src='../../IMAGE/Ink_Y.PNG' height='43' style=''&gt;

&lt;/div&gt;

&lt;div class='clrname'&gt;Y&lt;/div&gt;

&lt;/li&gt;&lt;!--

--&gt;&lt;li class='tank'&gt;

&lt;div class='tank'&gt;

&lt;img class='color' src='../../IMAGE/Ink_M.PNG' height='48' style=''&gt;

&lt;/div&gt;

&lt;div class='clrname'&gt;M&lt;/div&gt;

&lt;/li&gt;&lt;!--

--&gt;&lt;li class='tank'&gt;

&lt;div class='tank'&gt;

&lt;img class='color' src='../../IMAGE/Ink_K.PNG' height='38' style=''&gt;

&lt;/div&gt;

&lt;div class='clrname'&gt;PBK&lt;/div&gt;

&lt;/li&gt;

&lt;/ul&gt;

&lt;/div&gt;

&lt;/div&gt;

&lt;div id="info-network"&gt;

&lt;table style="border-collapse: collapse; width: 100%;"&gt;

&lt;tr class="item clearfix"&gt;&lt;td class="item-key"&gt;&lt;bdi&gt;Apparaatnaam&lt;/bdi&gt;&amp;nbsp;:&lt;/td&gt;&lt;td class="item-value"&gt;EPSON0B85F7&lt;/td&gt;&lt;/tr&gt;

&lt;tr class="item clearfix"&gt;&lt;td class="item-key"&gt;&lt;bdi&gt;Verbindingsstatus&lt;/bdi&gt;&amp;nbsp;:&lt;/td&gt;&lt;td class="item-value"&gt;Wi-Fi-72Mbps&lt;/td&gt;&lt;/tr&gt;

&lt;tr class="item clearfix"&gt;&lt;td class="item-key"&gt;&lt;bdi&gt;Signaalsterkte&lt;/bdi&gt;&amp;nbsp;:&lt;/td&gt;&lt;td class="item-value"&gt;Uitstekend&lt;/td&gt;&lt;/tr&gt;

&lt;tr class="item clearfix"&gt;&lt;td class="item-key"&gt;&lt;bdi&gt;IP-adres opvragen&lt;/bdi&gt;&amp;nbsp;:&lt;/td&gt;&lt;td class="item-value"&gt;Automatisch&lt;/td&gt;&lt;/tr&gt;

&lt;tr class="item clearfix"&gt;&lt;td class="item-key"&gt;&lt;bdi&gt;IP-adres&lt;/bdi&gt;&amp;nbsp;:&lt;/td&gt;&lt;td class="item-value"&gt;192.168.1.131&lt;/td&gt;&lt;/tr&gt;

&lt;tr class="item clearfix"&gt;&lt;td class="item-key"&gt;&lt;bdi&gt;Subnetmasker&lt;/bdi&gt;&amp;nbsp;:&lt;/td&gt;&lt;td class="item-value"&gt;255.255.255.0&lt;/td&gt;&lt;/tr&gt;

&lt;tr class="item clearfix"&gt;&lt;td class="item-key"&gt;&lt;bdi&gt;Standaardgateway&lt;/bdi&gt;&amp;nbsp;:&lt;/td&gt;&lt;td class="item-value"&gt;192.168.1.1&lt;/td&gt;&lt;/tr&gt;

&lt;tr class="item clearfix"&gt;&lt;td class="item-key"&gt;&lt;bdi&gt;Instelling DNS-server&lt;/bdi&gt;&amp;nbsp;:&lt;/td&gt;&lt;td class="item-value"&gt;Automatisch&lt;/td&gt;&lt;/tr&gt;

&lt;tr class="item clearfix"&gt;&lt;td class="item-key"&gt;&lt;bdi&gt;Primaire DNS-server&lt;/bdi&gt;&amp;nbsp;:&lt;/td&gt;&lt;td class="item-value"&gt;1.1.1.1&lt;/td&gt;&lt;/tr&gt;

&lt;tr class="item clearfix"&gt;&lt;td class="item-key"&gt;&lt;bdi&gt;Secundaire DNS-server&lt;/bdi&gt;&amp;nbsp;:&lt;/td&gt;&lt;td class="item-value"&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;

&lt;tr class="item clearfix"&gt;&lt;td class="item-key"&gt;&lt;bdi&gt;Proxyserver&lt;/bdi&gt;&amp;nbsp;:&lt;/td&gt;&lt;td class="item-value"&gt;Niet gebruiken

&lt;/td&gt;&lt;/tr&gt;

&lt;tr class="item clearfix"&gt;&lt;td class="item-key"&gt;&lt;bdi&gt;Wi-Fi instellen&lt;/bdi&gt;&amp;nbsp;:&lt;/td&gt;&lt;td class="item-value"&gt;Handmatig&lt;/td&gt;&lt;/tr&gt;

&lt;tr class="item clearfix"&gt;&lt;td class="item-key"&gt;&lt;bdi&gt;SSID&lt;/bdi&gt;&amp;nbsp;:&lt;/td&gt;&lt;td class="item-value"&gt;Black_Ubiquiti_2.4Ghz&lt;/td&gt;&lt;/tr&gt;

&lt;tr class="item clearfix"&gt;&lt;td class="item-key"&gt;&lt;bdi&gt;Beveiligingsniveau&lt;/bdi&gt;&amp;nbsp;:&lt;/td&gt;&lt;td class="item-value"&gt;WPA2-PSK (AES)&lt;/td&gt;&lt;/tr&gt;

&lt;tr class="item clearfix"&gt;&lt;td class="item-key"&gt;&lt;bdi&gt;Wachtwoord&lt;/bdi&gt;&amp;nbsp;:&lt;/td&gt;&lt;td class="item-value"&gt;**********&lt;/td&gt;&lt;/tr&gt;

&lt;tr class="item clearfix"&gt;&lt;td class="item-key"&gt;&lt;bdi&gt;Bestandsdeling&lt;/bdi&gt;&amp;nbsp;:&lt;/td&gt;&lt;td class="item-value"&gt;Inschakelen&lt;/td&gt;&lt;/tr&gt;

&lt;tr class="item clearfix"&gt;&lt;td class="item-key"&gt;&lt;bdi&gt;Modus voor bestandsdeling&lt;/bdi&gt;&amp;nbsp;:&lt;/td&gt;&lt;td class="item-value"&gt;Alleen lezen&lt;/td&gt;&lt;/tr&gt;

&lt;tr class="item-last clearfix"&gt;&lt;td class="item-key"&gt;&lt;bdi&gt;MAC-adres&lt;/bdi&gt;&amp;nbsp;:&lt;/td&gt;&lt;td class="item-value"&gt;9C:AE:D3:0B:85:F7&lt;/td&gt;&lt;/tr&gt;

&lt;/table&gt;

&lt;/div&gt;

&lt;div id="info-wfd"&gt;

&lt;table style="border-collapse: collapse; width: 100%;"&gt;

&lt;tr class="item clearfix"&gt;&lt;td class="item-key"&gt;&lt;bdi&gt;Apparaatnaam&lt;/bdi&gt;&amp;nbsp;:&lt;/td&gt;&lt;td class="item-value"&gt;EPSON0B85F7&lt;/td&gt;&lt;/tr&gt;

&lt;tr class="item clearfix"&gt;&lt;td class="item-key"&gt;&lt;bdi&gt;Verbindingsmethode&lt;/bdi&gt;&amp;nbsp;:&lt;/td&gt;&lt;td class="item-value"&gt;Niet ingesteld&lt;/td&gt;&lt;/tr&gt;

&lt;/table&gt;

&lt;/div&gt;

&lt;/div&gt;

&lt;ul class="with-padding clearfix"&gt;

&lt;li id="button-latest" class="list"&gt;&lt;a class="button" href="javascript:void(0)" onclick="javascript:update(); return false;"&gt;Vernieuwen&lt;/a&gt;&lt;/li&gt;

&lt;noscript&gt;&lt;li class="list"&gt;&lt;a class="button" href="./PRTINFO.HTML"&gt;Vernieuwen&lt;/a&gt;&lt;/li&gt;&lt;/noscript&gt;

&lt;li class="list-last"&gt;&lt;a class="button" href="./INDEX.html"&gt;Hoofdmenu&lt;/a&gt;&lt;/li&gt;

&lt;/ul&gt;

&lt;ul&gt;

&lt;a class="license" target="_blank" href="/PRESENTATION/ADVANCED/LICENSE/TOP"&gt;Softwarelicenties&lt;/a&gt;

&lt;/ul&gt;

&lt;/div&gt;

&lt;script type="text/javascript"&gt;

&lt;!--

initialize();

//--&gt;

&lt;/script&gt;

&lt;/body&gt;

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