FHEM Forum

FHEM => Sonstiges => Thema gestartet von: juergen012 am 02 Januar 2026, 11:39:16

Titel: IP Lokalisation
Beitrag von: juergen012 am 02 Januar 2026, 11:39:16
Hallo!
Um die Lokalisation der IP-Adresse anzuzeigen, hatte ich folgenden Code in Fhem:

define IP_Localisation HTTPMOD http://xml.utrace.de/?query=%%URL%% 1200
attr IP_Localisation DbLogExclude .*
attr IP_Localisation enableControlSet 1
attr IP_Localisation reading01Name IP_Country
attr IP_Localisation reading01Regex <countrycode>(.*?)</countrycode>
attr IP_Localisation replacement01Mode expression
attr IP_Localisation replacement01Regex %%URL%%
attr IP_Localisation replacement01Value ReadingsVal("myIP", "IP", "")
attr IP_Localisation room HTTPMOD
attr IP_Localisation showBody 1
attr IP_Localisation stateFormat {ReadingsVal("myIP", "IP", "")}
attr IP_Localisation useSetExtensions 1
attr IP_Localisation userReadings IP_HTTP_BODY { InternalVal('IP_Localisation','httpbody','') }
attr IP_Localisation verbose 2

Das funktioniert leider nicht mehr

Jetzt gibt es von Utrace eine API:

https://utrace.me/api
Ich habe versucht den Code in Fhem einzubinden. Leider ist mir das , mangels Kenntnissen, nicht gelungen.
Eigentlich benötige ich nur das Land (D).
curl -L -H "Accept: application/json" https://utrace.me/?query=
{

Vielleicht erbarmt sich ein Wissender und hilft mir..
DANKE
Jürgen K.
Titel: Aw: IP Lokalisation
Beitrag von: betateilchen am 02 Januar 2026, 11:47:00
defmod iploc JsonMod system://curl -L -H "Accept: application/json" https://utrace.me/?query=<ip-adresse-angeben>
attr iploc readingList single(jsonPath('$.country'),'country','?')\
single(jsonPath('$.countryCode'),'countryCode','?')

Titel: Aw: IP Lokalisation
Beitrag von: juergen012 am 02 Januar 2026, 12:56:29
PRIMA !! Vielen Dank !!
Gruß
Jürgen K.