Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

e is undefined #16

Closed
fribse opened this issue Aug 22, 2022 · 17 comments
Closed

e is undefined #16

fribse opened this issue Aug 22, 2022 · 17 comments
Assignees
Labels
bug Something isn't working

Comments

@fribse
Copy link

fribse commented Aug 22, 2022

Describe the bug
The frontend sometimes shows
billede

To Reproduce
Steps to reproduce the behavior:

  1. Simply add the card to a tab
  2. Set up the card with a few standard settings

Expected behavior
Sometimes it works as expected, and shows the list of planes, other times it just shows that odd message

Screenshots
Firefox
billede
Chrome
billede

Environment (please complete the following information):

  • Home Assistant version: 2022.08.06
  • Browser or app, including version: Firefox 103.0.2 (64 bit) / Chrome 104.0.5112.101

Additional context
FR24: Linux/generic/static_armel/1.0.29-10
Raspberry Pi 3b+

Configuration

type: custom:fr24-card
entity: sensor.fr24_aircraft
title: Fly over os
units_in_table: true
units: metric
larger_units: true

If possible, also supply the JSON of aircraft.json.


{ "now" : 1661157367.0,
  "messages" : 266121,
  "aircraft" : [
    {"hex":"4ca66f","squawk":"6513","altitude":5625,"vert_rate":1984,"track":151,"speed":312,"mlat":[],"tisb":[],"messages":17,"seen":49.9,"rssi":-34.1},
    {"hex":"4aca50","squawk":"3755","flight":"NOZ3QJ  ","lat":55.662140,"lon":12.952714,"nucp":7,"seen_pos":0.1,"altitude":36000,"vert_rate":0,"track":346,"speed":486,"category":"A3","mlat":[],"tisb":[],"messages":1441,"seen":0.1,"rssi":-28.7},
    {"hex":"471f7e","mlat":[],"tisb":[],"messages":2,"seen":142.8,"rssi":-41.5},
    {"hex":"45cab6","mlat":[],"tisb":[],"messages":29,"seen":194.1,"rssi":-34.6},
    {"hex":"3c66e2","squawk":"6454","flight":"DLH7AE  ","lat":55.941696,"lon":13.009560,"nucp":7,"seen_pos":2.9,"altitude":36975,"vert_rate":0,"track":357,"speed":464,"category":"A3","mlat":[],"tisb":[],"messages":2774,"seen":0.1,"rssi":-33.3},
    {"hex":"501d20","mlat":[],"tisb":[],"messages":5,"seen":201.9,"rssi":-37.5},
    {"hex":"471f80","mlat":[],"tisb":[],"messages":134,"seen":165.0,"rssi":-35.5},
    {"hex":"4596c1","squawk":"7000","altitude":1175,"mlat":[],"tisb":[],"messages":42,"seen":9.4,"rssi":-34.5},
    {"hex":"345084","squawk":"0751","flight":"VLG1507 ","lat":55.133194,"lon":12.168005,"nucp":7,"seen_pos":22.0,"altitude":22750,"vert_rate":1984,"track":220,"speed":374,"mlat":[],"tisb":[],"messages":369,"seen":10.7,"rssi":-34.5}
  ]
}
@fribse fribse added the bug Something isn't working label Aug 22, 2022
@fratsloos
Copy link
Owner

Thanks for the feedback @fribse. Is the supplied JSON from the moment when you get the error message? If not, is it possible to get the JSON from that exact moment?

@fratsloos fratsloos self-assigned this Aug 22, 2022
@fribse
Copy link
Author

fribse commented Aug 24, 2022

Hmm, I'm trying to 'catch' it, it mostly happens first time I load Home Assistant lovelace, so then if I press refresh, it shows it (normally), and it's difficult to catch it from dump1090 fast enough :-)

@fratsloos
Copy link
Owner

When you say the first time when you load it, do you mean the first time after restarting Home Assistant, or the first time after you restarted your browser?

@fribse
Copy link
Author

fribse commented Aug 26, 2022

First time I load the browser. A few times I've had to do a CTRL+F5 to make it go away, otherwise a simple F5 will clear up the problem.

@fratsloos
Copy link
Owner

fratsloos commented Aug 27, 2022

I can't reproduce the error. It seems like the entity is not loaded the first time you open the page, which is something on your environment. I've added a check on the data from then entity, which throws an error when rendering the table and when there is no data. This fixes the error that you got, but not the cause of it. I don't think I'm able to fix that.

Released in v0.5.2.

@fribse
Copy link
Author

fribse commented Aug 29, 2022

Not sure if I caught it this time @fratsloos ?

{ "now" : 1661801970.9,
  "messages" : 709610,
  "aircraft" : [
    {"hex":"3c5427","squawk":"7037","flight":"BCS3317 ","lat":55.686951,"lon":12.304173,"nucp":7,"seen_pos":5.7,"altitude":6025,"vert_rate":-1280,"track":190,"speed":280,"category":"A5","mlat":[],"tisb":[],"messages":167,"seen":4.7,"rssi":-31.6},
    {"hex":"4aca6b","squawk":"2504","flight":"SAS1221 ","lat":55.855470,"lon":12.422276,"nucp":7,"seen_pos":9.3,"altitude":10925,"vert_rate":1280,"track":302,"speed":341,"category":"A3","mlat":[],"tisb":[],"messages":306,"seen":7.2,"rssi":-34.0},
    {"hex":"4aca6d","mlat":[],"tisb":[],"messages":793,"seen":245.3,"rssi":-34.0},
    {"hex":"4520ea","mlat":[],"tisb":[],"messages":1325,"seen":265.3,"rssi":-34.2}
  ]
}

@fratsloos fratsloos reopened this Sep 2, 2022
@fratsloos
Copy link
Owner

I'm sorry, I can't reproduce your error. I've used your json but no luck. I see the two planes in the output. Did you update to 0.5.2 and still have the issue?

@fribse
Copy link
Author

fribse commented Sep 7, 2022

This morning I see this:
billede
But going to the fr24 I see this:

{ "now" : 1662528197.2,
  "messages" : 28051,
  "aircraft" : [
    {"hex":"48415f","squawk":"7675","altitude":38000,"vert_rate":64,"track":232,"speed":427,"mlat":[],"tisb":[],"messages":229,"seen":0.5,"rssi":-33.9},
    {"hex":"440052","mlat":[],"tisb":[],"messages":56,"seen":223.1,"rssi":-35.1},
    {"hex":"406b62","mlat":[],"tisb":[],"messages":476,"seen":119.9,"rssi":-33.1}
  ]
}

@fribse
Copy link
Author

fribse commented Sep 10, 2022

Today I got this:
billede
Taken from dump1090


{ "now" : 1662794567.9,
  "messages" : 120377,
  "aircraft" : [
    {"hex":"5110e9","mlat":[],"tisb":[],"messages":3023,"seen":134.0,"rssi":-33.7},
    {"hex":"48ae20","mlat":[],"tisb":[],"messages":448,"seen":292.3,"rssi":-34.4}
  ]
}

@fratsloos
Copy link
Owner

@fribse In your JSON there is no valid data. Both tracked flights are missing data to show on the card. That's why you got the initial error, and after the update the new error.

I think I should implement something (like a warning) for the situation when there are no tracked flights, instead of throwing the exception (current).

@fribse
Copy link
Author

fribse commented Sep 13, 2022

Well, it's all up to you of course, I just report what I see, but I'm glad I finally got a result showing the right data :-)
I think you should just show 'no flights' or something like that, as soon as there is traffic again, it shows it correctly again.

@fratsloos
Copy link
Owner

It took a while, but I made an adjustment to the card when no planes were found. This adjustment can be found in the pre-release I just released.

You can download the pre-release via HACS, by choosing 'Show beta versions' in the redownload option of the card and then installing version 0.6.0-alpha. Note: This update uses the new version of browser_mod. That must be installed first, unless you don't use popups in the card.

Screenshot 2022-10-15 at 13 34 16

@BrettEBowman
Copy link

My flight tracker at my other house is currently powered off. With this beta version, the FR24 card is now showing "No aircrafts detected!" rather than the old error. However, in my current situation it is really a little different since the entire REST call should be failing rather than the call succeeding but not have any flight data.

I'm not sure if you can do this or not, but it would be nice if you could have 2 different error messages. The current new one is great for that "normal" situation of the tracker being up and running, but no flights within range. But if the REST call isn't successful, I'd prefer to see some sort of a "error" message indicating that the server call was unsuccessful. Looking at the HA sensor, it seems like the REST interface is giving it a Status of "OK" in both situations. But when the server isn't up, the only attribute displayed is the "Friendly Name".

fratsloos added a commit that referenced this issue Oct 17, 2022
@fratsloos
Copy link
Owner

In the last commit, a modification was made to give a proper error if there is no data, as suggested by @BrettEBowman.

Screenshot 2022-10-17 at 20 45 22

These changes will be available through a pre-release later this week, after some more testing on my side.

@BrettEBowman
Copy link

Looks great. Thanks!

@fratsloos
Copy link
Owner

I've just released version v0.6.0-beta which is available in HACS beta versions with the latest changes.

@fratsloos
Copy link
Owner

Fixed in v0.6.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants