1385 Commits

Author SHA1 Message Date
Bugsounet - Cédric
70ddd80632
Use html-to-text instead of regex for transform description (#3264)
I try to use only `html-to-text` library

it's will solve issue #3235 

@rejas, @sdetweil, @khassel: Can you do tests with your own feeds?

Thanks for feedbacks
2023-11-11 09:13:16 +01:00
Bugsounet - Cédric
203e8647d4
3rd party modules updater for updatenotification (#3150)
Added my (modified) updater main core into updatenotification default
module

Missing: callback display in MM² (i will code it after)

new part of configuration added:

```
		updates: [
			// array of module update commands
			{
				// with embed npm script
				"MMM-Test": "npm run update"
			},
			{
				// with "complex" process
				"MMM-OtherSample": "rm -rf package-lock.json && git reset --hard && git pull && npm install"
			},
			{
				// with git pull && npm install
				"MMM-OtherSample2": "git pull && npm install"
			},
			{
				// with a simple git pull
				"MMM-OtherSample3": "git pull"
			}
		],
		updateTimeout: 2 * 60 * 1000, // max update duration
		updateAutorestart: false // autoRestart MM when update done ?
```

@khassel: i need your help
I don't use docker, maybe you can help me for this:
How can i check if MM² is running inside a docker ? (from MM² main core)
Actually, I check if we use pm2 or not.
I have to check if docker is used or not too
last time you tell me: "you can't use updater with docker", so I want to
check and deny any update if docker used

---------

Co-authored-by: bugsounet <bugsounet@bugsounet.fr>
2023-11-10 12:43:34 +01:00
sam detweiler
b300191609
fix crash on rrule.between returned bad dates #3256 (#3257)
Fixes: #3256 

BUT.. the testcase is inconclusive.. as the code FAILS without the fix,
BUT somehow RETURNS 0 entries..
in real life run the node helper fails, and all calendar processing
stops.
2023-11-07 19:48:00 +01:00
jkriegshauser
fe882bf92a
Fix issue #3250: Respect deleted (excluded) calendar events (#3251)
Hello and thank you for wanting to contribute to the MagicMirror²
project

**Please make sure that you have followed these 4 rules before
submitting your Pull Request:**

> 1. Base your pull requests against the `develop` branch.
> 2. Include these infos in the description:
>
> - Does the pull request solve a **related** issue?
> - If so, can you reference the issue like this `Fixes
#<issue_number>`?
> - What does the pull request accomplish? Use a list if needed.
> - If it includes major visual changes please add screenshots.
>
> 3. Please run `npm run lint:prettier` before submitting so that
>    style issues are fixed.
> 4. Don't forget to add an entry about your changes to
>    the CHANGELOG.md file.

**Note**: Sometimes the development moves very fast. It is highly
recommended that you update your branch of `develop` before creating a
pull request to send us your changes. This makes everyone's lives
easier (including yours) and helps us out on the development team.

Thanks again and have a nice day!
2023-11-01 07:42:47 +01:00
kaennchenstruggle
2a6e2aacdc
Calendar translate (#3249)
Hello and thank you for wanting to contribute to the MagicMirror²
project

**Please make sure that you have followed these 4 rules before
submitting your Pull Request:**

> 1. Base your pull requests against the `develop` branch.

DONE ;D

> 2. Include these infos in the description:
> - Does the pull request solve a **related** issue?

NO
> - What does the pull request accomplish? Use a list if needed.

For calendar entries containing a year (e.g. DOB) in the title, the age
can be calculated.

Example before:

![grafik](https://github.com/MichMich/MagicMirror/assets/54073894/67ca65f4-24c3-46a8-bee8-0519e4bba3f5)
after:

![grafik](https://github.com/MichMich/MagicMirror/assets/54073894/0b4af07d-d3d9-4644-a4a6-e8c402598208)

Achieved by adding a new keyword `transform` to customEvents
```
customEvents: [
                        {keyword: 'Geburtstag', symbol: 'birthday-cake', color: 'Gold', transform: { search: '^([^\']*) \'(\\d{4})$' , replace: '$1 ($2.)', yearmatchgroup: 2}},
                        {keyword: 'in Hamburg', transform: { search: ' in Hamburg$' , replace: ''}} 
		],
```

and therewith obsoleting `titleReplace`; a backward compatibility part
is already included.

If `yearmatchgroup` is unset, behaviour is as in previous code (some
additions to which RegExes are accepted, though)

If `yearmatchgroup` is set, it is considered the RegEx match group id,
which will be used for calculating the age.



> - If it includes major visual changes please add screenshots.

NO

> 3. Please run `npm run lint:prettier` before submitting so that style
issues are fixed.

DONE

> 4. Don't forget to add an entry about your changes to the CHANGELOG.md
file.

DONE

> Thanks again and have a nice day!

You too and if any questions, feel free to let me know.

---------

Co-authored-by: veeck <michael.veeck@nebenan.de>
2023-11-01 00:07:56 +01:00
Veeck
04f0df269a
Fix yr weather provider api version (#3248)
Fixes #3227 once more
2023-10-24 00:46:25 +02:00
Bugsounet - Cédric
bbc27f5ae2
Avoid fade out/in on updateDom when many calendars are used (#3220)
related to #3185 

* I have limited updated dom to one update
-> `updateDom()` is activated by a timer which resets when a new event
arrives (`CALENDAR_EVENTS`)

* I have set no speed to self update. I think it's not necessary
-> update it directly

If somebody can test and tell me result
In all case, I will patch my prod mirror for testing
2023-10-21 19:41:17 +02:00
Karsten Hassel
f46b226940
fix newsfeed module for feeds using "a10:updated" tag (#3242)
solves  #3238
2023-10-20 06:41:31 +02:00
Veeck
a0b444d6c4
Fix API version in yr weather provider call (#3223)
Fixes #3227 

and also
- removes unused code
- de-duplicates code fragments
- fixes typos
- inlines code
- adds more weather util tests

@martingron and @Justheretoreportanissue would you be so kind to check
if I didnt mess anything up?
2023-10-15 13:25:44 +02:00
Teddy
b067711ede
Event class bugfix (#3218)
Hello,

Bugfix. :-) The "break" line did not allow the "eventClass" option to
execute.
2023-10-03 12:24:50 +02:00
Karsten Hassel
6b204cda25
calendar: add url to broadcast logging (#3211)
minimal solution for #3110
2023-09-27 23:37:10 +02:00
dgoth
a3c2e7b816
Fixed probability of precipitation in weathergov.js (#3195)
Fixes https://github.com/MichMich/MagicMirror/issues/3182

Fixed issue with probability of precipitation not showing up on hourly
or daily forecast

---------

Co-authored-by: veeck <michael.veeck@nebenan.de>
2023-09-25 22:42:27 +02:00
Teddy
a67a0b677c
Add eventClass for customEvents in calendar (#3193)
Hello,
This pull request allows you to add a class to the tr of the event
sought in customEvents. You must enter the class with the "eventClass"
option.

---------

Co-authored-by: TeddyStarinvest <teddy.payet@starinvest.com>
2023-09-20 22:04:41 +02:00
martingron
8b1c279c07
Update yr provider to new api (#3197)
Some changes after yr api was deprecated and replaced with a new one.

Fixes #3189
2023-09-20 11:37:01 +02:00
Bugsounet - Cédric
af0fe37f70
Fix: Uncaught SyntaxError: Identifier 'getCorsUrl' has already been declared (#3204)
Issue #3202 

move shared modules/default/utils.js file to index.html
2023-09-19 07:14:11 +02:00
Bugsounet - Cédric
91fd931a58
Convert HTML entities, codes and tag (#3191)
related to PR [#3092](https://github.com/MichMich/MagicMirror/pull/3092)

maybe best way is using `html-to-text` library

sample: `&quotHello World&quot` will be transformed to `"Hello World"`
2023-09-13 22:47:07 +02:00
Karsten Hassel
f2957f90df
use internal fetch as replacement for node-fetch (#3184)
related to #2649

I was able to move to internal fetch and all tests seems fine so far.

But we have one problem with the calendar module. In the docs we have
several authentication methods and one of them is `digest`. For this we
used `digest-fetch` which needs `node-fetch` (this is not so clear from
code but I was not able to get it working).

So we have 3 options:
- remove `digest` as authentication method for calendar module (this is
what this PR does at the moment)
- find an alternative npm package or implement the digest stuff
ourselves
- use `digest-fetch` and `node-fetch` for calendar module (so they would
remain as dependencies in `package.json`)

Opinions? @KristjanESPERANTO @rejas @sdetweil @MichMich
2023-09-09 21:12:31 +02:00
J. Kenzal Hunter
79e99e18ea
Cross UTC time fix (#3175)
Update calendarfetcherutils.js to force recurrence date time to be the
same as event datetime

I found an issue with one of my calendars displaying the wrong time for
certain recurring events. Each event was set up by someone in a
different timezone (Central European) than my own (Eastern US). I traced
the issue back to the `Rrule.between()` method generating odd time
portions under certain circumstances.

The fix I found was to set the UTC time portion of the recurrence
datetime to be the same as the UTC time portion of the event start date.

This resolved the issues with the maladjusted event times, and had no
effect on other event times. While there may be edge cases that are
affected, I have been unable to locate any.

---------

Co-authored-by: Veeck <github@veeck.de>
2023-09-08 07:44:49 +02:00
NolanKingdon
5cbdd28db3
Added Override Notification Option to Weather Module (#3178)
Fixes #3126 

Added the option `allowOverrideNotification` to `weather.js`. This
allows the module to receive the `CURRENT_WEATHER_OVERRIDE`
notification. The expected payload for this notification is a
full/partial `weatherObject` that is used to supplement/replace the
existing `weatherObject` returned by whichever weather provider is in
use.

No visual changes.

First time contributing - let me know if I've missed something
🙂

---------

Co-authored-by: veeck <michael.veeck@nebenan.de>
2023-09-08 07:41:20 +02:00
Veeck
c0a5f35a00
Cleanup nunjuck templates (#3109)
Ran a linter over it (djlint) which fixed intendation and a few errors

---------

Co-authored-by: veeck <michael@veeck.de>
2023-09-02 22:18:57 +02:00
Paranoid93
2ad463b6c7
fix calendar not showing events with the same name and start date but different calendar url (#3166)
I fixed the calendar module, which did not show calendar entries from
different calendars that share the same name and start date.

My use case: We have each office days documented in each an own
calendar. If both "Office" Calendar entries start at the same date just
one was shown

Google Calendar (each Office event in an own calendar)

![260753381-c8d5aedf-3c11-4d91-83e8-8549eb261e58](https://github.com/MichMich/MagicMirror/assets/6515818/0cb0ecbd-65bb-4ec4-b5e6-b011cb1c9c6b)

Before

![260751994-b308d549-fcb9-406e-9419-cdd2fed96dc6](https://github.com/MichMich/MagicMirror/assets/6515818/ed4d4645-0852-4e19-99ed-fec3f25d547a)

After

![260753208-3278e32b-9ca5-483a-bc6f-745cbf3964fc](https://github.com/MichMich/MagicMirror/assets/6515818/41b70843-af9f-47fc-baed-91c3c63e9acb)
2023-08-26 13:53:41 +02:00
Kristjan ESPERANTO
7dcea98e99
Handle pretty-quick issue (#3169)
- Replace pretty-quick by lint-staged (to fix:
<https://github.com/azz/pretty-quick/issues/164>)
- Update prettier dependencies
- Handle prettier issues
2023-08-16 14:21:02 +02:00
Veeck
f802c85a38
Fix undefined error for showSunTime / showMoonTime in clock module (#3146)
Fixes #3143 and adds tests for showSunTime / showMoonTime
2023-07-02 22:10:58 +02:00
Knapoc
62eb23ba6a
Add openweathermap UV index support (#3145)
This PR adds UV index support to the openweathermap provider for the One
Call api.
2023-07-02 21:47:25 +02:00
Veeck
ea818bf899
Fix fetchInterval for sample calendar (#3139)
fixes #3138 just in case #3137 doesnt get worked on until the next
release

- inc fetchInterval for sample calender
- add fetchInterval config per calendar
2023-06-30 20:13:07 +02:00
Karsten Hassel
3c35d346ee
fix updatenotification where no branch is checked out ... (#3136)
... but e.g. a version tag

fixes #3130 

This happens e.g. in my docker image where I use the version tag to get
the mm sources.

With this PR the error message is avoided and there will be never an
updatenotification when using a tag. This is o.k. because a tag should
never be moved.
2023-06-27 11:18:16 +02:00
Bugsounet - Cédric
c1850f2577
Remote force check update (#3127)
updatenotification: 

allow force scanning with `SCAN_UPDATES` notification from other modules
2023-06-18 14:33:03 +02:00
Bugsounet - Cédric
e985e99036
Updates notification (#3119)
Hi,

Like some default modules, I propose to send an `UPDATES` notification
in an array with the git information of these modules

This allows developers to create their own auto-update system (which
I've been using in my case since 3 years, with automatic things)

Of course, for security reasons `MagicMirror` is excluded

---------

Co-authored-by: bugsounet <bugsounet@bugsounet.fr>
2023-06-08 22:41:48 +02:00
OWL4C
eceec8285d
Adding experimental UV Index support for weather module (#3108)
This pr adds (config.js toggleable) showUV_Index to the hourly and
current weather modules, with right now only openmeteo configured to
supply the data. Other providers could have support too by adding
`uv_index` to current and hourly.

For example the current weather looks like
![image](https://github.com/MichMich/MagicMirror/assets/124401812/00fdf5db-c0d5-4797-9a31-1d72dd970d26)
positioned after sunset in the top row.



The following "hacks" are included and could be fixed to make it
cleaner, but the functionality is wanted and it works without problem.
- To hide entries where the UV Index is 0 i added an if statement to the
`hourly.njk` which is not how precipitation is handled.
The following are minor things that might not need fixing:
- The forecast option does not have UV support. This might not be
relevant since UV changes throughout the day but i tried to implement a
"max_UV" to openmeteo.js, but am not confident enough in JS to
accomplish that.
- The UV Icon is wi-hot and manually added to the `.njk`'s. This could
be made changeable by a config but does not seem relevant since wi-hot
is not used by anything else as far as i can tell.

---------

Co-authored-by: veeck <michael@veeck.de>
2023-05-22 10:57:48 +02:00
Eddie Hung
0573d6e772
Fix envcanada today pop (#3106)
Fix for today's probability-of-precipitation weather module's envcanada
provider.

Without which, requesting `showPrecipitationProbability` causes
"undefined" to be shown.

Consistent with method used elsewhere in the file:

abe5c08a52/modules/default/weather/providers/envcanada.js (L395-L399)
2023-05-21 10:51:13 +02:00
Jørgen Veum-Wahlberg
babd22b04f
Bug fix: adding date to the analog clock if showDate is true (#3101)
Adding date to the clock module when displayType is "analog" and
"showDate" is true. The setting in analogShowDate is respected.

Fixes #3100

---------

Co-authored-by: Michael Teeuw <michael@xonaymedia.nl>
Co-authored-by: Veeck <github@veeck.de>
2023-05-19 14:52:59 +02:00
Veeck
432d900ecd
Add tests for some weather utils (#3103)
Co-authored-by: veeck <michael@veeck.de>
2023-05-15 21:04:50 +02:00
Ismar Slomic
83315f1fed
fix: don't filter out ongoing full day events in Calendar module (#3095) (#3096)
Fixes #3095.

Param `hideOngoing` is by default set to `false`, but the event
filtering handles `full day` & `non-full day` events inconsistently. For
`non-full day` _ongoing_ and _upcoming_ events are returned, while for
`full day` only _upcoming_ events where returned.
2023-05-15 20:16:33 +02:00
OWL4C
d832d795df
Add openmeteo precipitation probability (#3099)
Due to the size of the commit there is no need for a long explanation:
Openmeteo supports precipitation probability in api, but the weather
provider .js had no support for it. After adding 4 lines it works as
expected. This should have no consequences on other files but improves
usability for (imo) the best weather provider.

---------

Co-authored-by: veeck <michael@veeck.de>
2023-05-13 09:29:00 +02:00
Karsten Hassel
a41aa48dd1
add .gitattributes and fix prettier/js warnings (#3094)
see title, as discussed in
https://github.com/MichMich/MagicMirror/pull/3093
2023-04-22 09:29:51 +02:00
Veeck
7e58b38ddf
Add no-param-reassign from eslint (#3089)
While waiting for the easterbunny I cleaned up some bad coding practice
:-)

Very open for comments especially regarding the places I commented
myself...

---------

Co-authored-by: veeck <michael@veeck.de>
2023-04-16 17:38:39 +02:00
Veeck
4e3369062e
Fix envcanada hourly forecast time (#3090)
Fixes #3080

---------

Co-authored-by: veeck <michael@veeck.de>
2023-04-09 19:23:44 +02:00
Veeck
77f9c86774
Refactor calendar methods into util class (#3088)
Refactored some methods in calendar module:
- move methods into own file 
- dont call shorten method from titelTransform because why? just call
them after each other.
- added tests for util methods
- cleaned up other tests

---------

Co-authored-by: veeck <michael@veeck.de>
2023-04-09 12:49:50 +02:00
JakeBinney
dee3cd3da7
Fixed clock module sunrise/sunset timezone bug (#3070)
Updated sunrise/sunset times to display user-requested timezone rather
than system timezone.

Note: rebase of  #3069 against develop rather than master

Co-authored-by: Veeck <github@veeck.de>
2023-04-09 09:19:51 +02:00
Veeck
32192d1698
Refactor formatTime into util class (#3073)
While looking at https://github.com/MichMich/MagicMirror/pull/3070 I
noticed that the weather and clock module do some formatTime stuff, so
why not use a common function for that?

---------

Co-authored-by: veeck <michael@veeck.de>
2023-04-07 23:11:54 +02:00
Karsten Hassel
b7eb21e48f
removed unneeded (and unwanted) '.' (#3084)
after the year in calendar repeatingCountTitle (#2896, second attempt
...)
2023-04-07 14:54:19 +02:00
Veeck
b5a22bc09b
Add sendNotifications option to clock module (#3059)
Fixes #3056 

One question here would be if the default for this new option should be
true or false.

True: keeps the current behaviour, nobody needs to change his config if
they rely on this option

False: keeps the clock notifications quiet, doesnt waste time/resources,
keeps the noise low

Maybe the original author @cybex-dev can weigh in on this, and why he
added this notification.

---------

Co-authored-by: veeck <michael@veeck.de>
2023-04-01 21:40:05 +02:00
Kristjan ESPERANTO
5f38c53260
Revise require imports (#3071)
- order (external first)
- remove superfluous file extensions
- new line after imports
- deconstruct (only one time (in `check_config.js`))
- fix path (only one time (in `global-setup.js`))
2023-03-22 23:53:10 +01:00
Kristjan ESPERANTO
d276a7ddb9
Use template literals instead of string concatenation (#3066)
We have used it inconsistently till now. Template literals are more
modern and easier to maintain in my opinion.

Because that's a large amount of changes, here's a way to reproduce it:
I added the rule `"prefer-template": "error"` to the `.eslintrc.json`
and did an autofix. Since this caused a new problem in line 409 of
`newsfeed.js`, I reversed it in that line and also removed the rule from
the eslint config file.

The rule is described here:
https://eslint.org/docs/latest/rules/prefer-template

Note: I've played around with some other linter rules as well, and some
seem to point to some specific, non-cosmetic, issues. But before I dive
even deeper and then introduce even bigger and hardly understandable
changes at once, I thought I'd start with this simple cosmetic rule.
2023-03-19 14:32:23 +01:00
Nicholas Fogal
8f8945d418
Issue#3064 html alert title message (#3065)
Fixes [#3064](https://github.com/MichMich/MagicMirror/issues/3064)

- Fixes default alert module nunjucks templates to render HTML by
default unless 'titleType' and 'messageType' are set to 'text' in the
payload data

e.g. 

Display Text:
`this.sendNotification('SHOW_ALERT', {type: "notification", title:
"<u>YoLink LeakSensor</u>", titleType: "text", message: "<b>" +
deviceName + "</b> reported an alarm that needs attention.",
messageType: "text"});`

Display HTML:
`this.sendNotification('SHOW_ALERT', {type: "notification", title:
"<u>YoLink LeakSensor</u>", message: "<b>" + deviceName + "</b> reported
an alarm that needs attention."});`
2023-03-19 13:23:37 +01:00
buxxi
beea754514
Fix empty news feed stopping the feed from ever updating again (#3062)
If a news feed returns an empty file it will cause the feed to only show
the previous entries forever since no new fetch is scheduled.
2023-03-11 16:42:13 +01:00
Karsten Hassel
c6db22524a
set all calendar colums to vertical align top (#3055)
The title column was vertical centered before.

Fixes #3053
2023-03-06 22:59:37 +01:00
Andrés Vanegas Jiménez
23ee155ded
Fixed wind speed units for Open-Meteo Weather Provider (#3054)
Resolved technical debt for
[2964](https://github.com/MichMich/MagicMirror/pull/2964):

- Set wind speed unit to m/s
- Rename parameter `past_days` to `pastDays` to be consistent with all
configs
2023-03-01 09:38:38 +01:00
Veeck
498b440174
Convert module-start to async (#3049)
Similar to the node_helper async start PR...

---------

Co-authored-by: veeck <michael@veeck.de>
2023-02-22 18:58:29 +01:00
Thomas Hirschberger
a23769156e
Show events of a configurable amount of past days (#3046)
Hi,

want to include a birthday calendar to my mirror which shows upcoming
birthdays and as a reminder birthdays of the last two days.
I used
[MMM-CalendarExt2](https://github.com/MMM-CalendarExt2/MMM-CalendarExt2)
for this job in the past but the module is not supported any more and
very complicated to configure.
I managed to style the default calendar module to my needs but what i am
missing is to display already past events within a configurable time
range.

I included the translations of "YESTERDAY" and "DAYBEFOREYESTERDAY" to
all translation files and modified the code to accept a new option
`pastDaysCount` which controls of how many days past events should be
displayed.

---------

Co-authored-by: Veeck <github@veeck.de>
2023-02-21 22:39:21 +01:00