Automatic Location Detection and Timezone
Content languageEnglish
Description
The location data is determined by querying IPAPI based on the current public IP address. This allows identification of the current country and the corresponding UTC time offset:
https://ipapi.co/api/#introduction
Basics Using a PicoC script, the system automatically determines the respective country based on the detected telephone calling code. In addition, the UTC offset is provided. The retrieved data can be used for further logic, status displays, and visualizations within Loxone Config.The output language of the country name is German and can be translated into the desired language either manually within the script or by using an LLM.
For example: float code; int v; while(TRUE) { code = getinput(0); v = (int)code; if(v==43) setoutputtext(0,"Österreich"); else if(v==49) setoutputtext(0,"Deutschland"); else if(v==41) setoutputtext(0,"Schweiz"); else setoutputtext(0,"Land unbekannt"); sleep(1000); }
IPAPI provides up to 30,000 requests per month for free. Accordingly, the polling interval must be configured to stay within this limit. This corresponds to approximately 1,000 requests per day or about 40 requests per hour. The script is designed to perform one request per hour, ensuring reliable operation within the free usage tier.
Disclaimer Determining the location based on the public IP address is inherently imprecise and may differ significantly from the actual physical location. The displayed data is intended solely for general orientation and overview. It is not suitable for precise location determination or for use in safety-critical applications. The template is designed for easy commissioning and works plug and play. No additional configuration is required.
The following hardware and software versions were used for creation and testing: Loxone Config 17.0.3.31, Miniserver Gen2 (Firmware 17.0.3.31),
https://ipapi.co/api/#introduction (29.04.2026)
Inputs and outputs · 2
| Name | Type | Command | Unit |
|---|---|---|---|
| Zeit Offset | VirtualInHttp | utc_offset\s4\v | <v.1> |
| Ländervorwahl | VirtualInHttp | country_calling_code\s4\v | <v.1> |
Ratings and comments
No ratings or comments yet.
Log in to rate, comment or ask a question. Log in