From f28b9c80d0f679e72d0b462ff601a4675f152f3a Mon Sep 17 00:00:00 2001
From: Beta-User <>
Date: Sat, 4 May 2019 11:51:35 +0000
Subject: [PATCH] httpmod.template: add Notfallapotheke and Pihole, some
extensions wrt. printers
git-svn-id: https://svn.fhem.de/fhem/trunk@19324 2b470e98-0d58-463d-a4d8-8e2adae1ed80
---
fhem/FHEM/lib/AttrTemplate/httpmod.template | 147 ++++++++++++++++++--
1 file changed, 132 insertions(+), 15 deletions(-)
diff --git a/fhem/FHEM/lib/AttrTemplate/httpmod.template b/fhem/FHEM/lib/AttrTemplate/httpmod.template
index e7468afc3..89eef132b 100644
--- a/fhem/FHEM/lib/AttrTemplate/httpmod.template
+++ b/fhem/FHEM/lib/AttrTemplate/httpmod.template
@@ -145,6 +145,57 @@ attr DEVICE set01Header06 Content-Type: application/x-www-form-urlencoded
attr DEVICE set01NoArg 1
attr DEVICE model A_02c_homebridge_videodoorbell
+# Pihole Statistics, Website: https://wolf-u.li/5987/einbindung-der-pihole-statistiken-in-fhem/
+name:A_02e_pihole_statistics
+filter:TYPE=HTTPMOD
+desc: Get Statistics from your pihole instance.
Define a HTTPMOD device like
define DEVICE HTTPMOD http://192.168.133.7/admin/api.php 300
Change IP to your needs
Source: Website
+attr DEVICE userattr getURL
+attr DEVICE extractAllJSON 1
+attr DEVICE getURL http://dns/admin/api.php
+attr DEVICE stateFormat DNS Anfragen: dns_queries_today
Geblockte Seiten: ads_blocked_today (ads_blocked_today_formatted %)
+attr DEVICE userReadings ads_blocked_today_formatted {round(ReadingsNum($name,"ads_percentage_today",0),0)}
+
+# Pharmacy Emergency Service Germany, Forum: https://forum.fhem.de/index.php?topic=87234.0
+name:A_02f_pharmacy_emergency_service_germany
+filter:TYPE=HTTPMOD
+desc: Gets the current emergency service of a pharmacy closeby your postal code
Define a HTTPMOD device like
define DEVICE HTTPMOD http://apothekenfinder.mobi/interface/json.php?device=web&source=not&search=1337 0
Change the postalcode (1337 in this example) to yours
Define a HTTPMOD device like
defmod DEVICE HTTPMOD http://192.168.5.43/DevMgmt/ProductConfigDyn.xml 3600
Change IP to your needs
Source: Forum
-attr DEVICE userattr reading01Name reading01XPath-Strict reading02Name reading02XPath-Strict reading03Name reading03XPath-Strict reading04Name reading04XPath-Strict
+desc: Get cartridge states of your HP printer.
Define a HTTPMOD device like
defmod DEVICE HTTPMOD http://192.168.5.43/DevMgmt/ConsumableConfigDyn.xml 3600
Change IP to your needs
Source: Forum
+attr DEVICE userattr reading01Name reading01XPath-Strict reading02Name reading02XPath-Strict reading03Name reading03XPath-Strict reading04Name reading04XPath-Strict reading05Name reading05XPath-Strict reading06Name reading06XPath-Strict$
attr DEVICE httpVersion 1.1
attr DEVICE reading01Name Cyan
attr DEVICE reading01XPath-Strict //ccdyn:ConsumableInfo[2]/dd:ConsumablePercentageLevelRemaining/text()
@@ -184,32 +235,62 @@ attr DEVICE reading03Name Yellow
attr DEVICE reading03XPath-Strict //ccdyn:ConsumableInfo[4]/dd:ConsumablePercentageLevelRemaining/text()
attr DEVICE reading04Name Black
attr DEVICE reading04XPath-Strict //ccdyn:ConsumableInfo[1]/dd:ConsumablePercentageLevelRemaining/text()
+attr DEVICE reading05Name CyanCatridgeModel
+attr DEVICE reading05XPath-Strict //ccdyn:ConsumableInfo[3]/dd:ConsumableSelectibilityNumber/text()
+attr DEVICE reading06Name MagentaCatridgeModel
+attr DEVICE reading06XPath-Strict //ccdyn:ConsumableInfo[2]/dd:ConsumableSelectibilityNumber/text()
+attr DEVICE reading07Name YellowCatridgeModel
+attr DEVICE reading07XPath-Strict //ccdyn:ConsumableInfo[4]/dd:ConsumableSelectibilityNumber/text()
+attr DEVICE reading08Name BlackCatridgeModel
+attr DEVICE reading08XPath-Strict //ccdyn:ConsumableInfo[5]/dd:ConsumableSelectibilityNumber/text()
attr DEVICE stateFormat C: Cyan% M: Magenta% Y: Yellow% B: Black%
attr DEVICE model B_01a_hp_printer_cartridge_status
# Printer statistics
name:B_01a_hp_printer_statistics
filter:TYPE=HTTPMOD
-desc: Get cartridge states of your hp printer.
Define a HTTPMOD device like
defmod DEVICE HTTPMOD http://192.168.5.43/DevMgmt/ProductUsageDyn.xml 3600
Change IP to your needs
Source: Forum
-attr DEVICE userattr reading01Name reading01XPath-Strict reading02Name reading02XPath-Strict reading03Name reading03XPath-Strict reading04Name reading04XPath-Strict reading05Name reading05XPath-Strict reading06Name reading06XPath-Strict reading07Name reading07XPath-Strict reading08Name reading08XPath-Strict
+desc: Gets various statistics from your HP printer.
Define a HTTPMOD device like
defmod DEVICE HTTPMOD http://192.168.5.43/DevMgmt/ProductUsageDyn.xml 3600
Change IP to your needs
Source: Forum
+attr DEVICE userattr reading01Name reading01XPath-Strict reading02Name reading02XPath-Strict reading03Name reading03XPath-Strict reading04Name reading04XPath-Strict reading05Name reading05XPath-Strict reading06Name reading06XPath-Strict reading07Name reading07XPath-Strict reading08Name reading08XPath-Strict reading09Name reading09XPath-Strict reading10Name reading10XPath-Strict reading11Name reading11XPath-Strict reading20Name reading20XPath-Strict reading30Name reading30XPath-Strict reading40Name reading40XPath-Strict reading41Name reading41XPath-Strict reading50Name reading50XPath-Strict reading51Name reading51XPath-Strict
attr DEVICE httpVersion 1.1
-attr DEVICE reading01Name Pages_Total
+attr DEVICE reading01Name Printer_Pages_Total
attr DEVICE reading01XPath-Strict //pudyn:PrinterSubunit/dd:TotalImpressions/text()
-attr DEVICE reading02Name Pages_Monochrome
+attr DEVICE reading02Name Printer_Pages_Monochrome
attr DEVICE reading02XPath-Strict //pudyn:PrinterSubunit/dd:MonochromeImpressions/text()
-attr DEVICE reading03Name Pages_Color
+attr DEVICE reading03Name Printer_Pages_Color
attr DEVICE reading03XPath-Strict //pudyn:PrinterSubunit/dd:ColorImpressions/text()
-attr DEVICE reading04Name Pages_Duplex
+attr DEVICE reading04Name Printer_Pages_Duplex
attr DEVICE reading04XPath-Strict //pudyn:PrinterSubunit/dd:DuplexSheets/text()
-attr DEVICE reading05Name Jam_Events
+attr DEVICE reading05Name Printer_Jam_Events
attr DEVICE reading05XPath-Strict //pudyn:PrinterSubunit/dd:JamEvents/text()
-attr DEVICE reading06Name Mispick_Events
+attr DEVICE reading06Name Printer_Mispick_Events
attr DEVICE reading06XPath-Strict //pudyn:PrinterSubunit/dd:MispickEvents/text()
-attr DEVICE reading07Name ADF_Image_Scans
-attr DEVICE reading07XPath-Strict //pudyn:ScannerEngineSubunit/dd:AdfImages/text()
-attr DEVICE reading08Name Flatbed_Image_Scans
-attr DEVICE reading08XPath-Strict //pudyn:ScannerEngineSubunit/dd:FlatbedImages/text()
-attr DEVICE stateFormat Total: Pages_Total Monochrome: Pages_Monochrome Color: Pages_Color
+attr DEVICE reading10Name Scanner_Scans_Total
+attr DEVICE reading10XPath-Strict //pudyn:ScannerEngineSubunit/dd:ScanImages/text()
+attr DEVICE reading11Name Scanner_Scans_ADF_Image
+attr DEVICE reading11XPath-Strict //pudyn:ScannerEngineSubunit/dd:AdfImages/text()
+attr DEVICE reading12Name Scanner_Scans_Flatbed_Image
+attr DEVICE reading12XPath-Strict //pudyn:ScannerEngineSubunit/dd:FlatbedImages/text()
+attr DEVICE reading13Name Scanner_Jam_Events
+attr DEVICE reading13XPath-Strict //pudyn:ScannerEngineSubunit/dd:JamEvents/text()
+attr DEVICE reading14Name Scanner_Mispick_Events
+attr DEVICE reading14XPath-Strict //pudyn:ScannerEngineSubunit/dd:MispickEvents/text()
+attr DEVICE reading20Name InkMagentaPagesRemaining
+attr DEVICE reading20XPath-Strict //pudyn:Consumable[dd:MarkerColor='Magenta']/dd:EstimatedPagesRemaining/text()
+attr DEVICE reading21Name InkMagentaPercentRemaining
+attr DEVICE reading21XPath-Strict //pudyn:Consumable[dd:MarkerColor='Magenta']/dd:ConsumableRawPercentageLevelRemaining/text()
+attr DEVICE reading30Name InkCyanPagesRemaining
+attr DEVICE reading30XPath-Strict //pudyn:Consumable[dd:MarkerColor='Cyan']/dd:EstimatedPagesRemaining/text()
+attr DEVICE reading31Name InkCyanPercentRemaining
+attr DEVICE reading31XPath-Strict //pudyn:Consumable[dd:MarkerColor='Cyan']/dd:ConsumableRawPercentageLevelRemaining/text()
+attr DEVICE reading40Name InkYellowPagesRemaining
+attr DEVICE reading40XPath-Strict //pudyn:Consumable[dd:MarkerColor='Yellow']/dd:EstimatedPagesRemaining/text()
+attr DEVICE reading41Name InkYellowPercentRemaining
+attr DEVICE reading41XPath-Strict //pudyn:Consumable[dd:MarkerColor='Yellow']/dd:ConsumableRawPercentageLevelRemaining/text()
+attr DEVICE reading50Name InkBlackPagesRemaining
+attr DEVICE reading50XPath-Strict //pudyn:Consumable[dd:MarkerColor='Black']/dd:EstimatedPagesRemaining/text()
+attr DEVICE reading51Name InkBlackPercentRemaining
+attr DEVICE reading51XPath-Strict //pudyn:Consumable[dd:MarkerColor='Black']/dd:ConsumableRawPercentageLevelRemaining/text()
+attr DEVICE stateFormat Total: Printer_Pages_Total Monochrome: Printer_Pages_Monochrome Color: Printer_Pages_Color
attr DEVICE model B_01a_hp_printer_statistics
# Printer status
@@ -270,6 +351,42 @@ attr DEVICE reading05RegOpt gm
attr DEVICE reading05Regex