Giter VIP home page Giter VIP logo

mmm-swisscommute's Introduction

MMM-SwissCommute

This is a module for the MagicMirror².

It displays the next departures for your favorite (train) connection including delays and track change information.

This module is based on the search.ch Fahrplan API https://fahrplan.search.ch/api/help

Using the module

To use this module, add the following configuration block to the modules array in the config/config.js file:

modules: [
	{
		module: 'MMM-SwissCommute',
		position: 'bottom_left',
		header: 'Train Connections',
		config: {
			from: 'Zürich HB', // Start train station
			to: 'Basel SBB', // Destination station
			maximumEntries: 4, // Max departures displayed
			minWalkingTime: 10 // Minimum time to get to the station
		}
	},
]

Configuration options

Option Description
from Required Departure station
to Required Destination station
maximumEntries Optional Maximum number of entries in list

Type: int
Default 10
minWalkingTime Optional Minimum time in minutes to reach the from station. Used to highlight a connection in red in case cannot be reached in time

Type: int
Default -1
hideTrackInfo Optional Hide the track column

Type: int
Default 0

mmm-swisscommute's People

Contributors

nixnuex avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

mmm-swisscommute's Issues

Change icon depending on means of transportation

Hi
First of all, thanks for this great module. It works perfectly as is.
I have a little request: Would it be possible to change the icon of the connection based on the type of vehicle (train, tram, bus)?

User @vanhoekd managed to do this in his module MMM-SwissStationboard, which is based off your module.

Because I have little to zero experience with javascript and css, i couldn't make it work by just copy-pasting from his code into yours. In your MMM-SwissCommute.js from line 107 onward, (i believe) you define/set the train icon and number

// Number var trainNumberCell = document.createElement("td"); trainNumberCell.innerHTML = "<i class=\"fa fa-train\"></i> " + trains.number; trainNumberCell.className = "align-left"; row.appendChild(trainNumberCell);

User @vanhoekd made some if-else statements to determine the icon in his script from line 148 onward:

// Number var trainNumberCell = document.createElement("td"); if (trains.type.localeCompare("bus")==0 || trains.type.localeCompare("post")==0){ trainNumberCell.innerHTML = "<i class=\"fa fa-bus\"></i> " + trains.number; } else if(trains.type.localeCompare("tram")==0){ trainNumberCell.innerHTML = "<i class=\"fa fa-subway\"></i> " + trains.number; }else if(trains.type.localeCompare("strain")==0 || trains.type.localeCompare("express_train")==0 || trains.type.localeCompare("train")==0){ trainNumberCell.innerHTML = "<i class=\"fa fa-train\"></i> " + trains.number; }else{ trainNumberCell.innerHTML = "<i class=\"fa fa-rocket\"></i> " + trains.number; }

Although the code looks very similar, when i copied his code into your script, the connections wouldn't load anymore on the mirror. Any idea how i could fix this?

Thanks in advance!

Full Stack IOS engineering job at fast traction startup

Hi Nixnuex,

I'm the CEO of Scope. I came across your profile and saw you attended make school, and it reminded me that we are actively hiring for talented engineers. I wanted to see if you'd be interested in working with us at Scope— if you're up for it, I'd love to have a phone call next week to chat.

  • Pranav Neyveli

Display multiple MMM-SwissCommute modules beneath each other

Hey nixnuex,

thanks for this awesome module!

Is there really a need for "display: inline-block;" in the css?
If multiple instances of the module are loaded they are displayed in the same row. Removing "display: inline-block;" seems to fix this issue.

Cheers,
m

Keine Anzeige im MagicMirror

Hallo
Habe das Modul via git clone installiert und das config.js entsprechend erweitert.
Doch leider sehe ich gar nichts. Was mache ich wohl falsch? Hast du einen Tipp für mich?
Gruss

Anzeige Bus

Hi
Mache ich was falsch oder unterstütz das Plugin keine Bus-Verbindungen?
Habe diverses getestet leider ohne erfolg.

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.