genielabs / HomeGenie

HomeGenie, the programmable automation intelligence
https://homegenie.it
GNU General Public License v3.0
395 stars 155 forks source link

JkUtils - Solar Altitude = getting error in Widget since 1.3-stable.9 update #411

Closed soxfan1966 closed 4 years ago

soxfan1966 commented 4 years ago

Expected behavior

no errors

Actual behavior

getting compile / run time error

Steps to reproduce the problem starting from a fresh install

  1. Either use the Widget Editor or add the Solar Altitude widget to a Dashboard page
  2. Widget displays that it is not configured / Error displayed in Widget Editor

Specifications

Additional configuration notes

Good morning

I had noticed this the other day and tried looking into it, and I took the 1.3-stable.10 update this morning thinking maybe it would resolve the problem but its still there.

The Jk-Utils Solar Altitude program runs with no errors but the Widget has the following error:

TypeError: this.DataUiFieldsDisplayed[i].substr is not a function

This is in the ConvertTime function

Not sure what may have changed but I am running the standard version of this utility. Does anyone else have the same error with the widget?

soxfan1966 commented 4 years ago

Not sure what you mean about it not being fatal, as the widget stops processing once it gets that error. I had a minute to get the exact error from the Chrome Console:

TypeError: this.splice is not a function
Line 106, Column 29

mralapete commented 4 years ago

Ok in the HG UI from the Dashboard selecting Home and the Group Solar Altitude is in did you do as I suggested by selecting it once and repeating the same process.

soxfan1966 commented 4 years ago

I will give that a try when I get a chance (probably tomorrow at this point).

mralapete commented 4 years ago

Bear in mind that we are using jQuery 2.02 here. Obviously you are not getting compiler errors in the widget script rather interpreter error messages.

I’ve a feeling that the widget script was developed in full Javascript back in 2014 so you may want to check for any code deprecation between jQuery and JavaScript.

While the widget editor GUI is not great it does show what you need to know for debugging purposes.

The time. function is indeed a valid function but may have been incorrectly defined in the widget script or replaced in the newer versions of jQuery.

I did notice back in 2015 the default weather widget was re-scripted. Might be worth making comparisons between both.

soxfan1966 commented 4 years ago

Good morning,

I did as you suggested this monring:

Added JK Utils Solar Altitude to a different group (by which I took to mean a different group on the same Home page). I got the same issue that it was not configured (even though I had defined all the parameters in the Options screen). The widget did display cleaner even with the message about not being configured than it had before. I clicked the text for the message about it not being configured and got the popover for the options. I changed the Zoom from 100 to 80 and hit the tab key - the param changes were saved and now the widget is displaying correctly again.

So then I went to a different Dashboard page and added the JK Utils Solar Altitude to that page. It displayed correctly. However, when I configured the page to move the widget from the bottom to the top I got the error message again about it not being configured. But I clicked the text in the widget, and changed the Zoom from 80 to 75 and hit tab and the change for the params was saved and the widget is displaying correctly again.

However, if I navigate from my Tools Dashboard (where I have the widget now) to Home and then back to Tools the Widget displays the not configured message again - and I need to click the text, make a change for a param and then it is OK.

So I believe you are correct about the params not being "passed" to the widget properly. Not sure why, and I won't have time to try and dig into this more today (or likely over the weekend either). I was hoping @genemars with all the changes he has been making to HG lately may be able to take a look and determine what the problem may be - maybe with this new info he can do that.

Thanks

mralapete commented 4 years ago

I imagine it would be up to the author to sort out a 3rd party widget script so I don’t imagine Gene will do this.

As I mentioned selecting your Solar Altitude from the Home drop down, selecting Home again and selecting Solar Altitude from the drop down will present you with an updated widget.

Basically what’s needed is to disable the Preference pop up in the widgets program as those parameters are already defined in the Options section of the program.

The Options utility in any program was introduced into HG at a later stage after the Solar Altitude Program was scripted, hence the duplication.

soxfan1966 commented 4 years ago

Good morning,

I had a chance to play around with this based on mralapete's mentioning the Preferences pop up in the widget needed to be disabled.

In the JK Utils Solar Altitiude Widget, I commented out the following lines; Javascript = lines 81 thru 136 HTML = lines 411 thru 443

The Widget displays correctly with no errors or corruption (without commenting out the HTML part, you get the Preferences box displayed below the main part of the widget but no error loading the widget).

Not sure if this would be something that would get fixed as part of the main HG release (there must have been something recently changed in HG that resulted in this issue) or not, but as I have at least resolved it for now I am going to Close the issue.

Thanks for all your help mralapete :)