Bei vielen Druckern anderer Hersteller funktioniert das nur mit SNMP. Das kann man aber problemlos in FHEM einbinden, indem auf dem FHEM-Rechner mit apt-get snmp die notwendigen Bibliotheken und Befehle installiert werden.
Dann braucht es ein Skript in /opt/fhem, beispielsweise
#!/bin/bash
PIP=192.168.0.XX
cmd="snmpget -Ovq -v1 -c public"
pages=1.3.6.1.2.1.43.10.2.1.4.1.1
#alert=iso.3.6.1.2.1.43.16.5.1.2.1.1
alert=1.3.6.1.4.1.2435.2.3.9.4.2.1.5.4.5.2.0
alertlevel=1.3.6.1.4.1.2435.2.3.9.4.2.1.5.4.5.6.0
tinte=iso.3.6.1.2.1.43.18.1.1.8.1.1
status=iso.3.6.1.2.1.43.18.1.1.8.1.2
nblack=1.3.6.1.2.1.43.11.1.1.6.1.1
nyellow=1.3.6.1.2.1.43.11.1.1.6.1.2
ncyan=1.3.6.1.2.1.43.11.1.1.6.1.3
nmagenta=1.3.6.1.2.1.43.11.1.1.6.1.4
fblack=1.3.6.1.2.1.43.11.1.1.9.1.1
fyellow=1.3.6.1.2.1.43.11.1.1.9.1.2
fcyan=1.3.6.1.2.1.43.11.1.1.9.1.3
fmagenta=1.3.6.1.2.1.43.11.1.1.9.1.4
#mblack
#myellow
#mcyan
#mmagenta
pages=`$cmd $PIP $pages`
alert=`$cmd $PIP $alert`
alertlevel=`$cmd $PIP $alertlevel`
tinte=`$cmd $PIP $tinte`
status=`$cmd $PIP $status`
#nblack=`$cmd $PIP $nblack`
#nyellow=`$cmd $PIP $nyellow`
#ncyan=`$cmd $PIP $ncyan`
#nmagenta=`$cmd $PIP $nmagenta`
fblack=`$cmd $PIP $fblack`
fyellow=`$cmd $PIP $fyellow`
fcyan=`$cmd $PIP $fcyan`
fmagenta=`$cmd $PIP $fmagenta`
if [ $fblack == -3 ]; then
fblack="OK"
else
if [ $fblack == -2 ]; then
fblack="UNK2"
else
if [ $fblack == -1 ]; then
fblack="UNK1"
else
if [ $fblack == 0 ]; then
fblack="Leer"
fi
fi
fi
fi
if [ $fyellow == -3 ]; then
fyellow="OK"
else
if [ $fyellow == -2 ]; then
fyellow="UNK2"
else
if [ $fyellow == -1 ]; then
fyellow="UNK1"
else
if [ $fyellow == 0 ]; then
fyellow="Leer"
fi
fi
fi
fi
if [ $fcyan == -3 ]; then
fcyan="OK"
else
if [ $fcyan == -2 ]; then
fcyan="UNK2"
else
if [ $fcyan == -1 ]; then
fcyan="UNK1"
else
if [ $fcyan == 0 ]; then
fcyan="Leer"
fi
fi
fi
fi
if [ $fmagenta == -3 ]; then
fmagenta="OK"
else
if [ $fmagenta == -2 ]; then
fmagenta="UNK2"
else
if [ $fmagenta == -1 ]; then
fmagenta="UNK1"
else
if [ $fmagenta == 0 ]; then
fmagenta="Leer"
fi
fi
fi
fi
echo "$status|$pages|$alert|$alertlevel|$tinte|$fcyan|$fmagenta|$fyellow|$fblack"
sowie ein kleines Perl-Programm
##############################################################################
#
# Tintenstrahldrucker
#
##############################################################################
sub getTintenstrahldrucker(){
my $string=`/opt/fhem/getTintenstrahldrucker.sh`;
$string=~s/"//g;
my @data=split('\|',$string);
my $hash = $defs{'Tintenstrahldrucker'};
readingsBeginUpdate($hash);
readingsBulkUpdate($hash,"raw",$string);
readingsBulkUpdate($hash,"status",$data[0]);
readingsBulkUpdate($hash,"pages",$data[1]);
readingsBulkUpdate($hash,"alert",$data[2]);
readingsBulkUpdate($hash,"alertlevel",$data[3]);
readingsBulkUpdate($hash,"ink",$data[4]);
readingsBulkUpdate($hash,"ink-cyan",$data[5]);
readingsBulkUpdate($hash,"ink-magenta",$data[6]);
readingsBulkUpdate($hash,"ink-yellow",$data[7]);
readingsBulkUpdate($hash,"ink-black",$data[8]);
readingsEndUpdate($hash,1);
}
das bei dem dummy "Tintentstrahldrucker" die userReadings befüllt und durch ein kleines "at" zyklisch aufgerufen wird.
Problem dabei: Welche OID (Object Identifier) - das sind die kryptischen Zahlenstrings im Skript - bedeuten WAS ? Da schweigen sich die meisten Hersteller aus, das obige funktioniert mit einem Brother-Tintenstrahldrucker.
LG
pah