No announcement yet.

Questions regarding Maps Rotation and stock XML templates

  • Filter
  • Time
  • Show
Clear All
new posts

    Here is my solution.

    I retrieve the files using two homeseer events shown in the file below - one for daily updates and one for multiple refreshes during the day. I use imagemagick's mogrify to batch change and resize and convert from jpg to png files. - this is the static part. The -resize 900x makes the file 900 pixels wide and scales the vertical proportionately. -resize x900 would resize vertical pixels and scale horizontal proportionally. Both keep the aspect ratio.

    Click image for larger version

Name:	Screenshot from 2019-12-22 20-23-47.png
Views:	101
Size:	205.8 KB
ID:	1349069

    I set up HSTouch with an image element and set the URLNormal property to the location of the file that I wanted it to read. This is the file I use as a working file to hold the current map to be displayed.

    Click image for larger version

Name:	Screenshot from 2019-12-22 20-33-52.png
Views:	34
Size:	585.7 KB
ID:	1349070

    I have the two scroll buttons do two things to traverse the images. I call an event and I simulate a release on the image element - this forces the update.

    Click image for larger version

Name:	Screenshot from 2019-12-22 20-38-32.png
Views:	34
Size:	210.0 KB
ID:	1349071

    I have an increment and decrement event that do the same things only subtract instead of add. Below is the increment event. I created a counter to keep track of which picture is displayed.

    Click image for larger version

Name:	Screenshot from 2019-12-22 20-42-19.png
Views:	32
Size:	31.8 KB
ID:	1349072

    I wrote the following script to cycle through the pictures.

    --------------------------------------------------- Start of .vb script
    '12/21/2019 ScrollPictures.vb
    'Script to scroll through static pictures and write file to unique filename.

    IMPORTS System.IO
    IMPORTS System.Net
    IMPORTS System.Threading

    Sub Main(ByVal Parm As String) 'There are 0 parameters

    Dim sPath, sDisplayFile, Counter, Source, Destination As String
    Dim sFile(6) As String
    Dim dCounter As Double
    Dim iCnt, iMax, iIncCnt As Integer

    iMax = 6 'Set the maximum number of maps
    Counter = "MapCounter" 'Created Counter

    'set the files and pathname for maps
    sPath = "/opt/HomeSeer/html/images/weatherXML/maps/" 'The Path Name to the files
    sFile(0) = "USWeather.png"
    sFile(1) = "USStorms.png"
    sFile(2) = "USPressures.png"
    sFile(3) = "USPollen.png"
    sFile(4) = "USGrass.png"
    sFile(5) = "USTree.png"
    sFile(6) = "USRagweed.png"
    sDisplayFile = "map.png" ' this is the filename used as the working file.

    dCounter = hs.CounterValue(Counter) 'Get the Map Counter Value
    iCnt = CInt(dCounter) ' Set the double to an integer

    'Make the list a loop and set the Counter correctly

    iIncCnt = 0
    If iCnt < 0 Then 'Went through the floor value so set to ceiling value.
    iCnt = iMax
    For iIncCnt = 1 To iMax
    End If

    If iCnt > iMax Then 'Went through the ceiling value so set to the floor value
    iCnt = 0
    End If

    Source = sPath & sFile(iCnt)
    Destination = sPath & sDisplayFile

    'Overwrite or create the file that will be displayed.
    System.IO.File.Copy(Source, Destination, True)

    End Sub

    --------------------------------------- End of .vb script

    I am still struggling to get .gif files to cycle through the pictures in the file. I had it working and now it is not. It works on windows but not android. I know this is complex and somewhat convoluted but I now have the ability to download any files or sequence and have them update reliably. I know I should change the parameter passing to object but events call scripts with a single string. Hope this helps someone.


      Thx for the link AllhailJ.
      Just curious, how did you find the associated folder ( ? Is there any web interface pointing to it or is it just backend data found via trial/error?
      Just wondering if there is more detailed/regional data available. Thx


        Searched for weather and radar. Looked at different sites and then extracted the URL from the picture. I looked at the Canada weather and there is a lot of information available. I looked at Calgary radar which appears to be a .gif but didn't download and see if it was complete.

        I don't understand the html you posted in that I don't know what to name the file or why it works. Sorry ignorant about this file type.

        -- EDIT --

        Figured out how the HTML works - now I need to work out how to switch between maps and have it update.

        Here is a site I think you might be interested in: The snow rain and ice 84 hour forecast is pretty neat. It is for most of North America.

        -- EDIT 2 --

        I found a way to have the animation gif reload. I modified the script for the .gif files and then on the scroll buttons I closed the screen and opened the screen.

        Here is the screen shot of the increment function.

        Click image for larger version

Name:	Screenshot from 2019-12-23 03-21-16.png
Views:	51
Size:	317.9 KB
ID:	1349106 This is the same process as for static maps except I use the html 123QWEASD shared and instead of activating a release of the element you have to close and open the screen. I have not looked at how much bandwidth this is consuming but at least it is working and optimization if needed can happen at a later date.

        Hope this helps someone!