Custom widget - dynamic images on dashboard


  • ADMIN

    There is a request on https://github.com/mycontroller-org/mycontroller/issues/405 to show dynamic images on dashboard.

    We can achieve this by using the custom widget.

    Create an HTML template as follows, replace this url with your actual URL.

    <div>
        <img  ng-src="https://static.pexels.com/photos/2487${dynamicImage}/pexels-photo-2487${dynamicImage}.jpeg" alt="test image" class="adf-myc-dsi-image"/>
    </div>
    

    Create a javascript as follows, Use UIDTag to map your Custom >> VAR1 senor variable

    var myImports = new JavaImporter(java.io, java.lang, java.util, java.text);
    
    with(myImports) {
      //var dynamicImage = mcApi.uidTag().getByUid("image-var1").getResource();
      var dynamicImage = 98;
    }
    

    Add your HTML template and script on dashboard with custom widget,
    image



Suggested Topics

12
Online

392
Users

365
Topics

2.2k
Posts