/MMM-OpeningHours

Magic Mirror module that displays places opening hours.

Primary LanguageJavaScriptGNU General Public License v3.0GPL-3.0

MMM-OpeningHours - WIP

Known Vulnerabilities LGTM Alerts LGTM Grade Yarn

Say Thanks! Maintenance GitHub commit activity GitHub License

Note! This module is still under development! Things such as configurations and appearance may change. Use at your own risk!

Magic Mirror module that displays places opening hours. Relies on Google Places API.

Screenshot

Screenshot

Prerequisite

You need to have a Google Places API key to use this module. Follow their guide here: Get API Key.

NOTE! The opening hours field in Google Places API is a billed field. However, Google give you a free monthly credit. Please carefully read about their billing here. Contributors of this module is not responsible for any charges.

Install

This module uses Yarn.

  1. yarn install

Find places ID

Search for the place to get its ID. You really needs to search for a place. Clicking on a place wont cut it.

Place ID Finder

Configuration

Key Value Required Default Description
googleApiKey string Yes N/A Your Google Places API Key.
places See below. Yes N/A List of place ids. See above.
scheduleTime milliseconds No 86400000 (24h) Time between fetching place data from Google.
timeFormat number No config.timeFormat 24h, 12h. If not specified, uses same as parent config.
language ISO 639-1 code No config.language Changes the translation. Time and date is still locale. Two letter country code. ISO 639-1 code. If not specified, uses same as parent config.
styling object No See next table. Configure table style.
debug boolean No false Debug output.
mockData boolean No false Fake API-call. Used for development.

Places config

Places are provided as a list []. Example - ["place_id_1", "place_id_2", "place_id_3"].

If you would like to use an alias for a place you put the place id and the alias in a list with the place id first. Example - ["place_id_1", ["place_id_2", "Place 2"], "place_id_3"].

Styling

Key Value Required Default Description
showTimeUntil boolean No false Show time until close/open instead of time when closed/open.
textAlign string No center Table text alignment. Possible values: left, right, center.
size string No small Size of table. Possible values: xsmall, small, medium. large, xlarge.

Example config

{
    module: "MMM-OpeningHours",
    position: "bottom_right",
    header: "Opening hours",
    config: {
    googleApiKey: "XXXXXXXXXXXXXX",
        places: ["xxxxxxxx", ["yyyyyyyy", "Alias y"]],
        styling: {
          size: 'small'
        }
    }
}

Development

This module isn't perfect. If you find a bug or has a feature request don't hesitate to create an issue OR even better, create a pull request! :D