Ecowitt WiFi Gateway driver for Hubitat Elevation
- LAN comunication only, no cloud/weather service needed.
- One Hubitat device for each Ecowitt sensor for easy dashboard tiles and RM rules handling.
- Ability to combine outdoor sensors such as the WH32, WH40 and WH68 into a virtual PWS (Personal Weather Station) for rich weather tiles.
- Ability to resynchronize and delete orphaned children at runtime when sensors un unregistered fro the station.
- On-the-fly Imperial <-> Metric conversion.
- Accurate sea level pressure correction using altitude and temperature.
- Accurate AQI (Air Quality Index) calculation from PM2.5 density.
- Tile HTML templates, which allows endless tiles customization, including displaying multiple attributes in a single tile.
-
Make sure all your sensors are properly registered:
-
Setup a local/customized weather service as follow (replacing hostname/IP with your own):
-
If the Ecowitt Gateway has been setup correctly, every 5 minutes, you should see the following warning in the Hubitat system log:
That's because this driver has not been installed yet and the hub has nowhere to forward the gateway data to.
-
In "Drivers Code" add the Ecowitt WiFi Gateway and RF Sensor drivers:
-
In "Devices" add a new "Ecowitt WiFi Gateway" virtual device and click "Save Device":
-
Enter the Gateway MAC or IP address, in any legal form (MAC addresses are safer because they never change, but they don't work across VLANs) and wheather you want to combine outdoor sensors into a PWS (which will allow you to create HTML weather tiles combining attributes from all sensor members). Finally "Save Preferences":
-
That should be all. The first time Hubitat receives data from the Gateway, the driver will automatically create child devices for all the present (and supported) sensors (depending on the frequency you setup your Gateway to send data, this may take a few minutes):
HTML templates are a powerful way to gang-up multiple Ecowitt sensor attributes in a single Hubitat dashboard tile with endless customization. The following is a basic example of what you can achieve with a simple HTML template:
Each sensor can specify up to 5 templates which will allow the creation of 5 customized dashboard tiles.
Templates are pure HTML code with embedded servlets, which are nothing but sensor attributes surrounded by a ${} expression. For example the following two templates are used to create the tiles in the image above:
<i class="ewi-temperature"></i> ${temperature} °F<br><i class="ewi-humidity"></i> ${humidity} %<br><i class="ewi-pressure"></i> ${pressure} inHg
<i class="ewi-air" style="color:#${aqiColor}"></i> ${aqiDanger}<br>PM2.5: ${pm25} µg/m³<br>AQI: ${aqi}
NB:
- When you enter the template in the device preferences DO NOT surround it with quotation marks.
- The maximum lenght of a template (imposed by the Hubitat GUI) is 256 characters. If you enter a longer template, Hubitat will return a "Server 500 error".
- For each specific sensor template, ONLY use the attributes you see displayed on the upper-right corner of the sensor preferences (those highlighted in red in the image below).
- For obvious reasons, in a template, NEVER use the expression ${html}. Or your hub will enter a wormhole and resurface in a parallel universe made only of antimatter ;-)
-
In "Hubitat -> Devices" select an Ecowitt sensor (not the gateway) you'd like to "templetize".
Then In "Preferences -> HTML Tile Template" enter, either your template directly or up to five (comma separated) pre-made template IDs which the driver will automatically retrieve from the template repository.
Finally click "Save Preferences".
NB: if you enter a template directly, make sure it's 256 character or shorter. If you enter a list of templates make sure it's 5 IDs or shorter without duplicates.
-
In the Hubitat dashboard you intend to use to create HTML template tiles, click "Cog icon -> Advanced -> CSS" and add the following line to the beginning of the CSS file:
@import url("https://padus.github.io/ecowitt/ecowitt.css");
Click "Save CSS"
-
Now, in the same dashboard, add a new tile, on the left select the Ecowitt sensor, in the center select "Attribute" and on the right select the "html" attribute
Tip: you can remove the tile "html" title by entering the following in the dashboard CSS (assuming the tile ID is 66):
#tile-66 .tile-secondary { visibility: hidden; }
Using a small true-type font with only specific weather icons, it is possible to add dynamic icons to the Ecowitt dashboard tiles.
For example, using the driver windCompass attribute, the following is the syntax to obtain a 360� wind icon which always points to the current wind direction as reported by the Ecowitt gateway:
<i class="ewi-wind${windCompass}"></i>
These icons are in reality text, so of course all the standard CSS font styling, shuch as size, color etc. applies as well.
This is a complete list of all the icons available. Just access the page source html to see all the defined icon classes, and how to use them.
To facilitate reusing and sharing templates, the Ecowitt driver uses a central JSON repository where all the templates can be accessed by ID. This is a complete up-to-date list of all the templates available in the repository.
Templates in the repository are measurement system agnostic and will display the correct unit system based on the parent selection.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.