Allow configuring timezone
berlincount opened this issue · 8 comments
The timezone of my host system is configured as UTC (Europe/Reykjavík comes close) without daylight saving, and while I can configure the display TZ for the clock (via it's timezone
configuration option), I can't for MMM-PublicTransportBerlin, resulting in always wrong times :-/
Hi @berlincount,
I don't really understand what you want to do. The departure times are directly taken as they are received from the backend. Why would one have them in another TZ? If you are in another timezone, how do you want to catch trains in Berlin?
Anyways, I can add a timezone adjustment, but I don't know when I will find time for this. PRs are definitely welcome.
Right now, my clock is showing 21:21, and MMM-PTB is showing trips for starting 20:21-20:29 .. I've no idea what's going on under the hood and whether that are actually 21:21-21:29 trips, but ... it's certainly not correct :)
I understand. Could you please paste your module config here?
sure! somewhat complete config:
var config = {
address: "0.0.0.0", // 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, is "localhost"
port: 8181,
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"],
//ipWhitelist: [], // 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"],
language: "de",
timeFormat: 24,
units: "metric",
modules: [
{
module: 'clock',
position: 'top_left',
config: {
displayType: 'both',
analogPlacement: 'left',
analogFace: 'face-002',
analogSize: '90px',
timezone: "Europe/Berlin"
},
classes: 'default everyone'
},
{
module: 'MMM-PublicTransportBerlin',
position: 'top_left',
config: {
name: "U Pankstrasse",
stationId: "900000009203",
travelTimeToStation: 5,
interval: 120000,
departureMinutes: 30,
maxDepartures: 15,
marqueeLongDirections: true,
showColoredLineSymbols: true,
useColorForRealtimeInfo: true,
showTableHeadersAsSymbols: true,
maxUnreachableDepartures: 2,
maxReachableDepartures: 4,
fadeUnreachableDepartures: true,
fadeReachableDepartures: false,
fadePointForReachableDepartures: 0.25,
timezone: "Europe/Berlin"
},
classes: 'default'
},
{
module: 'MMM-PublicTransportBerlin',
position: 'top_left',
config: {
name: "S+U Gesundbrunnen",
stationId: "900000007102",
travelTimeToStation: 12,
interval: 120000,
departureMinutes: 30,
maxDepartures: 15,
marqueeLongDirections: true,
showColoredLineSymbols: true,
useColorForRealtimeInfo: true,
showTableHeadersAsSymbols: true,
maxUnreachableDepartures: 2,
maxReachableDepartures: 8,
fadeUnreachableDepartures: true,
fadeReachableDepartures: false,
fadePointForReachableDepartures: 0.25,
timezone: "Europe/Berlin"
},
classes: 'default'
}
},
]
};
/*************** DO NOT EDIT THE LINE BELOW ***************/
if (typeof module !== "undefined") { module.exports = config; }
note the difference in times on the clock and in the departures
but huh, env for node seems to be different than expected 🤔
root@magicmirror:/opt/magic_mirror/config# strings /proc/1/environ
HOSTNAME=magicmirror
YARN_VERSION=1.22.5
PWD=/opt/magic_mirror
NODE_ENV=production
TZ=Europe/Berlin
HOME=/root
SHLVL=0
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
NODE_VERSION=12.20.0
root@magicmirror:/opt/magic_mirror/config# locale
LANG=
LANGUAGE=
LC_CTYPE="POSIX"
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=
thanks for the help, and have a good start into the new year!
@berlincount: As a workaround you could add 60 minutes to travelTimeToStation
🙂
I just tested it with your timezone and configuration. Looks like it works.
Seems to work for me as well, albeit requests for VBB info seems to be stuck a bit lately.
albeit requests for VBB info seems to be stuck a bit lately.
Are you using the current version of the module? We recently made some changes.