tkgafs
(Tim)
1
Is there any way to get a access to the page count for my samsung m3820nd printer
the value is returned in the toner_black field
if I call http://Printers_IP_Address/sws/app/information/home/home.json i can see this block
toner_black: {
opt: 1,
remaining: 84,
cnt: 898,
newError: ""
},
but the sensor.samsung_sl_m3820nd_toner_black only seems to have a value for the remaining field
if the integration can not provide this value is there a way to call and parse the json myself ?
any help gratefully received
tkgafs
(Tim)
2
If anyone is interested the info can be extracted from the following url
http://Printer_IP_Add/sws/app/information/supplies/supplies.json
this script will locate the values and write them to a file PageCount.txt formatted as CurrentCartridgePages!TotalPages
The file is monitored by a File sensor allowing the state to be manipulated as required
#!/bin/sh
FILE=supplies.json
TEMPFILE=Workfile
rm -f $FILE
rm -f $TEMPFILE
/usr/bin/wget -q http://Printer_IP_Add/sws/app/information/supplies/$FILE
tr -d '\r' < $FILE | tr -d '\t' | tr -d ':' | tr -d ',' > $TEMPFILE
TONERPAGECOUNT=`grep cnt $TEMPFILE | head -1 | sed 's/cnt //'`
TOTALPAGECOUNT=`grep fuser_kit $TEMPFILE | head -1 | sed 's/fuser_kit *//'`
echo "$TONERPAGECOUNT!$TOTALPAGECOUNT" > PageCount.txt
tkgafs
(Tim)
3
Ive just discovered this is actually available in the attributes of the sensor
- platform: template
sensors:
toner_pagecount:
friendly_name: "Toner Page Count"
entity_id: sensor.samsung_sl_m3820nd_toner_black
value_template: "{{ state_attr('sensor.samsung_sl_m3820nd_toner_black', 'cnt') }}"
now just need to find a way to access the total pages printed by the fuser in the printer