Giter VIP home page Giter VIP logo

mmm-nyc-transit's Introduction

MTA transit module for MagicMirrorยฒ

๐Ÿ›ก Badges

follow on Twitte GitHub followers

GitHub tag (latest SemVer) All Contributors GitHub top language GitHub GitHub issues GitHub issuesGitHub pull requests GitHub closed pull requests

โ„น๏ธ How to use this module

  1. clone this repo into your moducles directory with the following command: git clone https://github.com/Elaniobro/MMM-nyc-transit
  2. install all the npm modules with either yarn install or npm install
  3. update your MagicMirrorยฒ Config, by adding the following object:
  {
    module: 'MMM-nyc-transit',
    position: "top_bar",
    header: "Next Train",
    config: {
      apiKey: 'YOUR_KEY_HERE',
      displayType: 'list',
      mtaType: 'train',
      stations: [
        {
          stationId: 237,
          walkingTime: 5,
          dir: {
              upTown: false,
              downTown: true
          }
        },
        {
          stationId: 177,
          walkingTime: 5,
          dir: {
            upTown: true,
            downTown: false
          }
        }
      ],
      updateInterval: 300000
    }
  }

๐Ÿ› ๏ธ Config

  • module the name of the module you are installing.
  • position where you want the mmm-nyc-transit module to appear.
    • note: configurable, see MM documentation
  • header display name for what you want to call your module on screen
    • note: optional
  • displayType choose between scrolling marquee (default) or list
    • list - shows next 3 trains for each line, both uptown and downtown
      • note: works best on side
    • marquee - shows next 6 trains, 3 for uptown and 3 for downtown
      • note: works best on top
  • apiKey see mta api Key on where to obtain yours.
  • mtaType coming soon, choose bus and or train
  • stations array to store each station config.
    • stationId find your station(s) id(s).
    • walkingTime allows you to pad the realtime data time, with travel time to the station.
    • dir object to hold which directions of the train to show
      • upTown boolean value
      • downTown boolean value
  • updateInterval default is set to 5 minutes
    • low interval will result in your MTA api key timing out

๐Ÿ”‘ MTA API Key

You will need to sign up for the MTA Real-Time Data Feeds API. To get a key, please visit their website: api.mta.info.

๐Ÿš† Station List

Find the corresponding Name and id in the STATION_LIST.md object to insert into the config array.

โœจ Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please open an issue

๐Ÿ‘จ๐Ÿป Author

Elan Trybuch

โš–๏ธ License

This project is licensed under the MIT License - see the LICENSE.md file for details

๐Ÿ™๐Ÿฝ Acknowledgments

Contributors โœจ

Thanks goes to these wonderful people (emoji key):

Elan Trybuch
Elan Trybuch

๐ŸŽจ ๐Ÿ’ป ๐Ÿ‘€ ๐Ÿ“– ๐Ÿšง ๐Ÿš‡
Eric Lewis
Eric Lewis

๐Ÿ’ป
Kendiggity973
Kendiggity973

๐Ÿค” ๐Ÿ›
dahlio
dahlio

๐Ÿค” ๐Ÿ›
jon7187
jon7187

๐Ÿ› ๐Ÿค” ๐Ÿ’ก
nipper2000h
nipper2000h

๐Ÿ›
Kurt Raschke
Kurt Raschke

๐Ÿ› ๐Ÿ’ป
Julian Graham
Julian Graham

๐Ÿ› ๐Ÿ’ป
Kristjan ESPERANTO
Kristjan ESPERANTO

๐Ÿšง

This project follows the all-contributors specification. Contributions of any kind welcome!

mmm-nyc-transit's People

Contributors

allcontributors[bot] avatar dependabot[bot] avatar elaniobro avatar joolean avatar kristjanesperanto avatar zingerj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

mmm-nyc-transit's Issues

[Security] Workflow lint.yml is using vulnerable action actions/checkout

The workflow lint.yml is referencing action actions/checkout using references v1. However this reference is missing the commit a6747255bd19d7a757dbdda8c654a9f84db19839 which may contain fix to the some vulnerability.
The vulnerability fix that is missing by actions version could be related to:
(1) CVE fix
(2) upgrade of vulnerable dependency
(3) fix to secret leak and others.
Please consider to update the reference to the action.

Module not showing any trains

Hi, I configured this fresh last night and used a new API key from the mta site. I'm unfortunately not seeing any trains for grand central. Any assistance would be appreciated. I'm happy to provide more details as needed. Thank you

[๐Ÿ› BUG] - Multiple stations with the same ID

I'm unable to access times for Queensboro Plaza (station id 461), getting the error "Cannot read property 'daytimeRoutes' of undefined"

Looking at the MTA's API documentation, it seems there are 2 stations with the ID of 461, even though they're in the same place. One returns the schedule for IRT trains and the other returns the schedule for BMT trains. Perhaps the API is returning both and the script isn't able to handle/combine them?

Here are both entries from the MTA database-- note most other stations just have one.
**461,461,**718,IRT,Flushing,Queensboro Plaza,Q,7,Elevated,40.750582,-73.940202,Astoria - Flushing,Manhattan
**461,461,**R09,BMT,Astoria,Queensboro Plaza,Q,N W,Elevated,40.750582,-73.940202,Astoria - Flushing,Manhattan

Source: http://web.mta.info/developers/data/nyct/subway/Stations.csv

[๐Ÿ› BUG] - Uptown/Downtown filters do not work if multiple modules sections are defined

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Define two separate module blocks in your config.js
        {
            module: 'MMM-nyc-transit',
            position: "bottom_left",
            header: "Next Train -> Manhattan",
            config: {
                apiKey: 'SCRUBED',
                displayType: 'list',
                mtaType: 'train',
                stations: [{
                        // Dekalb Ave
                        stationId: 26,
                        walkingTime: 5,
                        dir: {
                            upTown: true,
                            downTown: false
                        }
                    },
                    {
                        // Jay Street Metro Tech
                        stationId: 636,
                        walkingTime: 5,
                        dir: {
                            upTown: true,
                            downTown: false
                        }
                    }
                ],
                updateInterval: 300000
            }
        },
        {
            module: 'MMM-nyc-transit',
            position: "bottom_right",
            header: "Next Train -> Brooklyn",
            config: {
                apiKey: 'SCRUBED',
                displayType: 'list',
                mtaType: 'train',
                stations: [{
                        // Dekalb Ave
                        stationId: 26,
                        walkingTime: 5,
                        dir: {
                            upTown: false,
                            downTown: true 
                        }
                    },
                    {
                        // Jay Street Metro Tech
                        stationId: 636,
                        walkingTime: 5,
                        dir: {
                            upTown: false,
                            downTown: true 
                        }
                    }
                ],
                updateInterval: 300000
            }
        },

Expected behavior
The bottom left of the screen will only show upTown trains, and the bottom right will only show downTown trains.

** Actual behavior**
Last module defined wins, showing only downtown trains.

Screenshots
image

Platform (please complete the following information):

  • Node Version: v19.1.0
  • Web Browser/Electron version: Electron: 21.3.0
  • Hardware [e.g. Raspberry Pi 2/3, Windows, Mac, Linux, System V UNIX]: Linux x86_64

Additional context
Removing the second module block does do the correct thing, but ideally I want to see uptown and downtown trains in separate blocks.

Label Stations?[๐Ÿ’ก FEATURE REQUEST]

Am I able to label stations? I live between a lot, many of which are running the same lines, its hard to format nicely.

Can I enter a header for each station to indicate which is which?

[๐Ÿ› BUG] - Range Error: index out of range: 3+109 >23

Describe the bug
I installed the module and followed the directions for an api key. I copied the example config from the readme and when i run it, i get an error:
(node:6098) UnhandledPromiseRejectionWarning: Error: RangeError: index out of range: 3 + 109 > 23 at /home/pi/Development/MagicMirror/modules/MMM-nyc-transit/node_helper.js:175:15 at processTicksAndRejections (internal/process/task_queues.js:95:5)

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
The module to display data.

** Actual behavior**
Header is displayed, but no transit data is displayed

Screenshots
If applicable, add screenshots to help explain your problem.

Platform (please complete the following information):

  • Node Version:
  • Web Browser/Electron version:
  • Hardware [e.g. Raspberry Pi 2/3, Windows, Mac, Linux, System V UNIX]:

Configuration
{ module: 'MMM-nyc-transit', position: "top_bar", header: "Next Train", config: { apiKey: 'API_KEY', displayType: 'list', mtaType: 'train', stations: [ { stationId: 237, walkingTime: 5, dir: { upTown: false, downTown: true } }, { stationId: 177, walkingTime: 5, dir: { upTown: true, downTown: false } } ], updateInterval: 300000 } },
Additional context
Add any other context about the problem here.

[๐Ÿ› BUG] - Train schedule not showing for certain locations

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Adding Station IDs for 606 and 273 -- Court Sq. and Queens Plaza respectively
  2. Save config, magicmirror reboots and shows no schedule

Expected behavior
Would show train schedules for both Court square and Queens Plaza stations

** Actual behavior**
Module loads, but no station info or train schedules show

Screenshots
If applicable, add screenshots to help explain your problem.

Platform (please complete the following information):

  • Node Version:
  • Web Browser/Electron version:
  • Hardware [e.g. Raspberry Pi 2/3, Windows, Mac, Linux, System V UNIX]: Raspbery Pi 3B

Configuration
{
module: 'MMM-nyc-transit',
position: "top_bar",
header: "Next Train",
config: {
apiKey: '----------redacted-------------',
displayType: 'list',
mtaType: 'train',
stations: [
{
stationId: 606,
walkingTime: 3,
dir: {
upTown: true,
downTown: true
}
},
{
stationId: 273,
walkingTime: 5,
dir: {
upTown: true,
downTown: true
}
}
],
updateInterval: 300000
}
}

Additional context
I've tested with other station ids, and it works fine

[๐Ÿ› BUG] - Wrong station and no out on another

Station IDs not behaving as expected:

96 - Kousiczsko St J reporting wrong terminals (see photo - not due to a change in service)
114 - Central Ave M not showing anything

96 used to work with no issues and correct terminals , 114 has never worked.

Thank you for your help
4AE8EFFC-F77E-4426-82BD-265CCF0DDDFF
5ABD1641-BD35-40A1-9273-EAAA7B9D8B06

[๐Ÿ› BUG] - W Line (Yellow Icon)

Describe the bug
W lines do not have the yellow color

To Reproduce
Steps to reproduce the behavior:

  1. Add station 3, see W line

Expected behavior
W with a yellow circle

** Actual behavior**
W without a yellow circle

Additional context
NBD, figured minor tweak in the main file ... BTW your module is what I have been dreaming of forever!

[Question] My Own City?

Hello! @Elaniobro

Hope this is an okay way to get in touch. I am interested in creating my own transit module for my magic mirror, with my specific city. At first I would be happy with simply the next time the bus is going to show up/how late it might be in either direction.

Building upon that would be a small map with a moving real time bus to see where it is at on the map.

My city offers a GTFS zip file for transit, but I am not sure if it offers real time data. I do notice my Lyft App and Transit App on iPhone do show busses in real time so I am hopefull it exists.

I understand its a huge undertaking, and by no means to expect anyone to walk me through every single step of this ( unless they want to be awesome!) but what would a good place be to start? I have no experience! I am technical enough to get in trouble ( magic mirror set up, modules installed, some minor configuration modification etc) but no formal background in python/javascript...etc.

Thank you for any help you can provide on this

[๐Ÿ› BUG] - Transit module stopped working

Describe the bug
The module stopped working after a change from the data provider

To Reproduce
I have opened a troubleshooting thread here:
https://forum.magicmirror.builders/topic/13185/transit-module-stopped-working/1?_=1593886364430

Others have confirmed the module no longer works as intended.

Expected behavior
The next three trains are displayed in a countdown clock style.

** Actual behavior**
No trains are displayed. "Next train" is displayed but no trains load.

Screenshots
Screenshot is here:
https://forum.magicmirror.builders/topic/13185/transit-module-stopped-working/1?_=1593886364430

Platform (please complete the following information):

  • Node Version:
  • Web Browser/Electron version:
  • Hardware [e.g. Raspberry Pi 2/3, Windows, Mac, Linux, System V UNIX]:

Configuration
`/* Magic Mirror Config Sample
*

*/

var config = {
address: "localhost", // Address to listen on, can be:
// - "localhost", "127.0.0.1", "::1" to listen on loopback interface
// - another specific IPv4/6 to listen on a specific interface
// - "0.0.0.0", "::" to listen on any interface
// Default, when address config is left out or empty, is "localhost"
port: 8080,
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"], // Set [] to allow all IP addresses
// or add a specific IPv4 of 192.168.1.5 :
// ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.1.5"],
// or IPv4 range of 192.168.3.0 --> 192.168.3.15 use CIDR format :
// ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.3.0/28"],

useHttps: false, 		// Support HTTPS or not, default "false" will use HTTP
httpsPrivateKey: "", 	// HTTPS private key path, only require when useHttps is true
httpsCertificate: "", 	// HTTPS Certificate path, only require when useHttps is true

language: "en",
timeFormat: 12,
units: "imperial",
// serverOnly:  true/false/"local" ,
		     // local for armv6l processors, default
		     //   starts serveronly and then starts chrome browser
		     // false, default for all  NON-armv6l devices
		     // true, force serveronly mode, because you want to.. no UI on this device

modules: [
	{
		module: "alert",
	},
	{
		module: "clock",
		position: "top_left"
	},
	{
		module: "calendar_monthly",
		position: "top_left",
		config: {
			// The config property is optional
			// Without a config, a default month view is shown
			// Please see the 'Configuration Options' section for more information
		}
	},
	{
		module: "MMM-TimeTreeEvent",//Positions of *_bar and *_third are not support.
		position: "top_left",
		config: {
			appid: "calendarapi",//You need to get the target calender id with Get calender id api[1]
			calenderid: "calendarid",
		}
	},
	{
		module: "MMM-Events",
		position: "top_left",
		config: {
			city: "New York",// Your City
			eventType: "performing_arts,conference_convention,festivals_parades,movies_film,food,fundraisers,support,book,music_alternative,music_dance,music_jazz,music_reggae,music_vocal,music_rap_hiphop,music_rock,music_pop,music_country,",
			when: "This Week",// "All", "Future", "Past", "Today", "Last Week", "This Week", "Next week", and months by name, e.g. "October"
			mode: "noFrame",// "Frame" or "noFrame" (around picture)
			apikey: "eventsapi",
			rotateInterval: 1 * 11 * 1000,// New Event Appears every 5 minutes
			useHeader: false,// Set to true if you want a header
			header: "",
			animationSpeed: 3000,// Event fades in and out
			picture: true,// true, false = no image
		}
	},
	{
		module: "MMM-TwitterTrendsByPlace",
		position: "bottom_right",
		config: {
		// visit the url below for the twitter keys/tokens
		// https://dev.twitter.com/oauth/overview/application-owner-access-tokens
			consumer_key: "twitterapi",
			consumer_secret: "twitterapi",
			access_token_key: "twitterapi",
			access_token_secret: "twitterapi",//set the display name/title for the place
			placeName: "New York, NY",// set the woeid for the place, see documentation for more// http://woeid.rosselliot.co.nz/lookup/
			placeWoeid: "2459115",
		}
	},
	{
		module: "MMM-nyc-transit",
		position: "bottom_left",
		header: "Next Train",
		config: {
			apiKey: "mytransitapi",
			displayType: "list",
			mtaType: "train",
			stations: [
				{
					stationId: 476,
					walkingTime: 0,
					dir: {
						upTown:true,
						downTown: false
					}
				},
			],
			updateInterval: 300000
		}
	},
	{
		module: "MMM-MTA",
		position: "bottom_left",
		header: "MTA",
		config: {
			lines: ["123", "BDFM", "456", "NQR", "ACE"],
			showDelaysOnly: false,
			delayAlertFlash: true,
			fetchInterval: 60000
		}
	},
	{
		module: "currentweather",
		position: "top_right",
		config: {
			location: "New York",
			locationID: "", //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city
			appid: "myweatherapi"
		}
	},
	{
		module: "weatherforecast",
		position: "top_right",
		header: "Weather Forecast",
		config: {
			location: "New York",
			locationID: "5128581", //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city
			appid: "myweatherapi"
		}
	},
	{
		module: "weatherforecast",
		position: "top_right",
		header: "Weather Forecast",
		config: {
			location: "Asbury Park, NJ",
			locationID: "5095281", //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city
			appid: "myweatherapi"
		}
	},
	{
		module: "newsfeed",
		position: "lower_third",
		config: {
			feeds: [
				{
					title: "New York Times",
					url: "http://www.nytimes.com/services/xml/rss/nyt/HomePage.xml"
				},
				{
					title: "CNN",
					url: "http://rss.cnn.com/rss/cnn_topstories.rss"
				},
				{
					title: "BBC",
					url: "http://feeds.bbci.co.uk/news/world/us_and_canada/rss.xml"
				},
				{
					title: "NBC",
					url: "http://feeds.nbcnews.com/nbcnews/public/news"
				},
				{
					title: "Time News",
					url: "https://time.com/newsfeed/feed/"
				},
			],
			showSourceTitle: true,
			showPublishDate: true,
			broadcastNewsFeeds: true,
			broadcastNewsUpdates: true
		}
	},
]

};

/*************** DO NOT EDIT THE LINE BELOW ***************/
if (typeof module !== "undefined") {module.exports = config;}

0
Ssdetweil about 18 hours ago `

Additional context

Error message from pm2 logs:

2020-06-30 09:41:59.974] [ERROR] (node:882) UnhandledPromiseRejectionWarning: Error: Error: Illegal group end indicator for Message .transit_realtime.FeedMessage: 7 (not a group) 0|mm | at /home/pi/MagicMirror/modules/MMM-nyc-transit/node_helper.js:106:15

[๐Ÿ› BUG] - UnhandledPromiseRejectionWarning: Error: RangeError: index out of range: 3 + 109 > 23 (RESOLVED - API KEY WAS EXPIRED)

(RESOLVED - MTA API KEY HAD EXPIRED! CHECK YOUR KEY!)

Describe the bug
NYC transit module keeps showing this error and never works, when quitting MM, the errors at the bottom appear

I see this bug was open in the past and closed but there doesnt appear to be an actual fix yet

To Reproduce
add MMM-nyc-transit module to the Magic mirror modules folder and install with npm install
made sure to git pull the latest version of this module
install with npm install

Expected behavior
Next Train should show the trains

** Actual behavior**
Next Train appears with no other data when magicmirror is running

Platform (please complete the following information):

  • Node Version: v16.14.0
  • Web Browser/Electron version:
  • Hardware raspberry pi 4 w 4gb
  • Running Bullseye 64bit and Bullseye 32bit both have the same behavior
  • magicmirror: '2.18.0',
    npm: '8.3.1',
    node: '16.14.0',
    v8: '9.4.146.24-node.20',
    uv: '1.43.0',
    zlib: '1.2.11',
    brotli: '1.0.9',
    ares: '1.18.1',
    modules: '93',
    nghttp2: '1.45.1',
    napi: '8',
    llhttp: '6.0.4',
    openssl: '1.1.1m+quic',
    cldr: '40.0',
    icu: '70.1',
    tz: '2021a3',
    unicode: '14.0',
    ngtcp2: '0.1.0-DEV',
    nghttp3: '0.1.0-DEV'

Configuration
{
module: "MMM-nyc-transit",
position: "bottom_left",
header: "Next Train",
config: {
apiKey: "DELETED",
mtaType: "train",
displayType: "list",
stations: [130,93],
stations: [
{
stationId: 130,
walkingTime: 8,
dir: {
upTown: false,
downTown: true
}
},
{
stationId: 177,
walkingTime: 8,
dir: {
upTown: true,
downTown: false
}
}
],
updateInterval: 10000
}
},

Additional context
have tried on bullseye 64big and 32bith on both Pi 3B+ and Pi 4 with the same results

ERRORS HERE

[18.03.2022 18:10.34.018] [ERROR] (node:1763062) UnhandledPromiseRejectionWarning: Error: RangeError: index out of range: 3 + 109 > 23
at /home/pi/MagicMirror/modules/MMM-nyc-transit/node_helper.js:187:15
at processTicksAndRejections (node:internal/process/task_queues:96:5)
(Use electron --trace-warnings ... to show where the warning was created)
[18.03.2022 18:10.34.020] [ERROR] (node:1763062) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
[18.03.2022 18:10.34.048] [INFO] Checking git for module: MMM-nyc-transit

[18.03.2022 18:10.43.070] [ERROR] (node:1763062) UnhandledPromiseRejectionWarning: Error: RangeError: index out of range: 3 + 109 > 23
at /home/pi/MagicMirror/modules/MMM-nyc-transit/node_helper.js:187:15
at processTicksAndRejections (node:internal/process/task_queues:96:5)
[18.03.2022 18:10.43.137] [ERROR] (node:1763062) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
[18.03.2022 18:10.47.954] [ERROR] (node:1763062) UnhandledPromiseRejectionWarning: Error: RangeError: index out of range: 3 + 109 > 23
at /home/pi/MagicMirror/modules/MMM-nyc-transit/node_helper.js:187:15
at processTicksAndRejections (node:internal/process/task_queues:96:5)
[18.03.2022 18:10.47.961] [ERROR] (node:1763062) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 3)
[18.03.2022 18:10.57.981] [ERROR] (node:1763062) UnhandledPromiseRejectionWarning: Error: RangeError: index out of range: 3 + 109 > 23
at /home/pi/MagicMirror/modules/MMM-nyc-transit/node_helper.js:187:15
at processTicksAndRejections (node:internal/process/task_queues:96:5)

[๐Ÿ› BUG] - No train details populating

Describe the bug
The module was setup according to instructions, I got an API key from the specified site but the only thing present in the module is the header "NEXT TRAIN". I have let the mirror run for multiple days and no improvement.

To Reproduce
Steps to reproduce the behavior:

  1. Setup magic mirror and clone repository into modules folder
  2. Install the module with npm install
  3. Edit the config.js file to include the API key and the relevant stops
  4. Start the mirror

Expected behavior
The module displays the correct train information for the selected stops

** Actual behavior**
The module displays no train information, only has the header "NEXT TRAINS" followed by a straight line. Completely blank below that.

Screenshots
N/A

Platform (please complete the following information):

  • Node Version: 14.21.3
  • Web Browser/Electron version: ^11.4.9
  • Hardware [e.g. Raspberry Pi 2/3, Windows, Mac, Linux, System V UNIX]: Raspberry pi 4 running raspbian

Configuration

{ disabled: false,
    module: 'MMM-nyc-transit',
    position: "top_left",
    header: "Next Train",
    config: {
      apiKey: "<API key>",
      displayType: "list",
      mtaType: 'train',
      stations: [
        {
          stationId: 610,
          walkingTime: 5,
          dir: {
              upTown: true,
              downTown: true,
          }
        },
        {
          stationId: 177,
          walkingTime: 5,
          dir: {
            upTown: true,
            downTown: false,
          }
        }
      ],
      updateInterval: 300000,
    }
  },

Additional context
N/A

[๐Ÿ› BUG] - Please put your title here.

Describe the bug
I put in two instances of the module onto my magic mirror, with one showing the Central Park West 86th St. station uptown and the other instance as the downtown. I respectively set the boolean values with the former being (upTown: true, downTown: false) and the latter being (upTown: false, downTown: true).

What I see on the mirror, though, is the same stops and same times for both instances. Shouldn't both instances show different trains and times?

To Reproduce
Steps to reproduce the behavior:

  1. Input two modules of 'MMM-nyc-transit' onto config file
  2. Set first and second module's station ID to '158'
  3. Set first module upTown value to true, downTown value to false; set second module upTown value to false, downTown value to true
  4. Run Magic Mirror

Expected behavior
Two different modules of subways transit, the first instance as uptown trains and times, the second instance as downtown trains and times

** Actual behavior**
Both instances show the same trains and times. No differences between the two

Screenshots
https://imgur.com/a/c7om12R - sample code & output on mirror

Platform (please complete the following information):

  • Node Version: latest
  • Web Browser/Electron version: latest
  • Hardware [e.g. Raspberry Pi 2/3, Windows, Mac, Linux, System V UNIX]: RPi 3B

Configuration
What does the used config.js file look like? Don't forget to remove any sensitive information!

Additional context
Add any other context about the problem here.

Some stations IDs not working?

Been using this for a bit with queensboro plaza (Id 273) and works flawlessly (amazing job btw).

I've noticed that the module does not load except for the header for certain stations though (i.e. 606 court square).

[๐Ÿ’ก FEATURE REQUEST] Uptown/Downtown Only

Is your feature request related to a problem? Please describe.
Feed is crowded with trains that terminate one stop away from me. Would only want to show arrival times for the ones going into Manhattan.

Describe the solution you'd like
A config class as an array to match to stations for uptown/downtown/both [0,1,2] or east/west/both [0,1,2]

e.g. 30th Ave & Steinway, only Eastbound trains
stations: [3,271],
directions: [0,0]

e.g. 30th Ave & Steinway, only Downtown trains
stations: [3,271],
directions: [1,1]

e.g. 30th Ave & Steinway, all directions
stations: [3,271],
directions: [2,2]

[๐Ÿ› BUG] - If you don't specify a `walkingTime` parsing response fails

Describe the bug
If you don't specify a walkingTime with each station, then you don't get back any train times, specifically the upTown and downTown lists are empty, because the time field for each trip is NaN

To Reproduce
Steps to reproduce the behavior:

  1. In your config don't set a walkingTime
  2. Run MagicMirror, no trains show up

Expected behavior
Expect train times to show up

Actual behavior
No train times show up

[๐Ÿ’ก FEATURE REQUEST]

Hello, I wanted to make something similar to your app but now that I have discovered it I might just end up using this instead. Great job by the way. My suggestion is to restructure UI a little bit. The current UI is not clear at a glance. Here is a mock-up of how I envisioned it, and feel free to use it if you decide to revisit it in the future.
Screen Shot 2022-09-06 at 8 57 06 PM

We have station names separating blocks of train times so it's easier to look at the trains for the station you are interested in.
Stations can be ordered by walk time from nearest to furthest.
Stations can have 2 directions except when it's

  • Starting station
  • There is no service in one direction for maintenance
  • User doesn't care about one of the directions and wants it off.

There is a version of both scenarios. Also, default direction names aren't intuitive. It's not as important for me to know the end station as much as it is to know which borough the train is running to. Having the ability to rename directions would be huge. Alternatively, the borough can be programmatically determined. As far as I can tell there is no instance where you can go to 3 separate boroughs from one station without passing through one of the boroughs. Meaning if I have a train that starts in QN and goes to MNHT, and ends up in BK eventually, for me from the point of view of Queens train station, the direction will be MNHT. It's less relevant that I will end up in Brooklyn which is kinda how current default destinations work.

Cannot find module whatwg-url

Error message while launching MagicMirror:

[14.08.2022 15:44.24.717] [ERROR] WARNING! Could not load config file. Starting with default configuration. Error found: Error: Cannot find module '/home/pi/MagicMirror/modules/MMM-nyc-transit/node_modules/whatwg-url/lib/public-api.js'. Please verify that the package.json has a valid "main" entry

[๐Ÿ› BUG] - Station ID 109 (fresh pond rd) errors out

Describe the bug
When I add station 109 to the station list, or have it stand alone. I receive the error below.

To Reproduce
Steps to reproduce the behavior:

  1. Add station 109 to your stations list in the config.js
  2. Run magic mirror
  3. See error

Expected behavior
Information about the M train leaving fresh pond road scrolling across my screen.

** Actual behavior**
Nothing.

(node:22291) UnhandledPromiseRejectionWarning: Error: TypeError: Cannot read property 'name' of undefined
    at client.departures.then.catch.err (/home/pi/MagicMirror/modules/MMM-nyc-transit/node_helper.js:85:23)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:22291) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:22291) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Screenshots
If applicable, add screenshots to help explain your problem.

Platform (please complete the following information):

  • Node Version:
  • Web Browser/Electron version:
  • Hardware [Raspberry Pi 3]:

Configuration
What does the used config.js file look like? Don't forget to remove any sensitive information!

 modules: [
                {
                        module: 'MMM-nyc-transit',
                        position: "top_bar",
                        header: "Next Fresh Pond Train",
                        config: {
                                        apiKey: 'MY API KEY',
                                        mtaType: 'train',
                                        stations: [237,238,109],
                                        updateInterval: 120000,
                                        walkingTime: 4,
                                }
                },

Repeated error for nyc-transit

@Elaniobro

Hi there. Iโ€™ve had your great module working in the past, and Iโ€™ve been having some issues since a fresh install. Getting error repeated over and over,

socketNotificationReceived: โ€œTRAIN_TABLEโ€:
Array(2)
MMM-nyc-transit.js:332 Uncaught TypeError: Cannot read property โ€˜fadeSpeedโ€™ of undefined
at Class.socketNotificationReceived (:8080/modules/MMM-nyโ€ฆ-nyc-transit.js:332)
at module.js:245
at Socket. (socketclient.js:38)
at Socketโ€ฆ/node_modules/component-emitter/index.js.Emitter.emit (socket.io.js:1915)
at Socket.emit (socket.io.js:1544)
at Socket.emitEvent (socket.io.js:1161)
at Socket.onevent (socket.io.js:1135)
at Socket.MMSocket.socket.onevent (socketclient.js:32)
at Socket.onpacket (socket.io.js:1089)
at Managerโ€ฆ/node_modules/component-emitter/index.js.Emitter.emit (socket.io.js:1915)

Any suggestions?

Thank you so much for your time and amazing module.

Nick

Feed Not Working

I've installed the module as per instructions and received an MTA API key. However, the only thing that appears on the MM is the header "Next Train" - no train feed shows up. Any help?

{
    module: 'MMM-nyc-transit'
    position: 'top_bar',
    header: 'Next Train',
    config: {
        apiKey: 'my_api_key',
        stations: [158],
        updateInterval: 60000
    }
}

Needs list version

Iโ€™m thinking a list version would make this better. Such as

L Train Halsey stop: Arrives in 5 minutes
M train: Arrives in 12 minutes

With a countdown possibly color coded for time remaining based on walk time.

My mirror will be pulling a lot of stations data and I feel like a ticker would be inconvenient as a form of display

[๐Ÿ’ก FEATURE REQUEST] Leave @: 8:28am, 8:33am, 8:40am

Is your feature request related to a problem? Please describe.
Refresh time every 5 minutes isn't enough for when to leave my apartment.

Describe the solution you'd like
Would like to take the ((departure time) - (walking time))+(current time) so I can ignore refresh factoring into the time it will leave:
eg. N Astoria-Ditmars Blvd Leave @: 8:28am, 8:33am, 8:40am

Describe alternatives you've considered
I've considered adjusting with current time the values for a countdown that is more accurate to the minute, but would require too high a frequency pull.

Could there be a way to store the values locally and using the clock to knock those values down every minute?

eg. Every 5min -> pull from MTA, Every 30 seconds -> update departure time?

Module will not load.

The module will only load the header and nothing else. I tried to follow another thread on a similar issues but did not find a resolution. Code is below.

{
module: "MMM-nyc-transit",
position: "top_left",
header: "Next Train",
config: {
apiKey: "apikey...",
displayType: "list",
mtaType: "train",
stations: [259],
updateInterval: 300000,
walkingTime: 10,
},
},

Any help would be appreciated.

Slowing the entire Mirror down

After going through all of the possibilities to what was slowing my mirror. Turns out it was this module.
I had to disable the module in the config file to fix.

Essentially, upon restarting of the mirror with this module active, the mirror's refresh rate would be fine, but slower and slower over time. This was most evident with the clock module (seconds refreshing after 2 seconds, then 5, 10, ect)

Have I done something to allow this to happen?

No results for stationIDs 397 or 476

I was able to setup MMM-nyc-transit and see train information for the default stations. I then modified them to point to my stationIDs, but no results are coming back. I tested other IDs and they seem to work fine, but I can't get data for 397 and 452.

 {
                        module: 'MMM-nyc-transit',
                        position: "bottom_bar",
                        header: "Next Train",
                        config: {
                                apiKey: 'tVTNdpMfuZ3O23NABScqt5jVAMtH3L8eKWDL1E47',
                                displayType: 'list',
                                mtaType: 'train',
                                stations: [
                                        {
                                                stationId: 397, //397 86 St 4,5,6 trains
                                                walkingTime: 8,
                                                dir: {
                                                        upTown: false,
                                                        downTown: true
                                                        }
                                        },
                                        {
                                                stationId: 452, //476 86 St Q train
                                                walkingTime: 3,
                                                dir: {
                                                        upTown: false,
                                                        downTown: true
                                                        }
                                        }
                                        ],
                                updateInterval: 300000
                        }
                },

I found this error after running npm start


pi@raspberrypi:~/MagicMirror $ npm start

> [email protected] start /home/pi/MagicMirror
> DISPLAY="${DISPLAY:=:0}" ./node_modules/.bin/electron js/electron.js

[09.02.2021 18:07.35.257] [LOG]   Starting MagicMirror: v2.14.0
[09.02.2021 18:07.35.277] [LOG]   Loading config ...
[09.02.2021 18:07.35.291] [LOG]   Loading module helpers ...
[09.02.2021 18:07.35.296] [LOG]   No helper found for module: alert.
[09.02.2021 18:07.35.553] [LOG]   Initializing new module helper ...
[09.02.2021 18:07.35.555] [LOG]   Module helper loaded: updatenotification
[09.02.2021 18:07.35.559] [LOG]   No helper found for module: clock.
[09.02.2021 18:07.36.278] [LOG]   Initializing new module helper ...
[09.02.2021 18:07.36.281] [LOG]   Module helper loaded: calendar
[09.02.2021 18:07.36.284] [LOG]   No helper found for module: currentweather.
[09.02.2021 18:07.36.286] [LOG]   No helper found for module: weatherforecast.
[09.02.2021 18:07.36.711] [LOG]   Initializing new module helper ...
[09.02.2021 18:07.36.714] [LOG]   Module helper loaded: MMM-nyc-transit
[09.02.2021 18:07.36.717] [LOG]   All module helpers loaded.
[09.02.2021 18:07.36.874] [LOG]   Starting server on port 8080 ...
[09.02.2021 18:07.36.900] [LOG]   Server started ...
[09.02.2021 18:07.36.904] [LOG]   Connecting socket for: updatenotification
[09.02.2021 18:07.36.907] [LOG]   Connecting socket for: calendar
[09.02.2021 18:07.36.909] [LOG]   Starting node helper for: calendar
[09.02.2021 18:07.36.912] [LOG]   Connecting socket for: MMM-nyc-transit
[09.02.2021 18:07.36.915] [LOG]   MMM-nyc-transit helper method started...
[09.02.2021 18:07.36.918] [LOG]   Sockets connected & modules started ...
[09.02.2021 18:07.37.363] [LOG]   Launching application.
[09.02.2021 18:07.37.403] [WARN]  (electron) The default value of app.allowRendererProcessReuse is deprecated, it is currently "false".  It will change to be "true" in Electron 9.  For more information please check https://github.com/electron/electron/issues/18397
[09.02.2021 18:07.40.117] [LOG]   Create new calendar fetcher for url: https://calendar.google.com/calendar/ical/frank.rende.iv%40gmail.com/private-72ffd5811e22993a637c8dc52a3a2baa/basic.ics - Interval: 300000
[09.02.2021 18:07.40.248] [LOG]   Create new calendar fetcher for url: https://calendar.google.com/calendar/ical/en.usa%23holiday%40group.v.calendar.google.com/public/basic.ics - Interval: 300000
[09.02.2021 18:07.40.254] [LOG]   Create new calendar fetcher for url: https://calendar.google.com/calendar/ical/8i1l16tj3ibb1qcsj248m89kbg%40group.calendar.google.com/private-8982dbb1f45ab9eaaeb36b31d879a072/basic.ics - Interval: 300000
[09.02.2021 18:07.40.286] [INFO]  Checking git for module: MMM-nyc-transit
[09.02.2021 18:07.41.612] [INFO]  Calendar-Fetcher: Broadcasting 2 events.
[09.02.2021 18:07.41.905] [INFO]  Calendar-Fetcher: Broadcasting 0 events.
[09.02.2021 18:07.42.400] [ERROR] (node:7414) UnhandledPromiseRejectionWarning: Error: TypeError: Cannot read property 'name' of undefined
    at /home/pi/MagicMirror/modules/MMM-nyc-transit/node_helper.js:175:15
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
[09.02.2021 18:07.42.402] [ERROR] (node:7414) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
[09.02.2021 18:07.42.403] [ERROR] (node:7414) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
[09.02.2021 18:07.43.832] [INFO]  Calendar-Fetcher: Broadcasting 3 events.

[๐Ÿ› BUG] - upTown and downTown configuration values reversed

Describe the bug
The upTown and downTown settings seem to have the inverse effect when applied separately. That is, setting upTown to true and downTown to false leads to only "downtown" or outbound trains being displayed, and vice versa.

To Reproduce
Steps to reproduce the behavior:

  1. Set upTown to true and downTown to false in the module configuration
  2. Start MagicMirror with an instance of MMM-nyc-transit configured
  3. Compare with MTA real-time data from mta.info

Expected behavior
Filtering for only "uptown" trains should lead to only uptown trains being displayed.

** Actual behavior**
Only "downtown" trains are displayed; uptown trains are not displayed.

Configuration

        {
            module: 'MMM-nyc-transit',
            position: "top_left",
            header: "9 Av",
            config: {
                apiKey: '...',
                displayType: 'list',
                mtaType: 'train',
                stations: [
                    {
                        stationId: 59,
                        walkingTime: 0,
                        dir: {
                            upTown: true,
                            downTown: false
                        }
                    }
                ],
                fadeSpeed: 0
            }
        },

[๐Ÿ’ก FEATURE REQUEST] Walk time per station

Is your feature request related to a problem? Please describe.
Station list have different walk times which require different padding (walk time)

Describe the solution you'd like
[3,271] 30th Ave (NW lines) Steinway (R): 8min and 12min walk respectively.

Having an array of padding to match the stations

stations: [3,271],
walkingTime: [8,12]

UnhandledPromiseRejectionWarning and no data loads

MagicMirror version: v2.13.0
MMM-nyc-transit version: master commit c61dd81

Due to pandemic, haven't noticed til today the Next Transit part of my MagicMirror setup isn't loading. I've been on node 12, tried moving to node 14, but getting the same errors (I assume one for each station I have configured) when running & loading the MM site in the browser:

[2020-11-15 10:40:40.001] [ERROR]  (node:59936) UnhandledPromiseRejectionWarning: Error: RangeError: Illegal offset: 0 <= 112 (+1) <= 23
    at /opt/MagicMirror/modules/MMM-nyc-transit/node_helper.js:106:15
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
[2020-11-15 10:40:40.002] [ERROR]  (node:59936) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
[2020-11-15 10:40:40.002] [ERROR]  (node:59936) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
[2020-11-15 10:40:40.680] [LOG]    [SPOTIFY] MMM-Spotify Version: 1.6.3
[2020-11-15 10:40:52.547] [LOG]    [SPOTIFY] MMM-Spotify Version: 1.6.3
[2020-11-15 10:40:52.593] [ERROR]  (node:59936) UnhandledPromiseRejectionWarning: Error: RangeError: Illegal offset: 0 <= 112 (+1) <= 23
    at /opt/MagicMirror/modules/MMM-nyc-transit/node_helper.js:106:15
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
[2020-11-15 10:40:52.594] [ERROR]  (node:59936) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)

I'm familiar with some javascript so I'm happy to help with debugging this but not sure I know enough to figure this one out on y own.

Station ID 611 (Times sq) does not display

Hello!

I am having an issue with station ID 671, it does not display regardless of the values I set in the config. My current entry for is looks like this :

      stationId: 671,
      walkingTime: 10,
      dir: {
          upTown: true,
          downTown: false

I changed the stationID value to that of other stations and they display without a hitch. I also stationID 471 is doing the same thing.

StationID 671
1

Different station
image

Multiple stations with same ID

@Elaniobro Not sure if I should open up another bug here, but I'm getting errors with station ID 461. Spot checking other IDs seem to be fine, but 461 in my config file outputs the below when I start Magic Mirror. If I have 2 stations and one of them is 461, neither shows up. I just get the "Next Train" header. LMK if I can help debug at all.

[19.02.2022 13:19.17.799] [ERROR] (node:11075) UnhandledPromiseRejectionWarning: Error: Error: invalid wire type 4 at offset 1 at /home/pi/Development/MagicMirror/modules/MMM-nyc-transit/node_helper.js:187:15 at processTicksAndRejections (internal/process/task_queues.js:97:5)

[19.02.2022 13:19.17.802] [ERROR] (node:11075) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)

[19.02.2022 13:19.17.805] [ERROR] (node:11075) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Originally posted by @george-dilthey in #25 (comment)

Unable to load Module

Attempting to install the MMM-nyc-transit module with difficulty. I see directory folder and i added to the config file but it will not run.

{
module: "MMM-nyc-transit",
position: "top_bar",
header: "Next Train",
config: {
apiKey: 'I HAVE APIKEY from MTA',
displayType: 'marquee',
mtaType: 'train',
stations: [237,238],
updateInterval: 300000,
walkingTime: 5,
}
},

[๐Ÿ› BUG] - Lines showing as 5X and 6X don't have formatting/color

Describe the bug
5X and 6X lines are displaying without any green background coloring

To Reproduce
Run the module for station ID 397 (uptown and downtown) and it should appear

Expected behavior
5X and 6X lines should have the green color/format behind them. Ideally these would just say 5 or 6 and have a green square background to indicate express lines

** Actual behavior**
5X and 6X lines do not have the green color/format behind them

Screenshots
image

Platform (please complete the following information):

  • Node Version:
  • Web Browser/Electron version:
  • Hardware [e.g. Raspberry Pi 2/3, Windows, Mac, Linux, System V UNIX]:

Configuration
What does the used config.js file look like? Don't forget to remove any sensitive information!

Additional context
Add any other context about the problem here.

[๐Ÿ› BUG] - Please update README.md

Issue
Two things:

  1. Update the description to the updated data feed site (Thanks Elaniobro): https://api.mta.info/
  2. Endpoint/station data doesn't seem to be available. Currently, the only real-time data available are of the lines themselves and not the station. Not sure if theres something that can be done with that

[๐Ÿ’ก FEATURE REQUEST] - Add list option

Can we change the output text of certain things. A.k.A instead of it saying 16th /8th can we have it set up to say Manhattan bound, Or Brooklyn Bound. Or north/south east/west. i Feel like that would be much more appealing to the eyes for people who dont want to see the same train mutliple times.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.