Custom Widget: How to access the "Data from" data inside the custom widget

Custom Widget: How to access the "Data from" data inside the custom widget

Team,

I would like to make a SIMPLE custom widget. I have attached a file below. The idea is to have more flexibility for onscreen display and the infobox than the image marker widget allows. Since the script is for monitoring water moisture on an orchard, I don't really need real-time... - so I think I only need to grab the variables using on "onStart" method.

background: I'm not a strong Javascript developer... which makes this harder for me.

In this script the following two items are something I don't understand:
* What is the proper way to put code inside the onStart method/event? (note: I tried moving my HTML inside the onStart and I could not get it to work )
* What is the proper way to get the data from the device/variable placed in the "Data from" section of the custom widget? ( I couldn't find any current example code ).

Thanks!
Marlan