Webseite/Webserver auf Verfügbarkeit prüfen

Begonnen von Meister_Petz, 10 Januar 2018, 09:44:57

Vorheriges Thema - Nächstes Thema

Meister_Petz

#15
Sodala, also nun so:
define CHECKSERVER HTTPMOD http://www.webserver.de/index.html 300
attr CHECKSERVER userattr reading01MaxAge reading01Name reading01Regex
attr CHECKSERVER userReadings Presence
attr CHECKSERVER reading01MaxAge 10
attr CHECKSERVER reading01Name header
attr CHECKSERVER reading01Regex (?s)(.*?)/
attr CHECKSERVER userReadings Presence {return (ReadingsVal($NAME,"header","") eq "HTTP") ? "ONLINE" : "OFFLINE";;}


das hab ich noch eingefügt, damit Nachrichten nur kommen, wenn sich was ändert, oder geht das auch einfacher?
attr CHECKSERVER event-on-change-reading Presence

riker1

#16
Hallo

leider habe ich hier ein Problem.

2019.11.13 07:50:34.361 4 : P_ESP_TOR_WEB: GetUpdate called (update)
2019.11.13 07:50:34.365 4 : P_ESP_TOR_WEB: update timer modified: will call GetUpdate in 50.0 seconds at 2019-11-13 07:51:24
2019.11.13 07:50:34.366 4 : P_ESP_TOR_WEB: AddToQueue adds update, initial queue len: 0
2019.11.13 07:50:34.366 5 : P_ESP_TOR_WEB: AddToQueue adds type update to URL http://192.168.0.143, no data, no headers, retry 0
2019.11.13 07:50:34.367 5 : P_ESP_TOR_WEB: HandleSendQueue called, qlen = 1
2019.11.13 07:50:34.368 4 : P_ESP_TOR_WEB: HandleSendQueue sends request type update to URL http://192.168.0.143, No Data, No Header timeout 2
2019.11.13 07:50:34.368 5 : HttpUtils url=http://192.168.0.143
2019.11.13 07:50:34.369 3 : P_ESP_TOR_WEB: Read callback: Error: http://192.168.0.143: malformed or unsupported URL
2019.11.13 07:50:34.369 4 : P_ESP_TOR_WEB: Read callback: request type was update retry 0, body empty
2019.11.13 07:50:34.369 5 : P_ESP_TOR_WEB: ExtractSid called, context reading, num
2019.11.13 07:50:34.369 5 : P_ESP_TOR_WEB: MaxAge: check reading Presence
2019.11.13 07:50:34.369 5 : P_ESP_TOR_WEB: MaxAge: reading Presence doesn't come from a -Name attr -> skipping
2019.11.13 07:50:34.370 4 : P_ESP_TOR_WEB: CheckAuth decided no authentication required



defmod P_ESP_TOR_WEB HTTPMOD http://192.168.0.143 50
attr P_ESP_TOR_WEB userattr reading01MaxAge reading01Name reading01Regex
attr P_ESP_TOR_WEB oldreadings state
attr P_ESP_TOR_WEB reading01MaxAge 10
attr P_ESP_TOR_WEB reading01Name header
attr P_ESP_TOR_WEB reading01Regex (?s)(.*?)/
attr P_ESP_TOR_WEB userReadings Presence {return (ReadingsVal($NAME,"header","") =~ "HTTP") ? "ONLINE" : "OFFLINE";;}


Wie kann ich denn die website Antwort überprüfen?



curl -ivs http://192.168.0.143
* Rebuilt URL to: http://192.168.0.143/
*   Trying 192.168.0.143...
* TCP_NODELAY set
* Connected to 192.168.0.143 (192.168.0.143) port 80 (#0)
> GET / HTTP/1.1
> Host: 192.168.0.143
> User-Agent: curl/7.58.0
> Accept: */*
>
< HTTP/1.1 302
HTTP/1.1 302
< Location: /login
Location: /login
* Connection #0 to host 192.168.0.143 left intact



Danke VG T
FHEM    5.26.1 Ubuntu 18, FHEM    5.26.1 RPI 3 , Actoren: IT ,Tasmota, ESPEasy,
MAX CUBE, MAX HT, MAX WT, Selbstbau nanoCULs, FS 20,Tasmota, Homematic, FTK, SW. DIM, Smoke,KODI,Squeezebox