Admin template- Adding something similar to ma-ui-user-datatime
-
Hello,
I have a 2 part question -
-
How would I go about displaying weather (OAT) information in the admin template similar to the existing date/time display? This would display values returned from API using a predefined location.
-
When there are many remote locations, could the device be "tagged" with a location that would drive the display to show the local conditions of the device being viewed?
Thank you.
-
-
@Wingnut2-0
You can put any HTML that you wish into the adminTemplate. There are many weather websites which provide HTML snippets which you can paste into your pages. Or you could write your own AngularJS component to get the data from the API and present it however you like.Another approach to this would be to setup a Mango HTTP Retriever data source which would fetch values from a weather API into a Mango data point. You could then use the standard
<ma-point-value>
component to display a temperature on the page for example.Regarding #2 you could store the location in the JSON store.
P.S. I don't know what OAT is.
-
I've written something basic that displays the forecast from wUnderground (Weather Underground).
-
Are you calling the API? if so, I don't see why you cannot utilise the ma-date elements combined with the ng-change to fire a function and perform a $http GET with the date parameters to collect your data. My only concern is API calls with this. one - it can cost a fair bit, two - can be some delay as you wait for the data to come through, parse said data and display on the screen in the format you like.
-
If you have devices that are linked to specific locations which will not change, why not use a virtual datasource and map them accordingly to the respective device. Simply then map that back through in code to reveal the corresponding data for that device location. Or use Jared's JSON store suggestion.
OAT? Oat mountain?
Hope this helps somewhat....
3) Good Luck. -
-
Here's another thread where I helped someone get a AngularJS weather widget working -
https://forum.infiniteautomation.com/topic/2844/how-to-use-json-receiver-data-point/2