Skip to end of metadata
Go to start of metadata
Autor
Logo

icon_64.png

Status

UNSTABLE

Version1.0
Min. LB Version

LB 2.0.0 (Node.js is required)

Downloadhttps://github.com/mjesun/loxberry-simple-weather-service/releases/download/master/master.zip
ZweckProvide a simple way of getting weather data into the Loxone UI with barely zero configuration
LanguagesEN
Diskussion
 Version History...

Version history and releases can be found in Github: https://github.com/mjesun/loxberry-simple-weather-service

Content



Plugin

The goal of the plugin is to provide weather data to the Loxone Miniserver, by using the data sent by it. It is a 1:1 replacement of the Loxone Service. It does no more, and no less. The coordinates of the place used to retrieve data, and the altitude is obtained from the request the Loxone Miniserver does to the weather service, and the data is returned in real-time. The Loxone Miniserver checks weather data once an hour, so pulling data more often would not change much. Also, free weather data providers (like weatherbit.io, used in this plugin), will not refresh the data more often than this, unless you pay them (and for that, you could acquire the Loxone Weather Service).

This plugin is heavily inspired in Weather4Loxone, which accomplishes more functions than this one, like creating static HTML pages with additional data, or letting you push data back through UDP to the Miniserver. The motivation for creating this plugin is to bring its configuration to the minimum required, and provide a server that runs in the LoxBerry as opposed to a cronjob approach. This ensures that the most up to date weather data is provided to the Loxone Miniserver by the time it is requested by it. It's also worth noting that this project is also a proof-of-concept to develop a plugin that uses a Node.js service under the hood. Considering that JavaScript is an extremely popular language, it seemed interesting to test it as a viable alternative.

Download

Installation & configuration in Loxone Config

  1. To make this work, you will first need to add the excellent DNSmasq plugin. Once added, you will need to add weather.loxone.com to the list of hosts, pointing to the LoxBerry API; something similar to

       weather.loxone.com 192.168.1.2

    where 192.168.1.2 is the IP address of the LoxBerry. You will need to restart it later.

  2. You will have to configure the DNS of the Loxone Miniserver to point to the LoxBerry (the same IP address used in the previous step). You can do that by heading to the network preferences of the miniserver. More information can be found on the Loxone KB.

  3. An API key from weatherbit.io is required. You will need to register and paste it in the configuration panel.

Troubleshoot

In order to do multiple tests, you can always write a new configuration to the Loxone Miniserver. The Miniserver restarts every time you do so, and will immediately try acquiring weather information after its restart (probably because the information only lives in RAM). You can use this to trigger multiple tests.

  1. Make sure the plugin is working. You can do that by heading to http://192.168.1.2:6066/raw/?coord=13.8405,48.5998&asl=1000, where 192.168.1.2 is the IP address of the LoxBerry. You should then see the data obtained in a nice JSON format. If not, make sure the service is active. Service should start at boot time, so restarting the LoxBerry should suffice to bring it back. If the API key is invalid it will tell you so.

  2. Make sure the DNS configuration in DNSmasq is working. You can issue a query to it from the terminal by typing: dig +short weather.loxone.com @192.168.1.2, where 192.168.1.2 is the IP address of the LoxBerry. You should get back exactly the same IP. If not, make sure you have properly configured DNSmasq. You can check the steps above and/or refer to the DNSmasq plugin page.

  3. Make sure the Loxone Miniserver is using as DNS server the LoxBerry. This can be checked by opening the network tab in the configuration panel when clicking on the Miniserver. Note: I have found myself that for a while, after changing the DNS and restarting the miniserver, the UI still showed the default value (the one provided by my router), but internally the new DNS server was being used.

Roadmap

  • Write better documentation, both in this page, the LoxForum, and the GitHub project. Provide an icon.
  • Automate releases, make auto-upgrades work.
  • Translate the plugin to other languages.
  • Make the configuration page better.
  • Make the system to include weather providers fully agnostic and self-service.
  • Include tests with different weather data, timezones, etc, to ensure the response is the expected one.
  • Remove the need of the DNSmasq plugin (not sure about this one).

8 Comments

  1. Hey Miguel!

    Cool idea! I have also included Weatherbit.io in Weather4Lox, but figured out that it does not provide enough hourly forecast data for the Loxone Weather Emulator. As far as I know Weatherbit.io provides data for the next 48h, while Loxone Weather displays 72h of data. How did you deal this in your plugin?

    Regards, Michael 

    1. Michael Schlenstedt while they say the do not provide it, it looks like the endpoint works - at least for me (big grin) Maybe you can confirm? What I observed though is that the Loxone Miniserver requires at least 72 hours to properly show its visualization. By pushing the last 48 hours, you will get "Today" in the last day of the summary:

      In order to "fool" the Loxone Miniserver, I provide a combination of the current weather (through their /current metadata), followed by hourly forecast, then followed by daily forecast, targeted at mid-day (because I provide as temperature the maximum one). The weather looks more or less like this then:

      11.04.2020;Sat;13; 17.8; 17.8; 11;188;  0; 68; 68; 68;  0.0;  0;0.0;1022; 74;     0; 7; 662; << CURRENT
      11.04.2020;Sat;14; 15.9; 15.9; 11;193; 16;  0; 68;  0;  0.0;  0;0.0;1022; 72;     0; 7; 595; << HOURLY
      11.04.2020;Sat;15; 16.1; 16.1; 12;199; 17;  0; 63;  0;  0.0;  0;0.0;1022; 67;     0; 7; 506;
      11.04.2020;Sat;16; 16.2; 16.2; 12;203; 17;  0; 53;  0;  0.0;  0;0.0;1022; 66;     0; 7; 381;
      ·
      · MORE DAYS...
      ·
      13.04.2020;Mon;12; 16.5; 16.5; 30; 51; 41; 10;100;100; 0.1; 10;0.0;1010; 73; 0;19; 222; 13.04.2020;Mon;13; 16.7; 16.7; 28; 50; 43; 51;100; 50; 0.0; 0;0.0;1010; 73; 0;19; 213; 13.04.2020;Mon;14; 16.5; 16.5; 35; 55; 48; 56; 99;100; 0.0; 0;0.0;1010; 76; 0;19; 188; 14.04.2020;Tue;10; 15.8; 18.3; 11; 89; 35; 76; 11; 8; 8.9; 90;0.0;1010; 78; 0;31; 0; << DAILY 15.04.2020;Wed;10; 15.5; 17.7; 10; 93; 25; 40; 18; 56; 0.3; 20;0.0;1014; 79; 0;19; 0; 16.04.2020;Thu;10; 17.0; 21.2; 6;240; 15; 8; 2; 28; 0.0; 0;0.0;1017; 73; 0; 7; 0; ·
      · MORE DAYS...
      ·

      That seems to do the trick!

  2. Just have seen that Weatherbit.io provides no hourly data at all in the free accounts?!

    1. Maybe I'm in some sort of trial? With my API key I can obtain hourly forecast data (sad)

      1. Yeah, that seems to be the thing (sad) :

  3. Yes, that's what I also got: trial period and then no hourly forecast at all (sad)  For me best option now is OpenWeatherMap. They offer 48h hourly forecast and 120h 3-hourly forecast data. I interpolate the 3-hourly data to have entries for every hour. That works pretty fine: https://github.com/mschlenstedt/LoxBerry-Plugin-Weather4Lox/blob/c8a742bd377841437f77d399a2a9f06db45bb51a/bin/grabber_openweather.pl#L761 

    1. Are you using for that their One Call API? It's the only one it seems to provide hourly data: https://openweathermap.org/api/one-call-api.

      Regarding the 120h interpolation I think you do not need to interpolate it, it'd be enough to push it on a three-hour basis (in my case I'm doing this with weatherbit.io on a 24h basis based on their daily forecast). From what I've observed, the Loxone Miniserver does automatic bisection to get the current data from the closest (left) data entry (meaning the older, but nearest to the current time provided).

      1. For the120h 3-hourly forecast, you have to use the forecast api and add &cnt=40 (Not documented). Then you get the 3hourly forecast. For the first 48h in 1-hourly I use the one call api.

        I have never tested to put 3-hourly data directly to the Miniserver. That would make things much easier. Thanks for the trick!