NEWS
[Vorlage] Script und VIS: Druckerpatronen Zustand
-
Da sind viele Skripte eingebunden. Du müsstest schon die Inhalte Skripte hier posten. Bitte spoiler-Tag, aber mindestens Code-Tags für Code-Postings im Forum nutzen.
-
Hallo,
ich habe mal mein erstes Skript vom ersten Post als Adapter hier veröffentlicht. Es ist speziell für den EPSON STYLUS PHOTO PX830. Aus Mangel an anderen Geräten kann ich nicht sagen, ob der Adapter auch bei anderen Druckern funktioniert und auch keinen Adapter für einen anderen Drucker schreiben. Aber vielleicht hat noch jemand genau so ein Teil und kann es gebrauchen.
https://github.com/Pix–-/ioBroker.epson_stylus_px830
Ein Satz von Widgets findet sich in der Readme.
Wer will, kann den Adapter natürlich für seine Zwecke anpassen
Gruß
Pix
-
Da ich aber keinen Epson Drucker habe sondern HP, habe ich mich hingesetzt und das Ganze für HP angepasst. `
Hallo, ich versuche auch werte vom meinem HP DeskJet 3630 ins vis zubringen (das ist ein 2 Cartridge Drucker). Mit dem CMY Patrone hat es funktioniert, aber Schwarze Tinte bekommt keine werte.
Miene Einstellungen
! ````
var druckerIP = '192.168.2.58'; // Drucker IP
var druckermod = "HP3630"; // Drucker Modell - Strukturelement in den Variablen
var TinteID = "302SETUP"; // Tinte - Tintenbezeichnung
var TinteCMYBez = "CMY"; // Bezeichnung fuer Magenta, Yellow, Cyan
var TinteKBez = "K"; // Bezeichnung fuer BlackMein XML >! ```` >! <ccdyn:consumableconfigdyn xmlns:dd="http://www.hp.com/schemas/imaging/con/dictionaries/1.0/" xmlns:dd2="http://www.hp.com/schemas/imaging/con/dictionaries/2008/10/10" xmlns:ccdyn="http://www.hp.com/schemas/imaging/con/ledm/consumableconfigdyn/2007/11/19" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemalocation="http://www.hp.com/schemas/imaging/con/ledm/consumableconfigdyn/2007/11/19 ../schemas/ConsumableConfigDyn.xsd http://www.hp.com/schemas/imaging/con/dictionaries/1.0/ ../schemas/dd/DataDictionaryMasterLEDM.xsd"><dd:version><dd:revision>SVN-IPG-LEDM.290</dd:revision> <dd:date>2010-06-02</dd:date></dd:version> <ccdyn:productconsumableinfo><dd:numofuserreplaceableconsumables>2</dd:numofuserreplaceableconsumables> <dd:numofnonuserreplaceableconsumables>0</dd:numofnonuserreplaceableconsumables> <dd:alignmentmode>semiAutomatic</dd:alignmentmode> <ccdyn:cartridgechipinfo>disabled</ccdyn:cartridgechipinfo> <dd:consumableslotdirection>leftToRight</dd:consumableslotdirection> <dd:ik>40</dd:ik> <ccdyn:singlecartridgemode>enabled</ccdyn:singlecartridgemode> <dd:antitheftmode>disabled</dd:antitheftmode> <ccdyn:markingagentsubscriptionlevel>0</ccdyn:markingagentsubscriptionlevel> <ccdyn:rewardsregistrationstatus><dd:optedin>false</dd:optedin> <dd:autosenddata>false</dd:autosenddata> <dd:promptautosenddata>false</dd:promptautosenddata></ccdyn:rewardsregistrationstatus></ccdyn:productconsumableinfo> <ccdyn:consumableinfo><dd:capacity><dd:maxcapacity>0</dd:maxcapacity> <dd:unit>tenthsOfMilliliters</dd:unit></dd:capacity> <dd:consumableacceptibilitysubbrand>allDevices</dd:consumableacceptibilitysubbrand> <dd:consumableacceptibilitysegmentclass>setup</dd:consumableacceptibilitysegmentclass> <dd:consumableacceptibilityupgradability>notSupported</dd:consumableacceptibilityupgradability> <dd:consumablecontenttype>markingAgent</dd:consumablecontenttype> <dd:consumablefamilyname>TIJ2</dd:consumablefamilyname> <dd2:consumableid>...</dd2:consumableid> <dd:consumablekeyingdescriptor>small</dd:consumablekeyingdescriptor> <dd:consumablelabelcode>CMY</dd:consumablelabelcode> <dd:consumablelifestate><dd:consumablestate>newGenuineHP</dd:consumablestate> <dd:measuredquantitystate>ok</dd:measuredquantitystate> <dd:brand>HP</dd:brand> <dd:consumablestateaction>acknowledge</dd:consumablestateaction> <dd:isrefilled>false</dd:isrefilled> <dd:issetup>false</dd:issetup> <dd:issubscription>false</dd:issubscription> <dd:istrial>false</dd:istrial></dd:consumablelifestate> <dd:consumablelevelmessagingstyle>Eureka</dd:consumablelevelmessagingstyle> <dd:consumablelowusealgorithm>standard</dd:consumablelowusealgorithm> <dd:consumablepercentagelevelremaining>90</dd:consumablepercentagelevelremaining> <dd:consumablereplaceabilitytype>userReplaceable</dd:consumablereplaceabilitytype> <dd:consumableselectibilitynumber>302SETUP</dd:consumableselectibilitynumber> <dd:consumablestation>0</dd:consumablestation> <dd:consumabletypeenum>inkCartridge</dd:consumabletypeenum> <dd:regionalcartridge><dd:regionidentifier>4</dd:regionidentifier></dd:regionalcartridge> <dd:consumableicon><dd:shape>CMYTriDots</dd:shape> <dd:rotation>rotateZero</dd:rotation> <dd:fillcolor><dd:red>255</dd:red> <dd:green>255</dd:green> <dd:blue>255</dd:blue></dd:fillcolor> <dd:outlinecolor><dd:red>255</dd:red> <dd:green>255</dd:green> <dd:blue>255</dd:blue></dd:outlinecolor> <dd:backgroundcolor><dd:red>255</dd:red> <dd:green>255</dd:green> <dd:blue>255</dd:blue></dd:backgroundcolor></dd:consumableicon> <ccdyn:consumableuniqueid>000000000000001ac3e20985133b9142</ccdyn:consumableuniqueid></ccdyn:consumableinfo> <ccdyn:consumableinfo><dd:capacity><dd:maxcapacity>0</dd:maxcapacity> <dd:unit>tenthsOfMilliliters</dd:unit></dd:capacity> <dd:consumableacceptibilitysubbrand>allDevices</dd:consumableacceptibilitysubbrand> <dd:consumableacceptibilitysegmentclass>setup</dd:consumableacceptibilitysegmentclass> <dd:consumableacceptibilityupgradability>notSupported</dd:consumableacceptibilityupgradability> <dd:consumablecontenttype>markingAgent</dd:consumablecontenttype> <dd:consumablefamilyname>TIJ2</dd:consumablefamilyname> <dd2:consumableid>...</dd2:consumableid> <dd:consumablekeyingdescriptor>small</dd:consumablekeyingdescriptor> <dd:consumablelabelcode>K</dd:consumablelabelcode> <dd:consumablelifestate><dd:consumablestate>newGenuineHP</dd:consumablestate> <dd:measuredquantitystate>ok</dd:measuredquantitystate> <dd:brand>HP</dd:brand> <dd:consumablestateaction>acknowledge</dd:consumablestateaction> <dd:isrefilled>false</dd:isrefilled> <dd:issetup>false</dd:issetup> <dd:issubscription>false</dd:issubscription> <dd:istrial>false</dd:istrial></dd:consumablelifestate> <dd:consumablelevelmessagingstyle>Eureka</dd:consumablelevelmessagingstyle> <dd:consumablelowusealgorithm>standard</dd:consumablelowusealgorithm> <dd:consumablepercentagelevelremaining>80</dd:consumablepercentagelevelremaining> <dd:consumablereplaceabilitytype>userReplaceable</dd:consumablereplaceabilitytype> <dd:consumableselectibilitynumber>302SETUP</dd:consumableselectibilitynumber> <dd:consumablestation>1</dd:consumablestation> <dd:consumabletypeenum>inkCartridge</dd:consumabletypeenum> <dd:regionalcartridge><dd:regionidentifier>4</dd:regionidentifier></dd:regionalcartridge> <dd:consumableicon><dd:shape>Circle</dd:shape> <dd:rotation>rotateZero</dd:rotation> <dd:fillcolor><dd:red>0</dd:red> <dd:green>0</dd:green> <dd:blue>0</dd:blue></dd:fillcolor> <dd:outlinecolor><dd:red>0</dd:red> <dd:green>0</dd:green> <dd:blue>0</dd:blue></dd:outlinecolor> <dd:backgroundcolor><dd:red>255</dd:red> <dd:green>255</dd:green> <dd:blue>255</dd:blue></dd:backgroundcolor></dd:consumableicon> <ccdyn:consumableuniqueid>00000000000000b9013fc49cfb3b9111</ccdyn:consumableuniqueid></ccdyn:consumableinfo></ccdyn:consumableconfigdyn>
Log
! ````
javascript-0 2016-06-27 06:29:00.243 info script.js.HP3630: farbe2 K
javascript-0 2016-06-27 06:29:00.243 info script.js.HP3630: 1Level CMY gefunden Level ist 90
javascript-0 2016-06-27 06:29:00.062 info script.js.HP3630: schedule gestartet
javascript-0 2016-06-27 06:28:00.269 info script.js.HP3630: farbe2 K
javascript-0 2016-06-27 06:28:00.268 info script.js.HP3630: 1Level CMY gefunden Level ist 90
javascript-0 2016-06-27 06:28:00.075 info script.js.HP3630: schedule gestartet
javascript-0 2016-06-27 06:27:00.287 info script.js.HP3630: farbe2 K
javascript-0 2016-06-27 06:27:00.269 info script.js.HP3630: 1Level CMY gefunden Level ist 90
javascript-0 2016-06-27 06:27:00.082 info script.js.HP3630: schedule gestartet
javascript-0 2016-06-27 06:26:00.266 info script.js.HP3630: farbe2 K
javascript-0 2016-06-27 06:26:00.265 info script.js.HP3630: 1Level CMY gefunden Level ist 90
javascript-0 2016-06-27 06:26:00.071 info script.js.HP3630: schedule gestartet
javascript-0 2016-06-27 06:25:00.601 info script.js.HP3630: farbe2 K
javascript-0 2016-06-27 06:25:00.600 info script.js.HP3630: 1Level CMY gefunden Level ist 90 -
Hi, eigentlich sollte es funktionieren, es kann aber sein, dass ich einen Fehler eingebaut habe, da ich selber einen 4-cartridge Drucker habe.
Ich kann es mir leider erst am WE ansehen
VG looxer
Gesendet von meinem SM-G935F mit Tapatalk
-
Hi, eigentlich sollte es funktionieren, es kann aber sein, dass ich einen Fehler eingebaut habe, da ich selber einen 4-cartridge Drucker habe. `
Konnte das Problem selbst lösen..
` > // Farbe nummer 2
eins_position = body.indexOf(cut1, eins_lastpos) + cut1.length + 1 ;
color = body.substring(eins_position, eins_position+3) ;
zwei_position = body.indexOf(cut2,zwei_lastpos)+ cut2.length + 1;
level_string = body.substring(zwei_position, zwei_position+2) ;
log('farbe2 ' + body.substring(eins_position, eins_position+3),"info"); `
Die zwei Rot markierte "3"-er, habe ich auf "1" geändert
Und.. es hat funktioniert!
` > javascript-0 2016-06-28 11:21:00.715 info script.js.HP3630: 2Level K gefunden Level ist 80javascript-0 2016-06-28 11:21:00.715 info script.js.HP3630: farbe2 K
javascript-0 2016-06-28 11:21:00.714 info script.js.HP3630: 1Level CMY gefunden Level ist 90 `
Überflüssige log für "script.js.HP3630: farbe2 K" Auskommentiert
` > 11:31:00.299 [info] javascript.0 script.js.HP3630: 1Level CMY gefunden Level ist 90
11:31:00.300 [info] javascript.0 script.js.HP3630: 2Level K gefunden Level ist 80 `
Danke!
-
hallo
wollte das Script für meinen WF-7620 umbauen aber scheitere schon am Request Aufruf. Das Problem ist das der Drucker nur per HTTPS angesprochen werden kann. Hat da jemand eine Idee ?
-
Habe noch einen weiteren Fehler beim 4-Catridge Code entdeckt. Und zwar schlägt der nur dann nieder, wenn der Füllstand 100% ist.
Mit der Zeile
level_string = body.substring(zwei_position, zwei_position+2);
holst du die nächsten 2 Zeichen als Teilstring. Im Fall von 100% sind das aber 3 Zeichen, deshalb kommt hier fälschlicherweise 10% raus.
Ich habe das bei mir wie folgt geändert:
level_string = body.substring(zwei_position, body.indexOf('
Damit suche ich nach dem End-Tag und bekomme die komplette Zahl!
Der Schönheit halber, kann man den Suchstring auch als Variable am Anfang des Skripts anzeigen.
Hier der komplette Code:
! ````
// bringt den Druckertintenstand von WEB enabled HP Tintenstrahler in ioBroker
// Basierend auf CCU2 Script fuer HP Drucker http://homematic-forum.de/forum/viewtop ... 31&t=25140
// und dem angepassten Script von PiX aus iobroker http://forum.iobroker.de/viewtopic.php? ... c289#p6931
// Author : looxer01 - 22.12.2015
// 2016-06-18, jtraxler: Angepasst an HP8620
// 2016-11-01, jtraxler: Bugfix 100% Level
! // hier Drucker parameter einstellen - vor dem ersten Speichern des Scripts
var druckerIP = "10.0.0.43";
var druckerURL = "http://" + druckerIP + "/DevMgmt/ConsumableConfigDyn.xml";
! var druckermod = "8620";
var TinteID = "951XL";
! var request = require('request');
var cut1 = "dd:ConsumableLabelCode";
var cut2 = "dd:ConsumablePercentageLevelRemaining";
var TagEndMarker = ' -
Das Problem ist das der Drucker nur per HTTPS angesprochen werden kann. Hat da jemand eine Idee ? `
Noch ein Hinweis für dich: Schau dir mal die "request-ssl" Library an (https://www.npmjs.com/package/request-ssl)! -
Liebe Community,
nach reichlich suchen und probieren habe ich es als iobroke-newbie geschafft.
Dank all den guten Tipps hier im Threat.
Gern teile ich meinen View und das Script für einen HP Laserjet Pro MFP M276n:
View:
!
{ "settings": { "style": { "background-clip": "border-box", "background-color": "#f8f2f2", "background_class": "", "background": "" }, "theme": "redmond", "sizex": "", "sizey": "", "gridSize": "", "snapType": null }, "widgets": { "e00001": { "tpl": "tplJustgageJustGage", "data": { "g_fixed": false, "g_visibility": false, "g_css_font_text": false, "g_css_background": false, "g_css_shadow_padding": false, "g_css_border": false, "g_gestures": false, "g_signals": false, "visibility-cond": "==", "visibility-val": 1, "visibility-groups-action": "hide", "is_tdp": "false", "factor": "1", "balance1": "10", "balance2": "50", "signals-cond-0": "==", "signals-val-0": true, "signals-icon-0": "/vis/signals/lowbattery.png", "signals-icon-size-0": 0, "signals-blink-0": false, "signals-horz-0": 0, "signals-vert-0": 0, "signals-hide-edit-0": false, "signals-cond-1": "==", "signals-val-1": true, "signals-icon-1": "/vis/signals/lowbattery.png", "signals-icon-size-1": 0, "signals-blink-1": false, "signals-horz-1": 0, "signals-vert-1": 0, "signals-hide-edit-1": false, "signals-cond-2": "==", "signals-val-2": true, "signals-icon-2": "/vis/signals/lowbattery.png", "signals-icon-size-2": 0, "signals-blink-2": false, "signals-horz-2": 0, "signals-vert-2": 0, "signals-hide-edit-2": false, "oid": "javascript.1.Drucker.HP.M276n.Cyan.Level", "min_oid": "0", "max_oid": "100", "digits": "0", "valueFontColor": "", "pointerColor": "", "title": "", "titleFontColor": "#000000", "titleFontFamily": "Arial, Helvetica, sans-serif", "labelFontColor": "#000000", "labelFontFamily": "Arial, Helvetica, sans-serif", "color1": "#FFFFFF", "color2": "", "color3": "#00FFFF" }, "style": { "left": "21px", "top": "56px", "width": "129px", "height": "95px", "z-index": 1 }, "widgetSet": "justgage" }, "e00002": { "tpl": "tplValueString", "data": { "oid": "javascript.1.Drucker.HP.M276n.Cyan.LastUsed", "g_fixed": false, "g_visibility": false, "g_css_font_text": true, "g_css_background": false, "g_css_shadow_padding": false, "g_css_border": false, "g_gestures": false, "g_signals": false, "visibility-cond": "==", "visibility-val": 1, "visibility-groups-action": "hide", "signals-cond-0": "==", "signals-val-0": true, "signals-icon-0": "/vis/signals/lowbattery.png", "signals-icon-size-0": 0, "signals-blink-0": false, "signals-horz-0": 0, "signals-vert-0": 0, "signals-hide-edit-0": false, "signals-cond-1": "==", "signals-val-1": true, "signals-icon-1": "/vis/signals/lowbattery.png", "signals-icon-size-1": 0, "signals-blink-1": false, "signals-horz-1": 0, "signals-vert-1": 0, "signals-hide-edit-1": false, "signals-cond-2": "==", "signals-val-2": true, "signals-icon-2": "/vis/signals/lowbattery.png", "signals-icon-size-2": 0, "signals-blink-2": false, "signals-horz-2": 0, "signals-vert-2": 0, "signals-hide-edit-2": false, "html_prepend": "Letzte Nutzung: " }, "style": { "left": "34px", "top": "157px", "font-size": "small", "width": "169px", "height": "19px", "z-index": 1 }, "widgetSet": "basic" }, "e00003": { "tpl": "tplValueString", "data": { "oid": "javascript.1.Drucker.HP.M276n.Cyan.InstallDay", "g_fixed": false, "g_visibility": false, "g_css_font_text": true, "g_css_background": false, "g_css_shadow_padding": false, "g_css_border": false, "g_gestures": false, "g_signals": false, "visibility-cond": "==", "visibility-val": 1, "visibility-groups-action": "hide", "signals-cond-0": "==", "signals-val-0": true, "signals-icon-0": "/vis/signals/lowbattery.png", "signals-icon-size-0": 0, "signals-blink-0": false, "signals-horz-0": 0, "signals-vert-0": 0, "signals-hide-edit-0": false, "signals-cond-1": "==", "signals-val-1": true, "signals-icon-1": "/vis/signals/lowbattery.png", "signals-icon-size-1": 0, "signals-blink-1": false, "signals-horz-1": 0, "signals-vert-1": 0, "signals-hide-edit-1": false, "signals-cond-2": "==", "signals-val-2": true, "signals-icon-2": "/vis/signals/lowbattery.png", "signals-icon-size-2": 0, "signals-blink-2": false, "signals-horz-2": 0, "signals-vert-2": 0, "signals-hide-edit-2": false, "html_prepend": "Installation: ", "html_append": "" }, "style": { "left": "59px", "top": "182px", "font-size": "small", "width": "144px", "height": "19px", "z-index": 1 }, "widgetSet": "basic" }, "e00004": { "tpl": "tplValueString", "data": { "oid": "nothing_selected", "g_fixed": false, "g_visibility": false, "g_css_font_text": true, "g_css_background": false, "g_css_shadow_padding": false, "g_css_border": false, "g_gestures": false, "g_signals": false, "visibility-cond": "==", "visibility-val": 1, "visibility-groups-action": "hide", "signals-cond-0": "==", "signals-val-0": true, "signals-icon-0": "/vis/signals/lowbattery.png", "signals-icon-size-0": 0, "signals-blink-0": false, "signals-horz-0": 0, "signals-vert-0": 0, "signals-hide-edit-0": false, "signals-cond-1": "==", "signals-val-1": true, "signals-icon-1": "/vis/signals/lowbattery.png", "signals-icon-size-1": 0, "signals-blink-1": false, "signals-horz-1": 0, "signals-vert-1": 0, "signals-hide-edit-1": false, "signals-cond-2": "==", "signals-val-2": true, "signals-icon-2": "/vis/signals/lowbattery.png", "signals-icon-size-2": 0, "signals-blink-2": false, "signals-horz-2": 0, "signals-vert-2": 0, "signals-hide-edit-2": false, "html_prepend": "Cyan" }, "style": { "left": "42px", "top": "43px", "font-weight": "bold", "font-size": "large", "width": "60px", "height": "20px", "z-index": 1 }, "widgetSet": "basic" }, "e00005": { "tpl": "tplValueString", "data": { "oid": "javascript.1.Drucker.HP.M276n.Cyan.Ink", "g_fixed": false, "g_visibility": false, "g_css_font_text": true, "g_css_background": false, "g_css_shadow_padding": false, "g_css_border": false, "g_gestures": false, "g_signals": false, "visibility-cond": "==", "visibility-val": 1, "visibility-groups-action": "hide", "signals-cond-0": "==", "signals-val-0": true, "signals-icon-0": "/vis/signals/lowbattery.png", "signals-icon-size-0": 0, "signals-blink-0": false, "signals-horz-0": 0, "signals-vert-0": 0, "signals-hide-edit-0": false, "signals-cond-1": "==", "signals-val-1": true, "signals-icon-1": "/vis/signals/lowbattery.png", "signals-icon-size-1": 0, "signals-blink-1": false, "signals-horz-1": 0, "signals-vert-1": 0, "signals-hide-edit-1": false, "signals-cond-2": "==", "signals-val-2": true, "signals-icon-2": "/vis/signals/lowbattery.png", "signals-icon-size-2": 0, "signals-blink-2": false, "signals-horz-2": 0, "signals-vert-2": 0, "signals-hide-edit-2": false }, "style": { "left": "147px", "top": "47px", "font-size": "small", "font-weight": "bold", "width": "60px", "height": "20px", "z-index": 1 }, "widgetSet": "basic" }, "e00006": { "tpl": "tplJustgageJustGage", "data": { "g_fixed": false, "g_visibility": false, "g_css_font_text": false, "g_css_background": false, "g_css_shadow_padding": false, "g_css_border": false, "g_gestures": false, "g_signals": false, "visibility-cond": "==", "visibility-val": 1, "visibility-groups-action": "hide", "is_tdp": "false", "factor": "1", "balance1": "10", "balance2": "50", "signals-cond-0": "==", "signals-val-0": true, "signals-icon-0": "/vis/signals/lowbattery.png", "signals-icon-size-0": 0, "signals-blink-0": false, "signals-horz-0": 0, "signals-vert-0": 0, "signals-hide-edit-0": false, "signals-cond-1": "==", "signals-val-1": true, "signals-icon-1": "/vis/signals/lowbattery.png", "signals-icon-size-1": 0, "signals-blink-1": false, "signals-horz-1": 0, "signals-vert-1": 0, "signals-hide-edit-1": false, "signals-cond-2": "==", "signals-val-2": true, "signals-icon-2": "/vis/signals/lowbattery.png", "signals-icon-size-2": 0, "signals-blink-2": false, "signals-horz-2": 0, "signals-vert-2": 0, "signals-hide-edit-2": false, "oid": "javascript.1.Drucker.HP.M276n.Magenta.Level", "min_oid": "0", "max_oid": "100", "digits": "0", "valueFontColor": "", "pointerColor": "", "title": "", "titleFontColor": "#000000", "titleFontFamily": "Arial, Helvetica, sans-serif", "labelFontColor": "#000000", "labelFontFamily": "Arial, Helvetica, sans-serif", "color1": "#FFFFFF", "color2": "", "color3": "#FF00FF" }, "style": { "left": "229px", "top": "56px", "width": "129px", "height": "95px", "z-index": 1 }, "widgetSet": "justgage" }, "e00007": { "tpl": "tplValueString", "data": { "oid": "javascript.1.Drucker.HP.M276n.Magenta.LastUsed", "g_fixed": false, "g_visibility": false, "g_css_font_text": true, "g_css_background": false, "g_css_shadow_padding": false, "g_css_border": false, "g_gestures": false, "g_signals": false, "visibility-cond": "==", "visibility-val": 1, "visibility-groups-action": "hide", "signals-cond-0": "==", "signals-val-0": true, "signals-icon-0": "/vis/signals/lowbattery.png", "signals-icon-size-0": 0, "signals-blink-0": false, "signals-horz-0": 0, "signals-vert-0": 0, "signals-hide-edit-0": false, "signals-cond-1": "==", "signals-val-1": true, "signals-icon-1": "/vis/signals/lowbattery.png", "signals-icon-size-1": 0, "signals-blink-1": false, "signals-horz-1": 0, "signals-vert-1": 0, "signals-hide-edit-1": false, "signals-cond-2": "==", "signals-val-2": true, "signals-icon-2": "/vis/signals/lowbattery.png", "signals-icon-size-2": 0, "signals-blink-2": false, "signals-horz-2": 0, "signals-vert-2": 0, "signals-hide-edit-2": false, "html_prepend": "Letzte Nutzung: " }, "style": { "left": "242px", "top": "157px", "font-size": "small", "width": "169px", "height": "19px", "z-index": 1 }, "widgetSet": "basic" }, "e00008": { "tpl": "tplValueString", "data": { "oid": "javascript.1.Drucker.HP.M276n.Magenta.InstallDay", "g_fixed": false, "g_visibility": false, "g_css_font_text": true, "g_css_background": false, "g_css_shadow_padding": false, "g_css_border": false, "g_gestures": false, "g_signals": false, "visibility-cond": "==", "visibility-val": 1, "visibility-groups-action": "hide", "signals-cond-0": "==", "signals-val-0": true, "signals-icon-0": "/vis/signals/lowbattery.png", "signals-icon-size-0": 0, "signals-blink-0": false, "signals-horz-0": 0, "signals-vert-0": 0, "signals-hide-edit-0": false, "signals-cond-1": "==", "signals-val-1": true, "signals-icon-1": "/vis/signals/lowbattery.png", "signals-icon-size-1": 0, "signals-blink-1": false, "signals-horz-1": 0, "signals-vert-1": 0, "signals-hide-edit-1": false, "signals-cond-2": "==", "signals-val-2": true, "signals-icon-2": "/vis/signals/lowbattery.png", "signals-icon-size-2": 0, "signals-blink-2": false, "signals-horz-2": 0, "signals-vert-2": 0, "signals-hide-edit-2": false, "html_prepend": "Installation: ", "html_append": "" }, "style": { "left": "266px", "top": "181px", "font-size": "small", "width": "144px", "height": "19px", "z-index": 1 }, "widgetSet": "basic" }, "e00009": { "tpl": "tplValueString", "data": { "oid": "nothing_selected", "g_fixed": false, "g_visibility": false, "g_css_font_text": true, "g_css_background": false, "g_css_shadow_padding": false, "g_css_border": false, "g_gestures": false, "g_signals": false, "visibility-cond": "==", "visibility-val": 1, "visibility-groups-action": "hide", "signals-cond-0": "==", "signals-val-0": true, "signals-icon-0": "/vis/signals/lowbattery.png", "signals-icon-size-0": 0, "signals-blink-0": false, "signals-horz-0": 0, "signals-vert-0": 0, "signals-hide-edit-0": false, "signals-cond-1": "==", "signals-val-1": true, "signals-icon-1": "/vis/signals/lowbattery.png", "signals-icon-size-1": 0, "signals-blink-1": false, "signals-horz-1": 0, "signals-vert-1": 0, "signals-hide-edit-1": false, "signals-cond-2": "==", "signals-val-2": true, "signals-icon-2": "/vis/signals/lowbattery.png", "signals-icon-size-2": 0, "signals-blink-2": false, "signals-horz-2": 0, "signals-vert-2": 0, "signals-hide-edit-2": false, "html_prepend": "Magenta" }, "style": { "left": "249px", "top": "42px", "font-weight": "bold", "font-size": "large", "width": "88px", "height": "20px", "z-index": 1 }, "widgetSet": "basic" }, "e00010": { "tpl": "tplValueString", "data": { "oid": "javascript.1.Drucker.HP.M276n.Magenta.Ink", "g_fixed": false, "g_visibility": false, "g_css_font_text": true, "g_css_background": false, "g_css_shadow_padding": false, "g_css_border": false, "g_gestures": false, "g_signals": false, "visibility-cond": "==", "visibility-val": 1, "visibility-groups-action": "hide", "signals-cond-0": "==", "signals-val-0": true, "signals-icon-0": "/vis/signals/lowbattery.png", "signals-icon-size-0": 0, "signals-blink-0": false, "signals-horz-0": 0, "signals-vert-0": 0, "signals-hide-edit-0": false, "signals-cond-1": "==", "signals-val-1": true, "signals-icon-1": "/vis/signals/lowbattery.png", "signals-icon-size-1": 0, "signals-blink-1": false, "signals-horz-1": 0, "signals-vert-1": 0, "signals-hide-edit-1": false, "signals-cond-2": "==", "signals-val-2": true, "signals-icon-2": "/vis/signals/lowbattery.png", "signals-icon-size-2": 0, "signals-blink-2": false, "signals-horz-2": 0, "signals-vert-2": 0, "signals-hide-edit-2": false }, "style": { "left": "354px", "top": "46px", "font-size": "small", "font-weight": "bold", "width": "60px", "height": "20px", "z-index": 1 }, "widgetSet": "basic" }, "e00011": { "tpl": "tplJustgageJustGage", "data": { "g_fixed": false, "g_visibility": false, "g_css_font_text": false, "g_css_background": false, "g_css_shadow_padding": false, "g_css_border": false, "g_gestures": false, "g_signals": false, "visibility-cond": "==", "visibility-val": 1, "visibility-groups-action": "hide", "is_tdp": "false", "factor": "1", "balance1": "10", "balance2": "50", "signals-cond-0": "==", "signals-val-0": true, "signals-icon-0": "/vis/signals/lowbattery.png", "signals-icon-size-0": 0, "signals-blink-0": false, "signals-horz-0": 0, "signals-vert-0": 0, "signals-hide-edit-0": false, "signals-cond-1": "==", "signals-val-1": true, "signals-icon-1": "/vis/signals/lowbattery.png", "signals-icon-size-1": 0, "signals-blink-1": false, "signals-horz-1": 0, "signals-vert-1": 0, "signals-hide-edit-1": false, "signals-cond-2": "==", "signals-val-2": true, "signals-icon-2": "/vis/signals/lowbattery.png", "signals-icon-size-2": 0, "signals-blink-2": false, "signals-horz-2": 0, "signals-vert-2": 0, "signals-hide-edit-2": false, "oid": "javascript.1.Drucker.HP.M276n.Yellow.Level", "min_oid": "0", "max_oid": "100", "digits": "0", "valueFontColor": "", "pointerColor": "", "title": "", "titleFontColor": "#000000", "titleFontFamily": "Arial, Helvetica, sans-serif", "labelFontColor": "#000000", "labelFontFamily": "Arial, Helvetica, sans-serif", "color1": "#FFFFFF", "color2": "", "color3": "#FFFF00" }, "style": { "left": "21px", "top": "244px", "width": "129px", "height": "95px", "z-index": 1 }, "widgetSet": "justgage" }, "e00012": { "tpl": "tplValueString", "data": { "oid": "javascript.1.Drucker.HP.M276n.Yellow.LastUsed", "g_fixed": false, "g_visibility": false, "g_css_font_text": true, "g_css_background": false, "g_css_shadow_padding": false, "g_css_border": false, "g_gestures": false, "g_signals": false, "visibility-cond": "==", "visibility-val": 1, "visibility-groups-action": "hide", "signals-cond-0": "==", "signals-val-0": true, "signals-icon-0": "/vis/signals/lowbattery.png", "signals-icon-size-0": 0, "signals-blink-0": false, "signals-horz-0": 0, "signals-vert-0": 0, "signals-hide-edit-0": false, "signals-cond-1": "==", "signals-val-1": true, "signals-icon-1": "/vis/signals/lowbattery.png", "signals-icon-size-1": 0, "signals-blink-1": false, "signals-horz-1": 0, "signals-vert-1": 0, "signals-hide-edit-1": false, "signals-cond-2": "==", "signals-val-2": true, "signals-icon-2": "/vis/signals/lowbattery.png", "signals-icon-size-2": 0, "signals-blink-2": false, "signals-horz-2": 0, "signals-vert-2": 0, "signals-hide-edit-2": false, "html_prepend": "Letzte Nutzung: " }, "style": { "left": "33px", "top": "344px", "font-size": "small", "width": "169px", "height": "19px", "z-index": 1 }, "widgetSet": "basic" }, "e00013": { "tpl": "tplValueString", "data": { "oid": "javascript.1.Drucker.HP.M276n.Yellow.InstallDay", "g_fixed": false, "g_visibility": false, "g_css_font_text": true, "g_css_background": false, "g_css_shadow_padding": false, "g_css_border": false, "g_gestures": false, "g_signals": false, "visibility-cond": "==", "visibility-val": 1, "visibility-groups-action": "hide", "signals-cond-0": "==", "signals-val-0": true, "signals-icon-0": "/vis/signals/lowbattery.png", "signals-icon-size-0": 0, "signals-blink-0": false, "signals-horz-0": 0, "signals-vert-0": 0, "signals-hide-edit-0": false, "signals-cond-1": "==", "signals-val-1": true, "signals-icon-1": "/vis/signals/lowbattery.png", "signals-icon-size-1": 0, "signals-blink-1": false, "signals-horz-1": 0, "signals-vert-1": 0, "signals-hide-edit-1": false, "signals-cond-2": "==", "signals-val-2": true, "signals-icon-2": "/vis/signals/lowbattery.png", "signals-icon-size-2": 0, "signals-blink-2": false, "signals-horz-2": 0, "signals-vert-2": 0, "signals-hide-edit-2": false, "html_prepend": "Installation: ", "html_append": "" }, "style": { "left": "57px", "top": "368px", "font-size": "small", "width": "144px", "height": "19px", "z-index": 1 }, "widgetSet": "basic" }, "e00014": { "tpl": "tplValueString", "data": { "oid": "nothing_selected", "g_fixed": false, "g_visibility": false, "g_css_font_text": true, "g_css_background": false, "g_css_shadow_padding": false, "g_css_border": false, "g_gestures": false, "g_signals": false, "visibility-cond": "==", "visibility-val": 1, "visibility-groups-action": "hide", "signals-cond-0": "==", "signals-val-0": true, "signals-icon-0": "/vis/signals/lowbattery.png", "signals-icon-size-0": 0, "signals-blink-0": false, "signals-horz-0": 0, "signals-vert-0": 0, "signals-hide-edit-0": false, "signals-cond-1": "==", "signals-val-1": true, "signals-icon-1": "/vis/signals/lowbattery.png", "signals-icon-size-1": 0, "signals-blink-1": false, "signals-horz-1": 0, "signals-vert-1": 0, "signals-hide-edit-1": false, "signals-cond-2": "==", "signals-val-2": true, "signals-icon-2": "/vis/signals/lowbattery.png", "signals-icon-size-2": 0, "signals-blink-2": false, "signals-horz-2": 0, "signals-vert-2": 0, "signals-hide-edit-2": false, "html_prepend": "Yellow" }, "style": { "left": "40px", "top": "229px", "font-weight": "bold", "font-size": "large", "width": "60px", "height": "20px", "z-index": 1 }, "widgetSet": "basic" }, "e00015": { "tpl": "tplValueString", "data": { "oid": "javascript.1.Drucker.HP.M276n.Yellow.Ink", "g_fixed": false, "g_visibility": false, "g_css_font_text": true, "g_css_background": false, "g_css_shadow_padding": false, "g_css_border": false, "g_gestures": false, "g_signals": false, "visibility-cond": "==", "visibility-val": 1, "visibility-groups-action": "hide", "signals-cond-0": "==", "signals-val-0": true, "signals-icon-0": "/vis/signals/lowbattery.png", "signals-icon-size-0": 0, "signals-blink-0": false, "signals-horz-0": 0, "signals-vert-0": 0, "signals-hide-edit-0": false, "signals-cond-1": "==", "signals-val-1": true, "signals-icon-1": "/vis/signals/lowbattery.png", "signals-icon-size-1": 0, "signals-blink-1": false, "signals-horz-1": 0, "signals-vert-1": 0, "signals-hide-edit-1": false, "signals-cond-2": "==", "signals-val-2": true, "signals-icon-2": "/vis/signals/lowbattery.png", "signals-icon-size-2": 0, "signals-blink-2": false, "signals-horz-2": 0, "signals-vert-2": 0, "signals-hide-edit-2": false }, "style": { "left": "145px", "top": "233px", "font-size": "small", "font-weight": "bold", "width": "60px", "height": "20px", "z-index": 1 }, "widgetSet": "basic" }, "e00016": { "tpl": "tplJustgageJustGage", "data": { "g_fixed": false, "g_visibility": false, "g_css_font_text": false, "g_css_background": false, "g_css_shadow_padding": false, "g_css_border": false, "g_gestures": false, "g_signals": false, "visibility-cond": "==", "visibility-val": 1, "visibility-groups-action": "hide", "is_tdp": "false", "factor": "1", "balance1": "10", "balance2": "50", "signals-cond-0": "==", "signals-val-0": true, "signals-icon-0": "/vis/signals/lowbattery.png", "signals-icon-size-0": 0, "signals-blink-0": false, "signals-horz-0": 0, "signals-vert-0": 0, "signals-hide-edit-0": false, "signals-cond-1": "==", "signals-val-1": true, "signals-icon-1": "/vis/signals/lowbattery.png", "signals-icon-size-1": 0, "signals-blink-1": false, "signals-horz-1": 0, "signals-vert-1": 0, "signals-hide-edit-1": false, "signals-cond-2": "==", "signals-val-2": true, "signals-icon-2": "/vis/signals/lowbattery.png", "signals-icon-size-2": 0, "signals-blink-2": false, "signals-horz-2": 0, "signals-vert-2": 0, "signals-hide-edit-2": false, "oid": "javascript.1.Drucker.HP.M276n.Black.Level", "min_oid": "0", "max_oid": "100", "digits": "0", "valueFontColor": "", "pointerColor": "", "title": "", "titleFontColor": "#000000", "titleFontFamily": "Arial, Helvetica, sans-serif", "labelFontColor": "#000000", "labelFontFamily": "Arial, Helvetica, sans-serif", "color1": "#FFFFFF", "color2": "", "color3": "#000000" }, "style": { "left": "229px", "top": "244px", "width": "129px", "height": "95px", "z-index": 1 }, "widgetSet": "justgage" }, "e00017": { "tpl": "tplValueString", "data": { "oid": "javascript.1.Drucker.HP.M276n.Black.LastUsed", "g_fixed": false, "g_visibility": false, "g_css_font_text": true, "g_css_background": false, "g_css_shadow_padding": false, "g_css_border": false, "g_gestures": false, "g_signals": false, "visibility-cond": "==", "visibility-val": 1, "visibility-groups-action": "hide", "signals-cond-0": "==", "signals-val-0": true, "signals-icon-0": "/vis/signals/lowbattery.png", "signals-icon-size-0": 0, "signals-blink-0": false, "signals-horz-0": 0, "signals-vert-0": 0, "signals-hide-edit-0": false, "signals-cond-1": "==", "signals-val-1": true, "signals-icon-1": "/vis/signals/lowbattery.png", "signals-icon-size-1": 0, "signals-blink-1": false, "signals-horz-1": 0, "signals-vert-1": 0, "signals-hide-edit-1": false, "signals-cond-2": "==", "signals-val-2": true, "signals-icon-2": "/vis/signals/lowbattery.png", "signals-icon-size-2": 0, "signals-blink-2": false, "signals-horz-2": 0, "signals-vert-2": 0, "signals-hide-edit-2": false, "html_prepend": "Letzte Nutzung: " }, "style": { "left": "240px", "top": "343px", "font-size": "small", "width": "169px", "height": "19px", "z-index": 1 }, "widgetSet": "basic" }, "e00018": { "tpl": "tplValueString", "data": { "oid": "javascript.1.Drucker.HP.M276n.Black.InstallDay", "g_fixed": false, "g_visibility": false, "g_css_font_text": true, "g_css_background": false, "g_css_shadow_padding": false, "g_css_border": false, "g_gestures": false, "g_signals": false, "visibility-cond": "==", "visibility-val": 1, "visibility-groups-action": "hide", "signals-cond-0": "==", "signals-val-0": true, "signals-icon-0": "/vis/signals/lowbattery.png", "signals-icon-size-0": 0, "signals-blink-0": false, "signals-horz-0": 0, "signals-vert-0": 0, "signals-hide-edit-0": false, "signals-cond-1": "==", "signals-val-1": true, "signals-icon-1": "/vis/signals/lowbattery.png", "signals-icon-size-1": 0, "signals-blink-1": false, "signals-horz-1": 0, "signals-vert-1": 0, "signals-hide-edit-1": false, "signals-cond-2": "==", "signals-val-2": true, "signals-icon-2": "/vis/signals/lowbattery.png", "signals-icon-size-2": 0, "signals-blink-2": false, "signals-horz-2": 0, "signals-vert-2": 0, "signals-hide-edit-2": false, "html_prepend": "Installation: ", "html_append": "" }, "style": { "left": "265px", "top": "368px", "font-size": "small", "width": "144px", "height": "19px", "z-index": 1 }, "widgetSet": "basic" }, "e00019": { "tpl": "tplValueString", "data": { "oid": "nothing_selected", "g_fixed": false, "g_visibility": false, "g_css_font_text": true, "g_css_background": false, "g_css_shadow_padding": false, "g_css_border": false, "g_gestures": false, "g_signals": false, "visibility-cond": "==", "visibility-val": 1, "visibility-groups-action": "hide", "signals-cond-0": "==", "signals-val-0": true, "signals-icon-0": "/vis/signals/lowbattery.png", "signals-icon-size-0": 0, "signals-blink-0": false, "signals-horz-0": 0, "signals-vert-0": 0, "signals-hide-edit-0": false, "signals-cond-1": "==", "signals-val-1": true, "signals-icon-1": "/vis/signals/lowbattery.png", "signals-icon-size-1": 0, "signals-blink-1": false, "signals-horz-1": 0, "signals-vert-1": 0, "signals-hide-edit-1": false, "signals-cond-2": "==", "signals-val-2": true, "signals-icon-2": "/vis/signals/lowbattery.png", "signals-icon-size-2": 0, "signals-blink-2": false, "signals-horz-2": 0, "signals-vert-2": 0, "signals-hide-edit-2": false, "html_prepend": "Black" }, "style": { "left": "247px", "top": "228px", "font-weight": "bold", "font-size": "large", "width": "60px", "height": "20px", "z-index": 1 }, "widgetSet": "basic" }, "e00020": { "tpl": "tplValueString", "data": { "oid": "javascript.1.Drucker.HP.M276n.Black.Ink", "g_fixed": false, "g_visibility": false, "g_css_font_text": true, "g_css_background": false, "g_css_shadow_padding": false, "g_css_border": false, "g_gestures": false, "g_signals": false, "visibility-cond": "==", "visibility-val": 1, "visibility-groups-action": "hide", "signals-cond-0": "==", "signals-val-0": true, "signals-icon-0": "/vis/signals/lowbattery.png", "signals-icon-size-0": 0, "signals-blink-0": false, "signals-horz-0": 0, "signals-vert-0": 0, "signals-hide-edit-0": false, "signals-cond-1": "==", "signals-val-1": true, "signals-icon-1": "/vis/signals/lowbattery.png", "signals-icon-size-1": 0, "signals-blink-1": false, "signals-horz-1": 0, "signals-vert-1": 0, "signals-hide-edit-1": false, "signals-cond-2": "==", "signals-val-2": true, "signals-icon-2": "/vis/signals/lowbattery.png", "signals-icon-size-2": 0, "signals-blink-2": false, "signals-horz-2": 0, "signals-vert-2": 0, "signals-hide-edit-2": false }, "style": { "left": "352px", "top": "232px", "font-size": "small", "font-weight": "bold", "width": "60px", "height": "20px", "z-index": 1 }, "widgetSet": "basic" }, "e00021": { "tpl": "tplFrame", "data": { "g_fixed": false, "g_visibility": false, "g_css_font_text": true, "g_css_background": true, "g_css_shadow_padding": false, "g_css_border": false, "g_gestures": false, "g_signals": false, "visibility-cond": "==", "visibility-val": 1, "visibility-groups-action": "hide", "title": "HP MFP M276n", "title_color": "black", "title_top": "3", "title_left": "11", "header_height": "0", "header_color": "black", "signals-cond-0": "==", "signals-val-0": true, "signals-icon-0": "/vis/signals/lowbattery.png", "signals-icon-size-0": 0, "signals-blink-0": false, "signals-horz-0": 0, "signals-vert-0": 0, "signals-hide-edit-0": false, "signals-cond-1": "==", "signals-val-1": true, "signals-icon-1": "/vis/signals/lowbattery.png", "signals-icon-size-1": 0, "signals-blink-1": false, "signals-horz-1": 0, "signals-vert-1": 0, "signals-hide-edit-1": false, "signals-cond-2": "==", "signals-val-2": true, "signals-icon-2": "/vis/signals/lowbattery.png", "signals-icon-size-2": 0, "signals-blink-2": false, "signals-horz-2": 0, "signals-vert-2": 0, "signals-hide-edit-2": false }, "style": { "left": "6px", "top": "5px", "width": "446px", "height": "420px", "font-size": "large", "font-weight": "bold", "background-color": "#a8a9d7", "z-index": 0 }, "widgetSet": "basic" } }, "name": "Drucker", "filterList": [] } !
sowie dem passenden Script! ````
/* bringt den Druckerttonerstand von WEB enabled HP Farmlaserdrucker M276n in ioBroker
Drucker HP Tintenstand für iobroker ermitteln
Basierend auf CCU2 Script fuer HP Drucker http://homematic-forum.de/forum/viewtopic.php?f=31&t=25140
und dem angepassten Script von PiX aus iobroker http://forum.iobroker.de/viewtopic.php?f=21&t=910&p=6931&hilit=drucker&sid=6780c0b33361e199846dcb584c8dc289&sid=6780c0b33361e199846dcb584c8dc289#p6931
Author : looxer01 - 22.12.2015
Version 0.2 29.01.2015 Druckerparameter jetzt einstellbar im Bereich der Einstellungen
*/
! // hier Drucker parameter einstellen - vor dem ersten Speichern des Scripts
! var druckerIP = '192.168.0.238'; // Drucker IP
var druckermod = "M276n"; // Drucker Modell - Strukturelement in den Variablen
var TinteID = "131A"; // Tinte - Tintenbezeichnung
var TinteCyanBez = "CF211A"; // Bezeichnung fuer Cyan
var TinteYellowBez = "CF212A"; // Bezeichnung fuer Yellow
var TinteBlackBez = "CF210X"; // Bezeichnung fuer Black
var TinteMagentaBez = "CF213A"; // Bezeichnung fuer Magenta
! // ende Einstellungen
! var druckerURL = "http://" + druckerIP + "/DevMgmt/ConsumableConfigDyn.xml"; // URL nicht ändern
var request = require('request'); // Enabling for URL Request
var cut1 = "dd:ConsumableLabelCode"; // Marker für color
var cut2 = "dd:ConsumablePercentageLevelRemaining"; // Marker für Level
var cut3 = "ccdyn:ConsumableInfo"; // ab hier stehen die Informationen
var cut4 = "dd:MaxCapacity"; // Marker für maximale Kapazität
var cut5 = "dd:ConsumableLastUsedDate"; // Marker für letzte Nutzung
var cut6 = "dd:Date"; // Marker für Installationsdatum
var cut7 = "ccdyn:ConsumableInfo"; // Marker für
! var level_M = 0; // Tintenlevel
var level_C = 0; // Tintenlevel
var level_Y = 0; // Tintenlevel
var level_K = 0; // Tintenlevel
var capacity_M = 0; // Tintenlevel
var capacity_C = 0; // Tintenlevel
var capacity_Y = 0; // Tintenlevel
var capacity_K = 0; // Tintenlevel
var LastUsed_M = ""; // Tintenlevel
var LastUsed_C = ""; // Tintenlevel
var LastUsed_Y = ""; // Tintenlevel
var LastUsed_K = ""; // Tintenlevel
var InstallDay_M = ""; // Tintenlevel
var InstallDay_C = ""; // Tintenlevel
var InstallDay_Y = ""; // Tintenlevel
var InstallDay_K = ""; // Tintenlevelvar DruckIP = "Drucker.HP." + druckermod + ".IP"; // Variable für create states
var DruckerName = "Drucker.HP." + druckermod + ".Name"; // Variable für create states
var Modell = "Drucker.HP." + druckermod + ".Modell"; // Variable für create states
var Tinte = "Drucker.HP." + druckermod + ".Tinte"; // Variable für create states
var CyanInk = "Drucker.HP." + druckermod + ".Cyan.Ink"; // Variable für create states
var YellowInk = "Drucker.HP." + druckermod + ".Yellow.Ink"; // Variable für create states
var BlackInk = "Drucker.HP." + druckermod + ".Black.Ink"; // Variable für create states
var MagentaInk = "Drucker.HP." + druckermod + ".Magenta.Ink"; // Variable für create states! var CyanLevel = "Drucker.HP." + druckermod + ".Cyan.Level"; // Variable für create states
var YellowLevel = "Drucker.HP." + druckermod + ".Yellow.Level"; // Variable für create states
var BlackLevel = "Drucker.HP." + druckermod + ".Black.Level"; // Variable für create states
var MagentaLevel= "Drucker.HP." + druckermod + ".Magenta.Level"; // Variable für create states
! var CyanCapacity = "Drucker.HP." + druckermod + ".Cyan.Capacity"; // Variable für create states
var YellowCapacity = "Drucker.HP." + druckermod + ".Yellow.Capacity"; // Variable für create states
var BlackCapacity = "Drucker.HP." + druckermod + ".Black.Capacity"; // Variable für create states
var MagentaCapacity= "Drucker.HP." + druckermod + ".Magenta.Capacity"; // Variable für create states
! var CyanLastUsed = "Drucker.HP." + druckermod + ".Cyan.LastUsed"; // Variable für create states
var YellowLastUsed = "Drucker.HP." + druckermod + ".Yellow.LastUsed"; // Variable für create states
var BlackLastUsed = "Drucker.HP." + druckermod + ".Black.LastUsed"; // Variable für create states
var MagentaLastUsed = "Drucker.HP." + druckermod + ".Magenta.LastUsed"; // Variable für create states
! var CyanInstallDay = "Drucker.HP." + druckermod + ".Cyan.InstallDay"; // Variable für create states
var YellowInstallDay = "Drucker.HP." + druckermod + ".Yellow.InstallDay"; // Variable für create states
var BlackInstallDay = "Drucker.HP." + druckermod + ".Black.InstallDay"; // Variable für create states
var MagentaInstallDay= "Drucker.HP." + druckermod + ".Magenta.InstallDay"; // Variable für create states
! // Anlegen der Variablen
createState(DruckIP,druckerIP);
createState(DruckerName,druckermod);
createState(Tinte,TinteID);
! createState(CyanInk,TinteCyanBez);
createState(YellowInk,TinteYellowBez);
createState(BlackInk,TinteBlackBez);
createState(MagentaInk,TinteMagentaBez);
! createState(CyanLevel,0);
createState(YellowLevel,0);
createState(BlackLevel,0);
createState(MagentaLevel,0);
! createState(CyanCapacity,0);
createState(YellowCapacity,0);
createState(BlackCapacity,0);
createState(MagentaCapacity,0);
! createState(CyanLastUsed,"");
createState(YellowLastUsed,"");
createState(BlackLastUsed,"");
createState(MagentaLastUsed,"");
! createState(CyanInstallDay,"");
createState(YellowInstallDay,"");
createState(BlackInstallDay,"");
createState(MagentaInstallDay,"");
! // Schedule für die Updates
schedule("/1 * * * * ", function () { // alle 20 Minuten
// oder schedule( */6 * * * , function () { // alle 6 Stunden, etcrequest(druckerURL, function (error, response, body) { // Einlesen der XML Information
if (!error && response.statusCode == 200) { // error check
var eins_lastpos = body.indexOf(cut3); // ab hier beginnen die realen Datenvar start_position ; var color; var position; var level_string ; var max_capacity ; var last_used; var inst_day;
! for (var i = 1; i <= 4; i++) {
position = body.indexOf(cut1, start_position) + cut1.length + 1; color = body.substring(position, position+1) ; position = body.indexOf(cut2,start_position)+ cut2.length + 1; level_string = body.substring(position, position+3) ; position = body.indexOf(cut4,start_position)+ cut4.length + 1; // dritte Position finden max_capacity = body.substring(position, position+4) ; position = body.indexOf(cut5,start_position)+ cut5.length + 1; // dritte Position finden last_used = body.substring(position, position+10) ; position = body.indexOf(cut6,start_position)+ cut6.length + 1; // dritte Position finden inst_day = body.substring(position, position+10) ;
! // log("color " + color,"info");
// log("Level " + level_string,"info");
// log("max Kapa " + max_capacity,"info");
// log("last used " + last_used,"info");
// log("inst_day " + inst_day,"info");if("M" == color){ level_M = level_string; capacity_M = max_capacity; LastUsed_M = last_used; InstallDay_M = inst_day; } if("C" == color){ level_C = level_string; capacity_C = max_capacity; LastUsed_C = last_used; InstallDay_C = inst_day; } if("Y" == color){ level_Y = level_string; capacity_Y = max_capacity; LastUsed_Y = last_used; InstallDay_Y = inst_day; } if("K" == color){ level_K = level_string; capacity_K = max_capacity; LastUsed_K = last_used; InstallDay_K = inst_day; } start_position = body.indexOf(cut3, position); // merken position eins
! } //end For
!
// log('Drucker Level M ' + level_M , "info");
// log('Drucker Level C ' + level_C , "info");
// log('Drucker Level Y ' + level_Y , "info");
// log('Drucker Level K ' + level_K , "info");// der folgende Bereich muss für ggf abweichenden Druckertyp angepasst werden
setState(CyanLevel, level_C);
setState(YellowLevel, level_Y);
setState(BlackLevel, level_K);
setState(MagentaLevel, level_M);
setState(DruckIP, druckerIP);
setState(CyanCapacity, capacity_C);
setState(YellowCapacity, capacity_Y);
setState(BlackCapacity, capacity_K);
setState(MagentaCapacity, capacity_M);
setState(CyanLastUsed, LastUsed_C);
setState(YellowLastUsed, LastUsed_Y);
setState(BlackLastUsed, LastUsed_K);
setState(MagentaLastUsed, LastUsed_M);
setState(CyanInstallDay, InstallDay_C);
setState(YellowInstallDay, InstallDay_Y);
setState(BlackInstallDay, InstallDay_K);
setState(MagentaInstallDay, InstallDay_M);!
} else { // if (!error && response.statusCode == 200) {
log(error);
log('Kein Drucker gefunden');}
! }); // end of request
! }); // end of schedule
! ````
Vielleicht hilft es einem und Viel Spaß damitJürgen
-
HI,
hab das Skript eingefügt und entsprechend die IP angepasst.
Beim starten erscheint folgende Meldung in Rot:
00:15:57.655 [error] javascript.0 script.js.IT.Tinte compile failed: SyntaxError: Unexpected number
Außer der IP und dem Tintenbezeichnung hab ich in dem Skript nichts weiter geändert.
Nach was muss ich suchen im Skript?
Danke
-
Nach dem Fehler.
-
Der wäre?
-
Wollte damit wohl sagen; wenn Du uns nichts gibst, können wir auch nichts suchen.??!!
-> Geändertes Script herzeigen.
-
Hier…
! ````
var druckerIP = "192.168.178.31";
var druckerURL = "http://" 192.168.178.31 "/DevMgmt/ConsumableConfigDyn.xml";
! var druckermod = "8500";
var TinteID = "920XL";
! var request = require('request');
var cut1 = "dd:ConsumableLabelCode";
var cut2 = "dd:ConsumablePercentageLevelRemaining";
! var level_M = 0;
var level_C = 0;
var level_Y = 0;
var level_K = 0;
! // angepasst an HP 8900 - hier bitte entsprechend anpassen auf den jeweiligen Typ
createState('Drucker.HP.8500.IP',druckerIP);
createState('Drucker.HP.8500.Modell',druckermod);
createState('Drucker.HP.8500.Tinte',TinteID);
createState('Drucker.HP.8500.Cyan.Level');
createState('Drucker.HP.8500.Cyan.Ink','C4907A');
createState('Drucker.HP.8500.Yellow.Level');
createState('Drucker.HP.8500.Yellow.Ink','C4909A');
createState('Drucker.HP.8500.Black.Level');
createState('Drucker.HP.8500.Black.Ink','C4906A');
createState('Drucker.HP.8500.Magenta.Level');
createState('Drucker.HP.8500.Magenta.Ink','C4908A');
! schedule("*/20 * * * *", function () { // alle 20 Minuten
! request(druckerURL, function (error, response, body) {
if (!error && response.statusCode == 200) {
! // Farbe nummer 1
var eins_position = body.indexOf(cut1) + cut1.length + 1;
var color = body.substring(eins_position, eins_position+1) ;
var zwei_position = body.indexOf(cut2)+ cut2.length + 1;
var level_string = body.substring(zwei_position, zwei_position+2) ;
var eins_lastpos = eins_position +10;
var zwei_lastpos = zwei_position + 10;
! if("M" == color){
level_M = level_string;
}
if("X" == color){
level_C = level_string;
}
if("Y" == color){
level_Y = level_string;
}
if("K" == color){
level_K = level_string;
}
! // Farbe nummer 2
eins_position = body.indexOf(cut1, eins_lastpos) + cut1.length + 1 ;
color = body.substring(eins_position, eins_position+1) ;
zwei_position = body.indexOf(cut2,zwei_lastpos)+ cut2.length + 1;
level_string = body.substring(zwei_position, zwei_position+2) ;
! if("M" == color){
level_M = level_string;
}
if("C" == color){
level_C = level_string;
}
if("Y" == color){
level_Y = level_string;
}
if("K" == color){
level_K = level_string;
}
eins_lastpos = eins_position + 10;
zwei_lastpos = zwei_position + 10;
! // Farbe nummer 3
eins_position = body.indexOf(cut1, eins_lastpos) + cut1.length + 1;
color = body.substring(eins_position, eins_position+1) ;
zwei_position = body.indexOf(cut2,zwei_lastpos)+ cut2.length + 1;
level_string = body.substring(zwei_position, zwei_position+2) ;
! if("M" == color){
level_M = level_string;
}
if("C" == color){
level_C = level_string;
}
if("Y" == color){
level_Y = level_string;
}
if("K" == color){
level_K = level_string;
}
eins_lastpos = eins_position + 10;
zwei_lastpos = zwei_position + 10;
! // Farbe nummer 4
eins_position = body.indexOf(cut1, eins_lastpos) + cut1.length + 1;
color = body.substring(eins_position, eins_position+1) ;
zwei_position = body.indexOf(cut2,zwei_lastpos)+ cut2.length + 1;
level_string = body.substring(zwei_position, zwei_position+2) ;
! if("M" == color){
level_M = level_string;
}
if("C" == color){
level_C = level_string;
}
if("Y" == color){
level_Y = level_string;
}
if("K" == color){
level_K = level_string;
}
eins_lastpos = eins_position + 10;
zwei_lastpos = zwei_position + 10;
! log('Drucker Level M ' + level_M , "info");
log('Drucker Level C ' + level_C , "info");
log('Drucker Level Y ' + level_Y , "info");
log('Drucker Level K ' + level_K , "info");
! // der folgende Bereich muss für ggf abweichenden Druckertyp angepasst werden
! setState('javascript.0.Drucker.HP.8500.Cyan.Level', level_C);
setState('javascript.0.Drucker.HP.8500.Yellow.Level', level_Y);
setState('javascript.0.Drucker.HP.8500.Black.Level', level_K);
setState('javascript.0.Drucker.HP.8500.Magenta.Level', level_M);
setState('javascript.0.Drucker.HP.8500.IP', druckerIP);
! } else { // if (!error && response.statusCode == 200) {
log(error);
log('Kein Drucker gefunden');
! }
! }); // end of request
! }); // end of schedulegeändert: Code in Code-Tags und Spoiler gesetzt; ****Homoran (Mod)****
-
Da ist definitiv schon ein Fehler drin. Ev. hast Du den schon mit-kopiert… oder was auch immer.
Ich schau's mal durch.
Für das nächste Mal; bitte den Code zwischen die (Code)(/code) Markierungen einpacken...
-
Das war schon verpfuscht. Habe nun eine neuere Version des Druckerscripts für Dich angepasst.
Bitte bei den Objekten, alle bereits erstellten -javascript.0.Drucker.HP.8500- Einträge löschen (falls vorhanden).
Das Script macht die dann neu.
Einstellungen sollten ca. passen - So wie es ist, läufts alle 6 Stunden. Das könnte bei Zeile 69 sonst angepasst werden.
/* bringt den Druckertintenstand von WEB enabled HP Tintenstrahler in ioBroker Drucker HP Tintenstand für iobroker ermitteln Basierend auf CCU2 Script fuer HP Drucker http://homematic-forum.de/forum/viewtopic.php?f=31&t=25140 und dem angepassten Script von PiX aus iobroker http://forum.iobroker.de/viewtopic.php?f=21&t=910&p=6931&hilit=drucker&sid=6780c0b33361e199846dcb584c8dc289&sid=6780c0b33361e199846dcb584c8dc289#p6931 Author : looxer01 - 22.12.2015 Version 0.2 29.01.2015 Druckerparameter jetzt einstellbar im Bereich der Einstellungen kosmetik ykuendig */ // hier Drucker parameter einstellen - vor dem ersten Speichern des Scripts var druckerIP = '192.168.178.31'; // Drucker IP var druckermod = "8500"; // Drucker Modell - Strukturelement in den Variablen var TinteID = "920XL"; // Tinte - Tintenbezeichnung var TinteCyanBez = "1234567"; // Bezeichnung fuer Cyan var TinteMagentaBez = "1234567"; // Bezeichnung fuer Magenta var TinteYellowBez = "1234567"; // Bezeichnung fuer Yellow var TinteBlackBez = "1234567"; // Bezeichnung fuer Black // ENDE der Einstellungen var druckerURL = "http://" + druckerIP + "/DevMgmt/ConsumableConfigDyn.xml"; // URL nicht ändern var request = require('request'); // Enabling for URL Request var cut0 = "dd:Capacity"; // Marker für capacity var cut1 = "dd:ConsumableLabelCode"; // Marker für color var cut2 = "dd:ConsumablePercentageLevelRemaining"; // Marker für Level var level_C = 0; // Tintenlevel var level_M = 0; // Tintenlevel var level_Y = 0; // Tintenlevel var level_K = 0; // Tintenlevel var DruckIP = "Drucker.HP." + druckermod + ".IP"; // Variable für create states var DruckerName = "Drucker.HP." + druckermod + ".Name"; // Variable für create states var Modell = "Drucker.HP." + druckermod + ".Modell"; // Variable für create states var Tinte = "Drucker.HP." + druckermod + ".Tinte"; // Variable für create states var CyanInk = "Drucker.HP." + druckermod + ".Color1Cyan.Ink"; // Variable für create states var MagentaInk = "Drucker.HP." + druckermod + ".Color2Magenta.Ink"; // Variable für create states var YellowInk = "Drucker.HP." + druckermod + ".Color3Yellow.Ink"; // Variable für create states var BlackInk = "Drucker.HP." + druckermod + ".Color4Black.Ink"; // Variable für create states var CyanLevel = "Drucker.HP." + druckermod + ".Color1Cyan.Level"; // Variable für create states var MagentaLevel = "Drucker.HP." + druckermod + ".Color2Magenta.Level"; // Variable für create states var YellowLevel = "Drucker.HP." + druckermod + ".Color3Yellow.Level"; // Variable für create states var BlackLevel = "Drucker.HP." + druckermod + ".Color4Black.Level"; // Variable für create states // Anlegen der Variablen createState(DruckIP,druckerIP); createState(DruckerName,druckermod); createState(Tinte,TinteID); createState(CyanInk,TinteCyanBez); createState(MagentaInk,TinteMagentaBez); createState(YellowInk,TinteYellowBez); createState(BlackInk,TinteBlackBez); createState(CyanLevel,0); createState(MagentaLevel,0); createState(YellowLevel,0); createState(BlackLevel),0; // Schedule für die Updates schedule("0 */6 * * *", Drucker); // Schedule alle 6 Stunden Drucker(); // Sofort beim Scriptstart einmal laufen lassen function Drucker () { request(druckerURL, function (error, response, body) { // Einlesen der XML Information if (!error && response.statusCode == 200) { // error check // Farbe nummer 1 var null_position = body.indexOf(cut0) + cut0.length + 1 ; var eins_position = body.indexOf(cut1, null_position) + cut1.length + 1; // erste Position finden var color = body.substring(eins_position, eins_position+1) ; // erste Position ist die Farbe var zwei_position = body.indexOf(cut2)+ cut2.length + 1; // zweite Position finden var level_string = body.substring(zwei_position, body.indexOf(TagEndMarker, zwei_position)); var eins_lastpos = eins_position; // merken position eins var zwei_lastpos = zwei_position; // merken position zwei var TagEndMarker = '<'; if("C" == color){ level_C = level_string; } if("M" == color){ level_M = level_string; } if("Y" == color){ level_Y = level_string; } if("K" == color){ level_K = level_string; } eins_lastpos = eins_position + 10; zwei_lastpos = zwei_position + 10; // Farbe nummer 2 eins_position = body.indexOf(cut1, eins_lastpos) + cut1.length + 1 ; color = body.substring(eins_position, eins_position+1) ; zwei_position = body.indexOf(cut2,zwei_lastpos)+ cut2.length + 1; level_string = body.substring(zwei_position, body.indexOf(TagEndMarker, zwei_position)); if("C" == color){ level_C = level_string; } if("M" == color){ level_M = level_string; } if("Y" == color){ level_Y = level_string; } if("K" == color){ level_K = level_string; } eins_lastpos = eins_position + 10; zwei_lastpos = zwei_position + 10; // Farbe nummer 3 eins_position = body.indexOf(cut1, eins_lastpos) + cut1.length + 1; color = body.substring(eins_position, eins_position+1) ; zwei_position = body.indexOf(cut2,zwei_lastpos)+ cut2.length + 1; level_string = body.substring(zwei_position, body.indexOf(TagEndMarker, zwei_position)); if("C" == color){ level_C = level_string; } if("M" == color){ level_M = level_string; } if("Y" == color){ level_Y = level_string; } if("K" == color){ level_K = level_string; } eins_lastpos = eins_position + 10; zwei_lastpos = zwei_position + 10; // Farbe nummer 4 eins_position = body.indexOf(cut1, eins_lastpos) + cut1.length + 1; color = body.substring(eins_position, eins_position+1) ; zwei_position = body.indexOf(cut2,zwei_lastpos)+ cut2.length + 1; level_string = body.substring(zwei_position, body.indexOf(TagEndMarker, zwei_position)); if("C" == color){ level_C = level_string; } if("M" == color){ level_M = level_string; } if("Y" == color){ level_Y = level_string; } if("p" == color){ level_pK = level_string; } if("K" == color){ level_K = level_string; } eins_lastpos = eins_position + 10; zwei_lastpos = zwei_position + 10; log('Drucker Level C ' + level_C , "info"); log('Drucker Level M ' + level_M , "info"); log('Drucker Level Y ' + level_Y , "info"); log('Drucker Level K ' + level_K , "info"); // der folgende Bereich muss für ggf abweichenden Druckertyp angepasst werden setState(CyanLevel, level_C); setState(MagentaLevel, level_M); setState(YellowLevel, level_Y); setState(BlackLevel, level_K); setState(DruckIP, druckerIP); } else { // if (!error && response.statusCode == 200) { log(error); log('Kein Drucker gefunden'); } }); // end of request } // end of function
Dann mal los.
-
Das Skript läuft soweit aber er findet keinen Drucker. Mal sehen ob ich was finde…
-
Die IP vom Drucker muss stimmen: 192.168.178.31
Der Drucker muss das Vorhaben untersützen. Sprich, er muss auf Eingabe des Links im Browser ein XML zurückschicken:
http://192.168.178.31/DevMgmt/ConsumableConfigDyn.xml
Im Zweifelsfalle das Resultat-XML hier posten. (( CODE-Tags nicht vergessen))
-
Ok dann klappt das wohl mit dem Drucker nicht.
Ergebnis:
404 Not Found
-
Probier mal:
http://192.168.178.31/DevMgmt/ProductConfigDyn.xml ````oder:
http://192.168.178.31/DevMgmt/MediaHandlingDyn.xml
http://192.168.178.31/DevMgmt/ProductStatusDyn.xml