menturan / mmm-openinghours Goto Github PK
View Code? Open in Web Editor NEWMagic Mirror module that displays places opening hours.
License: GNU General Public License v3.0
Magic Mirror module that displays places opening hours.
License: GNU General Public License v3.0
I would be nice if you could use this module without having to go through Google Places API.
In the config, provide a list of places.
The esiest would be to mimic the Places API response.
confg: {
ownProvidedPlaces: [{
"name": "My Place",
"opening_hours": {
"open_now": false,
"periods": [
{
"close": {
"day": 0,
"time": "2200"
},
"open": {
"day": 0,
"time": "0800"
}
},
]
}
}]
}
$ cd MagicMirror/modules
$ git clone https://github.com/Menturan/MMM-OpeningHours.git
after them i got following errors:
0|MagicMir | App threw an error during load 0|MagicMir | Error: Cannot find module '@google/maps' 0|MagicMir | at Module._resolveFilename (internal/modules/cjs/loader.js:602:15) 0|MagicMir | at Function.Module._resolveFilename (/home/pi/MagicMirror/node_modules/electron/dist/resources/electron.asar/common/reset-search-paths.js:35:12) 0|MagicMir | at Function.Module._load (internal/modules/cjs/loader.js:528:25) 0|MagicMir | at Module.require (internal/modules/cjs/loader.js:658:17) 0|MagicMir | at require (internal/modules/cjs/helpers.js:20:18) 0|MagicMir | at Object.<anonymous> (/home/pi/MagicMirror/modules/MMM-OpeningHours/node_helper.js:3:14) 0|MagicMir | at Object.<anonymous> (/home/pi/MagicMirror/modules/MMM-OpeningHours/node_helper.js:133:3) 0|MagicMir | at Module._compile (internal/modules/cjs/loader.js:711:30) 0|MagicMir | at Object.Module._extensions..js (internal/modules/cjs/loader.js:722:10) 0|MagicMir | at Module.load (internal/modules/cjs/loader.js:620:32) 0|MagicMir | Whoops! There was an uncaught exception... 0|MagicMir | { Error: Cannot find module '@google/maps' 0|MagicMir | at Module._resolveFilename (internal/modules/cjs/loader.js:602:15) 0|MagicMir | at Function.Module._resolveFilename (/home/pi/MagicMirror/node_modules/electron/dist/resources/electron.asar/common/reset-search-paths.js:35:12) 0|MagicMir | at Function.Module._load (internal/modules/cjs/loader.js:528:25) 0|MagicMir | at Module.require (internal/modules/cjs/loader.js:658:17) 0|MagicMir | at require (internal/modules/cjs/helpers.js:20:18) 0|MagicMir | at Object.<anonymous> (/home/pi/MagicMirror/modules/MMM-OpeningHours/node_helper.js:3:14) 0|MagicMir | at Object.<anonymous> (/home/pi/MagicMirror/modules/MMM-OpeningHours/node_helper.js:133:3) 0|MagicMir | at Module._compile (internal/modules/cjs/loader.js:711:30) 0|MagicMir | at Object.Module._extensions..js (internal/modules/cjs/loader.js:722:10) 0|MagicMir | at Module.load (internal/modules/cjs/loader.js:620:32) code: 'MODULE_NOT_FOUND' }
anybody knows whats wrong?
Hi,
Is it possible to display the weekday_text (open/closed times for all 7 days) as well as the opening state for the current day ?
Alternatively could I modify the module to do this ?
Thank you.
error An unexpected error occurred: "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.14.0.tgz: Request failed \"404 Not Found\"".
Awesome module, thanks for coding it!
Some places have quite long names. Suggestion to add optional "alias" for each PlaceID in the config.
If no "alias" is provided, the full name will be used.
Thanks in advance.
BR
Tilly
OpeningHours doesn't display anymore for me. I get :
[11.11.2022 11:43.03.691] [ERROR] An error occurred during evaluation of the value "Tu 16:15-18:30, We 10:00-12:30, We 13:30-18:30, Th 16:15-18:30, Fr 16:15-18:30, Sa 10:00-12:30, Sa 13:30-17:00; PH off; SH Tu 16:00-18:30, We 10:00-12:00, We 13:30-18:30, Th 10:00-12:00, Th 16:00-18:30, Fr 16:00-18:30". Please submit a pull request: https://github.com/opening-hours/opening_hours.js. School holiday not defined for the year 2022.
I think opening_hours should be upgraded ?
It seems that holidays for 2022 are in https://github.com/opening-hours/opening_hours.js/blob/master/src/holidays/fr.yaml#L390
But maybe this is not included in the 3.7.0 release https://github.com/opening-hours/opening_hours.js/releases ?
Add an interval that updates the ui every minute, so the closing/opening times recalculates.
After verifying for weeks that there is no limitation going with the Google API, it seems that there are some issues while getting more than one place using this module. It gets stuck in a infinite "Loading..." state
I found some 403 errors in the logs while running this at the beginning, but I upgraded to a Premium account in Google and it seems that the errors are still going on. Here are the logs that appear when starting MagicMirror through npm start (hiding places names):
[19:53:38] - DEBUG - MMM-OpeningHours : Response - { status: 200,
headers:
{ 'content-type': 'application/json; charset=UTF-8',
date: 'Sun, 19 May 2019 17:53:38 GMT',
expires: 'Sun, 19 May 2019 17:58:38 GMT',
'cache-control': 'public, max-age=300',
server: 'scaffolding on HTTPServer2',
'x-xss-protection': '0',
'x-frame-options': 'SAMEORIGIN',
'server-timing': 'gfet4t7; dur=118',
'alt-svc': 'quic=":443"; ma=2592000; v="46,44,43,39"',
'accept-ranges': 'none',
vary: 'Accept-Encoding',
connection: 'close' },
json:
{ html_attributions: [],
result: { name: 'X', opening_hours: [Object] },
status: 'OK' },
requestUrl:
'https://maps.googleapis.com/maps/api/place/details/json?fields=name%2Copening_hours&language=es&placeid=ChIJAWUYvG5sEg0RNC_oa2_gxxx&key=[HIDDEN]',
query:
{ fields: 'name,opening_hours',
language: 'es',
placeid: 'ChIJAWUYvG5sEg0RNC_oa2_XXXX',
key: '[HIDDEN]' } }
[19:53:38] - DEBUG - MMM-OpeningHours : Response.json.result - { name: SOMEPLACE',
opening_hours:
{ open_now: true,
periods:
[ [Object],
[Object],
[Object],
[Object],
[Object],
[Object],
[Object] ],
weekday_text:
[ 'lunes: 13:00–24:00',
'martes: 13:00–24:00',
'miércoles: 13:00–24:00',
'jueves: 13:00–24:00',
'viernes: 13:00–24:00',
'sábado: 13:00–24:00',
'domingo: 13:00–24:00' ] } }
[19:53:38] - DEBUG - MMM-OpeningHours : Response - { status: 200,
headers:
{ 'content-type': 'application/json; charset=UTF-8',
date: 'Sun, 19 May 2019 17:53:38 GMT',
expires: 'Sun, 19 May 2019 17:58:38 GMT',
'cache-control': 'public, max-age=300',
server: 'scaffolding on HTTPServer2',
'x-xss-protection': '0',
'x-frame-options': 'SAMEORIGIN',
'server-timing': 'gfet4t7; dur=120',
'alt-svc': 'quic=":443"; ma=2592000; v="46,44,43,39"',
'accept-ranges': 'none',
vary: 'Accept-Encoding',
connection: 'close' },
json:
{ html_attributions: [],
result: { name: 'Lidl', opening_hours: [Object] },
status: 'OK' },
requestUrl:
'https://maps.googleapis.com/maps/api/place/details/json?fields=name%2Copening_hours&language=es&placeid=ChIJXQ1XuWpsEg0RkbqBx1XXXX&key=[HIDDEN]',
query:
{ fields: 'name,opening_hours',
language: 'es',
placeid: 'ChIJXQ1XuWpsEg0RkbqBx1OXXXX',
key: '[HIDDEN]' } }
[19:53:38] - DEBUG - MMM-OpeningHours : Response.json.result - { name: 'Lidl',
opening_hours:
{ open_now: false,
periods:
[ [Object], [Object], [Object], [Object], [Object], [Object] ],
weekday_text:
[ 'lunes: 9:00–21:30',
'martes: 9:00–21:30',
'miércoles: 9:00–21:30',
'jueves: 9:00–21:30',
'viernes: 9:00–21:30',
'sábado: 9:00–21:30',
'domingo: Cerrado' ] } }
[19:53:38] - DEBUG - MMM-OpeningHours : Response - { status: 200,
headers:
{ 'content-type': 'application/json; charset=UTF-8',
date: 'Sun, 19 May 2019 17:53:38 GMT',
expires: 'Sun, 19 May 2019 17:58:38 GMT',
'cache-control': 'public, max-age=300',
server: 'scaffolding on HTTPServer2',
'x-xss-protection': '0',
'x-frame-options': 'SAMEORIGIN',
'server-timing': 'gfet4t7; dur=208',
'alt-svc': 'quic=":443"; ma=2592000; v="46,44,43,39"',
'accept-ranges': 'none',
vary: 'Accept-Encoding',
connection: 'close' },
json:
{ html_attributions: [],
result: { name: 'SOMEPLACE', opening_hours: [Object] },
status: 'OK' },
requestUrl:
'https://maps.googleapis.com/maps/api/place/details/json?fields=name%2Copening_hours&language=es&placeid=ChIJQQDaGGxsEg0RNILE38XXXXX&key=[HIDDEN]',
query:
{ fields: 'name,opening_hours',
language: 'es',
placeid: 'ChIJQQDaGGxsEg0RNILE38XXXXX',
key: '[HIDDEN]' } }
[19:53:38] - DEBUG - MMM-OpeningHours : Response.json.result - { name: 'SOMEPLACE',
opening_hours:
{ open_now: false,
periods:
[ [Object],
[Object],
[Object],
[Object],
[Object],
[Object],
[Object],
[Object],
[Object],
[Object],
[Object] ],
weekday_text:
[ 'lunes: Cerrado',
'martes: 13:00–16:00, 20:30–23:00',
'miércoles: 13:00–16:00, 20:30–23:00',
'jueves: 13:00–16:00, 20:30–23:00',
'viernes: 13:00–16:00, 20:30–23:00',
'sábado: 13:00–16:00, 20:30–23:00',
'domingo: 13:00–16:00' ] } }
[19:53:38] - DEBUG - MMM-OpeningHours : Response - { status: 200,
headers:
{ 'content-type': 'application/json; charset=UTF-8',
date: 'Sun, 19 May 2019 17:53:38 GMT',
expires: 'Sun, 19 May 2019 17:58:38 GMT',
'cache-control': 'public, max-age=300',
server: 'scaffolding on HTTPServer2',
'x-xss-protection': '0',
'x-frame-options': 'SAMEORIGIN',
'server-timing': 'gfet4t7; dur=106',
'alt-svc': 'quic=":443"; ma=2592000; v="46,44,43,39"',
'accept-ranges': 'none',
vary: 'Accept-Encoding',
connection: 'close' },
json:
{ html_attributions: [],
result: { name: 'SOMEPLACE', opening_hours: [Object] },
status: 'OK' },
requestUrl:
'https://maps.googleapis.com/maps/api/place/details/json?fields=name%2Copening_hours&language=es&placeid=ChIJx5EBKW9sEg0RjZQlE_XXXXX&key=[HIDDEN]',
query:
{ fields: 'name,opening_hours',
language: 'es',
placeid: 'ChIJx5EBKW9sEg0RjZQlE_XXXX',
key: '[HIDDEN]' } }
[19:53:38] - DEBUG - MMM-OpeningHours : Response.json.result - { name: 'SOMEPLACE',
opening_hours:
{ open_now: true,
periods:
[ [Object],
[Object],
[Object],
[Object],
[Object],
[Object],
[Object] ],
weekday_text:
[ 'lunes: 13:00–24:00',
'martes: 20:00–24:00',
'miércoles: 13:00–24:00',
'jueves: 13:00–24:00',
'viernes: 13:00–0:30',
'sábado: 13:00–0:30',
'domingo: 13:00–24:00' ] } }
[19:53:38] - DEBUG - MMM-OpeningHours : Response - { status: 200,
headers:
{ 'content-type': 'application/json; charset=UTF-8',
date: 'Sun, 19 May 2019 17:53:38 GMT',
expires: 'Sun, 19 May 2019 17:58:38 GMT',
'cache-control': 'public, max-age=300',
server: 'scaffolding on HTTPServer2',
'x-xss-protection': '0',
'x-frame-options': 'SAMEORIGIN',
'server-timing': 'gfet4t7; dur=188',
'alt-svc': 'quic=":443"; ma=2592000; v="46,44,43,39"',
'accept-ranges': 'none',
vary: 'Accept-Encoding',
connection: 'close' },
json:
{ html_attributions: [],
result: { name: 'SOMEPLACE', opening_hours: [Object] },
status: 'OK' },
requestUrl:
'https://maps.googleapis.com/maps/api/place/details/json?fields=name%2Copening_hours&language=es&placeid=ChIJNYda7WtsEg0RCC83FLkXXXX&key=[HIDDEN]',
query:
{ fields: 'name,opening_hours',
language: 'es',
placeid: 'ChIJNYda7WtsEg0RCC83FLkXXXX',
key: '[HIDDEN]' } }
[19:53:38] - DEBUG - MMM-OpeningHours : Response.json.result - { name: 'SOMEPLACE',
opening_hours:
{ open_now: false,
periods:
[ [Object],
[Object],
[Object],
[Object],
[Object],
[Object],
[Object] ],
weekday_text:
[ 'lunes: 6:00–23:00',
'martes: 6:00–23:00',
'miércoles: 6:00–23:00',
'jueves: 6:00–23:00',
'viernes: 6:00–23:00',
'sábado: 9:00–21:00',
'domingo: 9:00–15:00' ] } }
[19:53:38] - DEBUG - MMM-OpeningHours : Response - { status: 200,
headers:
{ 'content-type': 'application/json; charset=UTF-8',
date: 'Sun, 19 May 2019 17:53:38 GMT',
expires: 'Sun, 19 May 2019 17:58:38 GMT',
'cache-control': 'public, max-age=300',
server: 'scaffolding on HTTPServer2',
'x-xss-protection': '0',
'x-frame-options': 'SAMEORIGIN',
'server-timing': 'gfet4t7; dur=96',
'alt-svc': 'quic=":443"; ma=2592000; v="46,44,43,39"',
'accept-ranges': 'none',
vary: 'Accept-Encoding',
connection: 'close' },
json:
{ html_attributions: [],
result: { name: 'Burger King' },
status: 'OK' },
requestUrl:
'https://maps.googleapis.com/maps/api/place/details/json?fields=name%2Copening_hours&language=es&placeid=ChIJ4Wft4C9tEg0Rlp6tR1XXXX&key=[HIDDEN]',
query:
{ fields: 'name,opening_hours',
language: 'es',
placeid: 'ChIJ4Wft4C9tEg0Rlp6tR14XXXX',
key: '[HIDDEN]' } }
[19:53:38] - DEBUG - MMM-OpeningHours : Response.json.result - { name: 'Burger King' }
[19:53:38] - DEBUG - MMM-OpeningHours : Sending to frontend - [ { name: 'Someplace',
opening_hours: { open_now: true, periods: [Array], weekday_text: [Array] } },
{ name: 'Lidl',
opening_hours: { open_now: false, periods: [Array], weekday_text: [Array] } },
{ name: 'Someplace',
opening_hours: { open_now: false, periods: [Array], weekday_text: [Array] } },
{ name: 'someplace',
opening_hours: { open_now: true, periods: [Array], weekday_text: [Array] } },
{ name: 'someplace',
opening_hours: { open_now: false, periods: [Array], weekday_text: [Array] } },
{ name: 'Burger King' } ]
I use the same API key in other modules, it's that an issue? I hope not, as everything looks good in my side and the module works flawlessly with only one place configured.
I'm sorry if this is totally out of topic, feel free to shut this issue if this is the case.
I'm looking for the functionality of this plugin but without using google's data or API. I'd be interested in extracting the data from the OSM geographical database https://www.openstreetmap.org/ In OSM the opening_hours tag is documented here : https://wiki.openstreetmap.org/wiki/Key:opening_hours and I have found a javascript library which could be of some help to add support here (or a separate plugin) : https://github.com/AMDmi3/opening_hours.js
Does that seem feasible ? reasonable ? a completely different plugin ? does it already exist elsewhere ?
I'd be happy to help out but have little skills in javascript, and no idea (yet) on how much time I'd be ready to put into this (I've just started building a mirror, so not sure yet).
Thanks for your feedback.
warning @google/[email protected]: Please use @googlemaps/google-maps-services-js instead.
https://www.npmjs.com/package/@googlemaps/google-maps-services-js
I'm not sure the API is the same so it probably requires some work.
I've tried to work out how to get this working but having no luck can someone write a step by step as this look really coom just can't get it to run
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.