MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    MMM-MyTTC (Toronto Transit)

    Scheduled Pinned Locked Moved Transport
    27 Posts 9 Posters 14.7k Views 9 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J Offline
      j.e.f.f Project Sponsor Module Developer
      last edited by j.e.f.f

      Hi Folks

      This is my first module from scratch, and I’m pretty proud of it! If shows you how long you’ll need to wait for the next bus or streetcar to arrive at a particular stop. It shows up to the next 3 vehicles.

      [card:jclarke0000/MMM-MyTTC]

      0_1495764655969_MMM-MyTTC.png

      It currently doesn’t provide subway times as they aren’t available in TTC’s public API. Also of note is that if a particular route that you’ve specified isn’t currently running (e.g.: Overnight route, downtown express route, etc.) it will be hidden from display.

      Routes are colour-coded based on their type, and should match what you see on TTC.ca (regular routes are red, express routes are green, overnight routes are blue and white, etc.).

      To all my fellow Torontonians, enjoy!
      -Jeff

      1 Reply Last reply Reply Quote 0
      • lucallmonL Offline
        lucallmon
        last edited by

        @j-e-f-f is there any plan to expand this to other major cities? Could this be used for DC metro times? Perhaps wmata.com has an api. I’m not sure. I just think this would be helpful. Thoughts?

        J 1 Reply Last reply Reply Quote 0
        • J Offline
          j.e.f.f Project Sponsor Module Developer @lucallmon
          last edited by

          @lucallmon It uses the NextBus API. There are a bunch of transit systems across North America that use it. Here’s the list:

          http://webservices.nextbus.com/service/publicJSONFeed?command=agencyList

          I see DC Ciculator and DC Streetcar in the list… it would be fairly trivial to get this to work for them. That said, I’ve gone a bit further to tailor this for TTC. For example, I’ve added extra logic to color code the routes based on TTC’s naming scheme, and the streetcar icon is actually modeled after a Toronto streetcar :)

          I could probably make a generic version of the module to support any of the agencies in the list above.

          I 1 Reply Last reply Reply Quote 0
          • lucallmonL Offline
            lucallmon
            last edited by

            @j-e-f-f that would be sweet. I just found this page for DC Metro APIs: https://developer.wmata.com/

            maybe it will help.

            1 Reply Last reply Reply Quote 0
            • I Offline
              infinitempg @j.e.f.f
              last edited by

              @j.e.f.f any update on a generic version? I’d love to use this for the Rutgers University bus system!

              J 2 Replies Last reply Reply Quote 0
              • J Offline
                j.e.f.f Project Sponsor Module Developer @infinitempg
                last edited by

                @infinitempg My apologies on this! I’ve been pretty busy getting my own mirror up and running, so I’ve been focusing on other custom modules I’ve written to do very specific things. I promise I’ll get to this!

                1 Reply Last reply Reply Quote 1
                • J Offline
                  j.e.f.f Project Sponsor Module Developer @infinitempg
                  last edited by

                  @infinitempg I had a bit of time tonight to look at this. Try this:

                  [card:jclarke0000/MMM-MyNextBus]

                  Let me know if it’s working for you.

                  I 1 Reply Last reply Reply Quote 1
                  • I Offline
                    infinitempg @j.e.f.f
                    last edited by infinitempg

                    @j.e.f.f currently getting stuck on loading, even with the default configs. not sure if that’s because a lot of systems are closed right now or if I did something wrong.

                    I’ll check again in the morning.

                    (thanks for doing this btw!)

                    EDIT - aaaaaand suddenly it works. Just wanna say thanks!

                    J 2 Replies Last reply Reply Quote 0
                    • J Offline
                      j.e.f.f Project Sponsor Module Developer @infinitempg
                      last edited by

                      @infinitempg Wow! First try!! Keep an eye on it as I haven’t done any hardening on this. No idea if there are edge cases I hadn’t accounted for. If all goes well over the next few days, then I’ll announce the release in its own thread.

                      Glad you like it!
                      -Jeff

                      1 Reply Last reply Reply Quote 0
                      • J Offline
                        j.e.f.f Project Sponsor Module Developer @infinitempg
                        last edited by

                        @infinitempg Also, could you send me your config? I’ll monitor things on my end too, in case any errors get thrown.

                        I 1 Reply Last reply Reply Quote 0
                        • I Offline
                          infinitempg @j.e.f.f
                          last edited by

                          @j.e.f.f attached here:

                          /*************** AUTO GENERATED BY REMOTE CONTROL MODULE ***************/
                          
                          var config = 
                          {
                          	electronOptions: {
                          		
                          	},
                          	ipWhitelist: [
                          		
                          	],
                          	units: "imperial",
                          	modules: [
                          		{
                          			module: "alert",
                          			config: {
                          				
                          			}
                          		},
                          		{
                          			module: "updatenotification",
                          			position: "top_bar",
                          			config: {
                          				
                          			}
                          		},
                          		{
                          			module: "clock",
                          			position: "top_center",
                          			config: {
                          				clockBold: true
                          			}
                          		},
                          		{
                          			module: "calendar",
                          			position: "top_left",
                          			header: "Agenda",
                          			config: {
                          				timeFormat: "absolute",
                          				colored: "true",
                          				urgency: 2,
                          				calendars: [
                          					{
                          						symbol: "calendar-check-o ",
                          						url: "webcalhere"
                          					}
                          				],
                          				titleReplace: {
                          					"De verjaardag van ": "",
                          					"'s birthday": ""
                          				},
                          				excludedEvents: [
                          					
                          				],
                          				maximumEntries: 10
                          			}
                          		},
                          		{
                          			module: "MMM-MyWeather",
                          			position: "top_right",
                          			header: "Piscataway Weather",
                          			config: {
                          				apikey: "api here",
                          				pws: "pws:IGELDERL219",
                          				hourly: "1",
                          				fcdaycount: "5",
                          				alerttime: 10000,
                          				alerttruncatestring: "english:",
                          				iconTableDay: {
                          					chanceflurries: "wi-day-snow-wind",
                          					chancerain: "wi-day-showers",
                          					chancesleet: "wi-day-sleet",
                          					chancesnow: "wi-day-snow",
                          					chancetstorms: "wi-day-storm-showers",
                          					clear: "wi-day-sunny",
                          					cloudy: "wi-cloud",
                          					flurries: "wi-snow-wind",
                          					fog: "wi-fog",
                          					haze: "wi-day-haze",
                          					hazy: "wi-day-haze",
                          					mostlycloudy: "wi-cloudy",
                          					mostlysunny: "wi-day-sunny-overcast",
                          					partlycloudy: "wi-day-cloudy",
                          					partlysunny: "wi-day-cloudy-high",
                          					rain: "wi-rain",
                          					sleet: "wi-sleet",
                          					snow: "wi-snow",
                          					tstorms: "wi-thunderstorm"
                          				},
                          				iconTableNight: {
                          					chanceflurries: "wi-night-snow-wind",
                          					chancerain: "wi-night-showers",
                          					chancesleet: "wi-night-sleet",
                          					chancesnow: "wi-night-alt-snow",
                          					chancetstorms: "wi-night-alt-storm-showers",
                          					clear: "wi-night-clear",
                          					cloudy: "wi-night-alt-cloudy",
                          					flurries: "wi-night-alt-snow-wind",
                          					fog: "wi-night-fog",
                          					haze: "wi-night-alt-cloudy-windy",
                          					hazy: "wi-night-alt-cloudy-windy",
                          					mostlycloudy: "wi-night-alt-cloudy",
                          					mostlysunny: "wi-night-alt-partly-cloudy",
                          					partlycloudy: "wi-night-alt-partly-cloudy",
                          					partlysunny: "wi-night-alt-partly-cloudy",
                          					rain: "wi-night-alt-rain",
                          					sleet: "wi-night-alt-sleet",
                          					snow: "wi-night-alt-snow",
                          					tstorms: "wi-night-alt-thunderstorm"
                          				},
                          				iconTableCompliments: {
                          					chanceflurries: "13",
                          					chancerain: "10",
                          					chancesleet: "13",
                          					chancesnow: "13",
                          					chancetstorms: "11",
                          					clear: "01",
                          					cloudy: "02",
                          					flurries: "13",
                          					fog: "50",
                          					haze: "50",
                          					hazy: "50",
                          					mostlycloudy: "03",
                          					mostlysunny: "02",
                          					partlycloudy: "02",
                          					partlysunny: "02",
                          					rain: "10",
                          					sleet: "13",
                          					snow: "13",
                          					tstorms: "11"
                          				},
                          				windunits: "mph",
                          				UseCardinals: 1
                          			}
                          		},
                          		{
                          			module: "MMM-Remote-Control",
                          			config: {
                          				
                          			}
                          		},
                          		{
                          			module: "MMM-MyNextBus",
                          			position: "bottom_left",
                          			header: "Rutgers Bus Schedule",
                          			config: {
                          				agency: "rutgers",
                          				routeList: [
                          					{
                          						routeNo: "a",
                          						stop: "hillw"
                          					},
                          					{
                          						routeNo: "b",
                          						stop: "hillw"
                          					},
                          					{
                          						routeNo: "rexb",
                          						stop: "hillw"
                          					},
                          					{
                          						routeNo: "h",
                          						stop: "hilln"
                          					},
                          					{
                          						routeNo: "wknd1",
                          						stop: "hillw"
                          					},
                          					{
                          						routeNo: "wknd2",
                          						stop: "hilln"
                          					}
                          				]
                          			}
                          		},
                          		{
                          			module: "newsfeed",
                          			position: "bottom_center",
                          			config: {
                          				showDescription: true,
                          				feeds: [
                          					{
                          						title: "New York Times",
                          						url: "http://www.nytimes.com/services/xml/rss/nyt/HomePage.xml"
                          					},
                          					{
                          						title: "Associated Press",
                          						url: "http://hosted2.ap.org/atom/APDEFAULT/3d281c11a96b4ad082fe88aa0db04305"
                          					},
                          					{
                          						title: "BBC",
                          						url: "http://feeds.bbci.co.uk/news/world/rss.xml#"
                          					}
                          				],
                          				startTags: [
                          					
                          				],
                          				endTags: [
                          					
                          				]
                          			}
                          		},
                          		{
                          			module: "MMM-RandomPhoto",
                          			position: "fullscreen_below",
                          			header: "",
                          			config: {
                          				animationSpeed: 2000,
                          				updateInterval: 120
                          			}
                          		}
                          	],
                          	paths: {
                          		modules: "modules",
                          		vendor: "vendor"
                          	}
                          }
                          
                          /*************** DO NOT EDIT THE LINE BELOW ***************/
                          if (typeof module !== 'undefined') {module.exports = config;}
                          
                          

                          Cleaned out some API keys and calendar stuff but otherwise here it is. Not really using as a mirror but as a dashboard/display, which I think looks nice. Considering putting it up in a Rutgers buidling, but that’s all tentative.

                          J 1 Reply Last reply Reply Quote 0
                          • J Offline
                            j.e.f.f Project Sponsor Module Developer @infinitempg
                            last edited by j.e.f.f

                            @infinitempg I see you’ve got 6 routes configured, but only two are showing. This would be normal behaviour if those other 4 aren’t currently running. e.g.: is it expected that only WKND1 and WKND2 are running right now?

                            I 1 Reply Last reply Reply Quote 0
                            • I Offline
                              infinitempg @j.e.f.f
                              last edited by

                              @j.e.f.f yeah, the other busses aren’t running currently since it’s summer.

                              J 1 Reply Last reply Reply Quote 0
                              • J Offline
                                j.e.f.f Project Sponsor Module Developer @infinitempg
                                last edited by

                                @infinitempg OK That’s good! So far it looks like it’s working nicely then.

                                I 1 Reply Last reply Reply Quote 0
                                • I Offline
                                  infinitempg @j.e.f.f
                                  last edited by

                                  @j.e.f.f yup! The only problem I seem to be having is that the colors do not work.

                                  {
                                  	routeNo: "wknd1",
                                  	stop: "hillw",
                                  	color : '#82BAE5' //colours the transit icon a light blue colour
                                  },
                                  

                                  That’s what I have right now, but it still shows up as white.

                                  J 1 Reply Last reply Reply Quote 0
                                  • J Offline
                                    j.e.f.f Project Sponsor Module Developer @infinitempg
                                    last edited by

                                    @infinitempg Take a look at the Readme:
                                    https://github.com/jclarke0000/MMM-MyNextBus

                                    All the way at the bottom it tells you how to configure color. It’s different for the generic version than it is for TTC.

                                    I 1 Reply Last reply Reply Quote 0
                                    • I Offline
                                      infinitempg @j.e.f.f
                                      last edited by

                                      @j.e.f.f I guess the mirror is smarter than I am…

                                      Thanks! Works like a charm.

                                      1 Reply Last reply Reply Quote 0
                                      • SexyTroggS Offline
                                        SexyTrogg
                                        last edited by

                                        This post is deleted!
                                        1 Reply Last reply Reply Quote 0
                                        • K Offline
                                          kingveder
                                          last edited by

                                          Hey Jeff,
                                          The actual badge for the bus number is it possible to change this color?
                                          The color works for me but it just changes the color of the bus/streetcar icon.
                                          Thanks
                                          Ru

                                          Mykle1M 1 Reply Last reply Reply Quote 0
                                          • Mykle1M Offline
                                            Mykle1 Project Sponsor Module Developer @kingveder
                                            last edited by

                                            @kingveder

                                            This may help.

                                            From the readMe

                                            Finally, it you would like to colour code your entries, you can specify an optional parameter ‘color’ property that will give the icon whatever color you specify in hexadecimal format. e.g.:

                                            {
                                              routeNo : '501',
                                              stop : '6108',
                                              label : 'Queen Westbound',
                                              color : '#82BAE5' //colours the transit icon a light blue colour
                                            },
                                            

                                            Create a working config
                                            How to add modules

                                            T 1 Reply Last reply Reply Quote 0

                                            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                            With your input, this post could be even better 💗

                                            Register Login
                                            • 1
                                            • 2
                                            • 2 / 2
                                            • First post
                                              Last post
                                            Enjoying MagicMirror? Please consider a donation!
                                            MagicMirror created by Michael Teeuw.
                                            Forum managed by Sam, technical setup by Karsten.
                                            This forum is using NodeBB as its core | Contributors
                                            Contact | Privacy Policy