* Experimental branch that replaces momentjs with dayjs in the client
* Revert unintentional change
* feat
* Turns out dayjs is a no-go, but this has some good restructuring so submitting that
* Fix continuous suspension of the timeago alerts
The default hearbeat-setting is 60 seconds, so the delta between two
timeago-checks will always be >15 seconds and the timeago-alarms will
always be suspended (that's what Papertrail also shows).
To fix this, make the delta-check heartbeat-setting-dependant and also simplify
the code by using just 1 variable.
* Add test that verifies the hibernation detection behaviour
The real-world test would be to actually wait for a couple of minutes (with 2 *
heartbeat of default settings) in the unit test, but this is not feasible, so
just modify the heartbeat-setting to a lower value.
I tested it by only running tests inside `tests/timeago.test.js` and by actually
deploying this code and testing the alarms with Pushover and reading the logs in
Papertrail.
Before this change, I saw a 'Hibernation detected' log every minute. After this
change, I didn't see it anymore, probably because the app wasn't actually
hibernated (yet).
* Take sulkaharo's feedback into account and differentiate
between client and server (by introducing it in sandbox.js).
On the client the behaviour is different from the server:
> On client, the issue is browsers stop the execution of JS if the window is not
> visible and the alarm is falsely triggered immediately when the execution is
> resumed, so we need to suspend the alarm for ~10 seconds after the execution has
> resumed to give the client time to update the data to prevent false alarms.
While on the server, the default heartbeat from 60s needs to be taken
into account to prevent the timeago alarm from falsely triggering.
So detect hibernation there if the last check was more than 2 heartbeats ago.
* Fix the tests by adding settings to the context,
which is now required by timeago.
Also, change the timeago test a bit so that it both succeeds
when testing in isolation as when testing it along with the other tests.
* Copied work done by mdomox
* Updates and fixes to CONTRIBUTING.md
* Spacing unification
* One more fix for CONTRIBUTING.md
* Minor code formatting improvements
* One more time...
* Renamed Alexa stuff to virtAsst for generic-ness
* Corrected missed translate() text
* Updated googlehome plugin to mimic the alexa plugin
* Changed order of operations
* Fixed parameter referencing in googlehome
* Yet another CONTRIBUTING fix
* Removed extra google stuff
* Migrated standalone intents to MetricNow intent
* Simplified route handling
* Added logging
* Added forgotten path selector
* Separated instructions for adding virtual assistant support in a plugin
* A few typo fixes
* Improved logging
* Updated Google Home plugin instructions
* Attempt to trigger download of template file
* Small wording tweaks
* Updated Alexa plugin documentation
* Updated test files
* Re-added handler count tests so devs are prompted to write tests for new handlers
* Updated Alexa documentation
* Small typo fix
* Clarification
* Further clarifications and typos
* Added language info to Google Home plugin doc
* URL correction
* URL fix v2
* Wording clarification
* Ugh...
* Minor instruction fix
* Sub steps fix
* Fixed Alexa references in Google Home
* Added a couple steps for improved user experience
* One more forgotten step
* Updated pump reservoir handler to handle undefined values
* Updated titles and unknown-value responses
* Modified forecast responses to use translate()
* Updated tests
* Improved training phrases
* Wording improvements
* Google Home setup instruction corrections
* Corrected how metric selection is found