Currently, the tile looks like:
However, I am trying/hoping to get the format closer to the other existing tiles. For instance, the Solar tile is next to it:
The data is pulled via the lightning.json API found in the wiki.
Code: Select all
var lightningTable = $('#LightningTable').DataTable({
"paging": false,
"searching": false,
"info": false,
"ordering": false,
"columnDefs": [
{"className": "left", "targets": [0,2]},
{"className": "right", "targets": [1]}
],
"ajax": '../api/extra/lightning.json'
});
Code: Select all
<div class="col-md-4">
<table id="LightningTable" style="width:100%">
<thead>
<tr>
<th> Lightning</th>
<th></th>
<th></th>
</tr>
</thead>
</table>
</div>
At the moment, the tile code is (literally just the building blocks of the other tiles with the extra sensors html in it):
Code: Select all
<div class="lighttile">
<div class="dash-unit">
<span class="dtitle">Lightning</span>
<hr>
<br>
<div class="cont">
<div class="cont">
<table id="LightningTable" style="width:100%">
<thead>
<tr>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
</table>
</div>
</div>
</div>
</div>
I attempted to adjust the API from http://localhost:8998/api/extra/lightning.json, which outputs {"data":[["Distance to last strike","10.6","miles"],["Time of last strike","10/11/2021 8:49:39 AM",""],["Number of strikes today","2",""]]}
to http://localhost:8998/api/tags/process. ... rikesToday, (using WebTags) which outputs {"LightningDistance":"10.6","LightningTime":"8:49 AM","LightningStrikesToday":"2"}
I threw this in a new json file, updated a "working" version of extrasensors.js (this "working" version is called in my test dashboard html, along with the "normal" version), but it did not work for me.
I made a similar dashboard tile for my Airlink data, and that came out fairly well as the table which that API inserts data into is formatted well. This is all getting to the edge of my abilities, thus I am kind of out of ideas on how to get this to work. I know it could all be rewritten into PHP, and I know I could adopt the "that's not what the dashboard is for, use the website" mantra as well. But, I want to try and get this working and "cleaned up", and I also believe there has to be at least one other user out there who wants to tinker around with the dashboard layout a bit and get other tiles such as lightning.
As always, let me know if you have any suggestions to help.