genielabs / HomeGenie

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

Analyzis page fails with javascript errors in console - spinner spins forever #60

Closed fgeorgsson closed 9 years ago

fgeorgsson commented 9 years ago

I get this piece of code in index.html on the analyze page. Look at the second last line, "getinter" there cause an uncaught error, which I think is what breaks the Analysis page.

 // UI Localization
    //
    setTimeout(function() {

        var userLang = HG.WebApp.Locales.GetUserLanguage();
        HG.WebApp.Locales.Localize(document, './locales/' + userLang.toLowerCase().substring(0, 2) + '.json');
        // enable/disable speech input
        if (!('webkitSpeechRecognition' in window)) {
            //no speech support
            $('#speechinput').hide();
        } else {
            // lookup for a localized version, if any
            HG.VoiceControl.Localize('./locales/' + userLang.toLowerCase().substring(0, 2) + '.lingo.json', function(success) {
                if (!success)
                {
                    // fallback to english lingo file
                    HG.VoiceControl.Localize('./locales/en.lingo.json', function(res){ });
                }
            });
            recognition = new webkitSpeechRecognition();
            recognition.continuous = false;
            recognition.interimResults = false;getinter
            recognition.onstart = function() { 
fgeorgsson commented 9 years ago

I'm running version HomeGenie 1.00 beta rev. 441. The offending file seems to be: Program Files\HomeGenie\html\js\api\homegenie.webapp.js

fgeorgsson commented 9 years ago

Further problem on Analysis page:

$.ajax({
                url: '/' + HG.WebApp.Data.ServiceKey + '/' + HG.WebApp.Data.ServiceDomain + '/Statistics/Parameter.Counter/' + HG.WebApp.Statistics._CurrentParameter + '/' + HG.WebApp.Statistics._CurrentModule + '/',
                type: "POST",
                data: "{ dummy: 'dummy' }",
                dataType: "text",
                success: function (data) {
                    var stats = eval(data);
                    //
                    var total = 0.0;
                    for (var s = 0; s < stats[0].length; s++)

stats is an empty string ("") and so the for loop throws an error. I suppose that is somewhat due to my Aeon Labs smart energy switch with metering not working correctly so I have no stats?

genemars commented 9 years ago

The problem may be due to a wrong System.Data.SQlite.dll version. Check log files or run HG from a console to see if any error is reported when accessing the analytics page.

fgeorgsson commented 9 years ago

Running HomeGenie from the console this error message appears everytime I use the "Global" option and press update. If I run just a specific group, both graphs appear and work correctly for that group. I use Swedish language btw (don't know how to change it to English so can't rule problem with translations out).

I have stats now, the switch is sending meter reports correctly so this seems to be with incorrect time formats - somewhere.

System.FormatException: String was not recognized as a valid DateTime. at System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyl es styles) at HomeGenie.Service.Logging.StatisticsLogger.GetHourlyStats(String domain, S tring address, String parameterName, String aggregator) at HomeGenie.Service.Handlers.Statistics.ProcessRequest(MIGClientRequest requ est, MIGInterfaceCommand migCommand) at HomeGenie.Service.HomeGenieService.migService_ServiceRequestPreProcess(MIG ClientRequest request, MIGInterfaceCommand migCommand) at MIG.MIGService.webGateway_ProcessRequest(Object gwRequest) at MIG.Gateways.WebServiceGateway.Worker(Object state) System.FormatException: String was not recognized as a valid DateTime. at System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyl es styles) at HomeGenie.Service.Logging.StatisticsLogger.GetHourlyCounter(String domain, String address, String parameterName, Double timescaleseconds) at HomeGenie.Service.Handlers.Statistics.ProcessRequest(MIGClientRequest requ est, MIGInterfaceCommand migCommand)

genemars commented 9 years ago

What system are you running homegenie on? Try resetting the database from system->maintenance section.

fgeorgsson commented 9 years ago

Server is Windows 7 and client is Chrome on Windows 8.

A reset of the stats database worked, both graphs appeared with Global option. They appeared immedietaly after the reset, empty of course, and now that some stats have come in the different graphs all work. Thank you!