Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Compliments module has anytime array mandatory #3385

Closed
Feedy88 opened this issue Feb 23, 2024 · 7 comments
Closed

Bug: Compliments module has anytime array mandatory #3385

Feedy88 opened this issue Feb 23, 2024 · 7 comments

Comments

@Feedy88
Copy link

Feedy88 commented Feb 23, 2024

If the compliments module is configured to only specific dates (e.g. Birthdays, Anniversaries), the Mirror will freeze on dates that are not configured to show a compliment. The freeze happens based on the time set for updateInterval. This forces to also configure anytime to bypass the issue.

@sdetweil
Copy link
Collaborator

sdetweil commented Feb 23, 2024

the issue is that the module expects the anytime list to be present, and crashes when it's not

there should be a test for anytime before adding them to the list

@rejas
Copy link
Collaborator

rejas commented Mar 14, 2024

sorry for not answering sooner. cant reproduce your error with a config like this:

{
  module: "compliments",
  position: "top_bar",
  config: {
    compliments: {
      "....-03-14": ["Happy Birthday ❤️", "Happy Birthday 🌻"]
    }		
  }
},

how does your config look?

@sdetweil
Copy link
Collaborator

the code should fail, as this line of code is always executed
line 102 on release 2.26

                // Add compliments for anytime
                Array.prototype.push.apply(compliments, this.config.compliments.anytime);  //< --- anytime doesnt exist

@Feedy88
Copy link
Author

Feedy88 commented Mar 14, 2024

@rejas it works if it finds an entry for the current day. Try changing to "....-03-15" and the issue should be reproducible.

@rejas
Copy link
Collaborator

rejas commented Mar 14, 2024

Nope, still cant reproduce any error with this.
a) please describe "will freeze" a little more. do you errors on the console?
b) what is your config exactly? (minus private data)
c) are you using the electron version or are you using a browser to display the compliment module?

@Feedy88
Copy link
Author

Feedy88 commented Mar 22, 2024

a) All time-relevant modules will freeze and no longer rotate (Clock seconds are no longer increasing, newsfeed module is stuck and does not rotate, Pir module does not count down and does not turn off the screen...)

b) I created a test-confing only using default modules and can reproduce the issue with that:
`/* Magic Mirror Config Sample
*

*/

var config = {
address: "localhost", // 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 or empty, is "localhost"
electronOptions: {
webPreferences: {
webviewTag: true
}
},
port: 8080,
basePath: "/", // The URL path where MagicMirror is hosted. If you are using a Reverse proxy
// you must set the sub path here. basePath must end with a /
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1","localhost", "192.168.178.0/24"], // 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"],
zoom: 1.0,
useHttps: false, // Support HTTPS or not, default "false" will use HTTP
httpsPrivateKey: "", // HTTPS private key path, only require when useHttps is true
httpsCertificate: "", // HTTPS Certificate path, only require when useHttps is true

language: "de",
logLevel: ["INFO", "LOG", "WARN", "ERROR"],
timeFormat: 24,
units: "metric",
// serverOnly:  true/false/"local" ,
// local for armv6l processors, default
//   starts serveronly and then starts chrome browser
// false, default for all NON-armv6l devices
// true, force serveronly mode, because you want to.. no UI on this device

modules: [
	{
		module: "newsfeed",
		position: "bottom_bar",
		config: {
			feeds: [
				{
					title: "Tagesschau",
					url: "https://www.tagesschau.de/index~rss2.xml",
				},
				{
					title: "Heise",
					url: "https://www.heise.de/rss/heise-top-atom.xml",
				},
			],
			showSourceTitle: true,
			showPublishDate: true,
			ignoreOldItems: true,
			ignoreOlderThan: 86400000,
		}
	},
	{
		module: "alert",
	},
	{
		module: "updatenotification",
		position: "top_bar"
	},
	{
		module: "clock",
		position: "top_left",
		config: {
			clockBold: false,
			showWeek: true,
			showSunTimes: true,
			lat: 51,
			lon: 7,
		}
	},
	{
		//TO DO: check customEvents for color-coding
		module: "calendar",
		header: "Termine & Feiertage",
		position: "top_left",
		config: {
			fetchInterval: 300000, //5 Minutes
			displaySymbol: true,
			showLocation: false,
			fade: true,
			fadePoint: 0.4,
			dateFormat: "D. MMM HH:mm",
			fullDayEventDateFormat: "D. MMM",
			timeFormat: "absolute",
			getRelative: 12,
			urgency: 0,
			maximumEntries: 10,
			displayRepeatingCountTitle: true,
			hideOngoing: false,
			nextDaysRelative: true,
			coloredSymbol: true,
			coloredText: true,
			calendars: [
				{
					symbol: "cocktail",
					url: "webcal://i.cal.to/ical/61/nrw/feiertage/77c4d7d1.8cce2b06-ca7ba139.ics",
					color: "#a368db"
				},
				{
					symbol: 'birthday-cake',
					url: 'webcal://localhost:8080/modules/static/birthdays.ics',
					color: "#ffcf40"
				},
			]
		}
	},
	{
		module: "compliments",
		position: "lower_third",
		config: {
			updateInterval: 30000,
			compliments: {
				"....-01-01": [
					"Frohes Neues Jahr!"
				],
				"....-02-23": [
					"123435"
				],
				"....-03-26": [
					"Happy Birthday XXX!"
				],
				"....-09-16": [
					"1234"
				],
				"....-11-05": [
					"1234!"
				]
			}
		}
	},

]

};

/*************** DO NOT EDIT THE LINE BELOW ***************/
if (typeof module !== "undefined") {module.exports = config;}
`

c) I am using the electron version

@rejas
Copy link
Collaborator

rejas commented Mar 22, 2024

Thx, found the culprit, it was the randomIndex method :-) Will do a PR / Fix later today!

@rejas rejas self-assigned this Mar 22, 2024
@rejas rejas removed their assignment Mar 22, 2024
khassel pushed a commit that referenced this issue Mar 23, 2024
... when no compliments are to be displayed. We shouldnt even try to
randomize when the array has no elements...

Fixes #3385
@rejas rejas mentioned this issue Apr 1, 2024
rejas added a commit that referenced this issue Apr 1, 2024
## [2.27.0] - 2024-04-01

Thanks to: @bugsounet, @crazyscot, @illimarkangur, @jkriegshauser,
@khassel, @KristjanESPERANTO, @Paranoid93, @rejas, @sdetweil and
@vppencilsharpener.

This release marks the first release without Michael Teeuw (@MichMich).
A very special thanks to him for creating MagicMirror and leading the
project for so many years.

For more info, please read the following post: [A New Chapter for
MagicMirror: The Community Takes the
Lead](https://forum.magicmirror.builders/topic/18329/a-new-chapter-for-magicmirror-the-community-takes-the-lead).

### Added

- Output of system information to the console for troubleshooting (#3328
and #3337), ignore errors under aarch64 (#3349)
- [chore] Add `eslint-plugin-package-json` to lint the `package.json`
files (#3368)
- [weather] `showHumidity` config is now a string describing where to
show this element. Supported values: "wind", "temp", "feelslike",
"below", "none". (#3330)
- electron-rebuild test suite for electron and 3rd party modules
compatibility (#3392)
- Create MM² icon and attach it to electron process (#3407)

### Updated

- Update updatenotification (update_helper.js): Recode with pm2 library
(#3332)
- Removing lodash dependency by replacing merge by spread operator
(#3339)
- Use node prefix for build-in modules (#3340)
- Rework logging colors (#3350)
- Update pm2 to v5.3.1 with no allow-ghsas (#3364)
- [chore] Update husky and let lint-staged fix ESLint issues
- [chore] Update dependencies including electron to v29 (#3357) and
node-ical
- Update translations for estonian (#3371)
- Update electron to v29 and update other dependencies
- [calendar] fullDay events over several days now show the left days
from the first day on and 'today' on the last day
- Update layout of current weather indoor values

### Fixed

- Correct apibase of weathergov weatherprovider to match documentation
(#2926)
- Worked around several issues in the RRULE library that were causing
deleted calender events to still show, some
initial and recurring events to not show, and some event times to be off
an hour. (#3291)
- Skip changelog requirement when running tests for dependency updates
(#3320)
- Display precipitation probability when it is 0% instead of blank/empty
(#3345)
- [newsfeed] Suppress unsightly animation cases when there are 0 or 1
active news items (#3336)
- [newsfeed] Always compute the feed item URL using the same helper
function (#3336)
- Ignore all custom css files (#3359)
- [newsfeed] Fix newsfeed stall issue introduced by #3336 (#3361)
- Changed `log.debug` to `log.log` in `app.js` where logLevel is not set
because config is not loaded at this time (#3353)
- [calendar] deny fetch interval < 60000 and set 60000 in this case
(prevent fetch loop failed) (#3382)
- added message in case where config.js is missing the module.export
line PR #3383
- Fixed an issue where recurring events could extend past their
recurrence end date (#3393)
- Don't display any `npm WARN <....>` on install (#3399)
- Fixed move suncalc dependency to production from dev, as it is used by
clock module
- [compliments] Fix mirror not responding anymore when no compliments
are to be shown (#3385)

### Deleted

- Unneeded file headers (#3358)

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Michael Teeuw <[email protected]>
Co-authored-by: Kristjan ESPERANTO <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Karsten Hassel <[email protected]>
Co-authored-by: Ross Younger <[email protected]>
Co-authored-by: Bugsounet - Cédric <[email protected]>
Co-authored-by: jkriegshauser <[email protected]>
Co-authored-by: illimarkangur <[email protected]>
Co-authored-by: sam detweiler <[email protected]>
Co-authored-by: vppencilsharpener <[email protected]>
Co-authored-by: Paranoid93 <[email protected]>
@rejas rejas closed this as completed Apr 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants