signalk-automation-plugin 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -11,7 +11,7 @@ Not Node-RED. Not a Home Assistant YAML clone. Actions are Signal K PUTs, helper
11
11
  - `restore` — survive reboot (save in plugin data, restore on start)
12
12
  - `default` — set `default` on every start
13
13
  - `none` — do nothing on start
14
- - Path triggers, `choose`, zones, cron `schedule`
14
+ - Path triggers, `choose`, zones, cron `schedule` (trigger list is **any**; conditions are **all**)
15
15
  - Trigger `round:` quantizes numbers (and lat/lon) so 230.1 V and 230.4 V do not both fire
16
16
  - Actions: `put`, `helper`, `notify`, `delay`, `run`
17
17
  - `run:` executes a file under configured `scriptsDir`. **stdout is the value; any stderr is fail**
package/lib/engine.js CHANGED
@@ -255,6 +255,11 @@ function isBarePathClause (clause) {
255
255
  )
256
256
  }
257
257
 
258
+ function triggerListMatched (list, results) {
259
+ if (!(list || []).length) return true
260
+ return (results || []).some((r) => r.pass && !r.error)
261
+ }
262
+
258
263
  async function evalList (list, ctx) {
259
264
  const results = []
260
265
  for (const clause of list || []) {
@@ -402,7 +407,7 @@ async function evaluateAutomation (auto, ctx) {
402
407
 
403
408
  const trig = await evalListAll(auto.trigger || [], ctx)
404
409
  record.triggerResults = trig.results
405
- if ((auto.trigger || []).length && !trig.pass) {
410
+ if (!triggerListMatched(auto.trigger, trig.results)) {
406
411
  record.reason = 'trigger not matched'
407
412
  return finishRecord(auto, record)
408
413
  }
@@ -561,5 +566,6 @@ module.exports = {
561
566
  sameValue,
562
567
  clauseLabel,
563
568
  triggerFiredLabel,
569
+ triggerListMatched,
564
570
  formatVerboseLog
565
571
  }
package/lib/runtime.js CHANGED
@@ -166,8 +166,8 @@ class Runtime {
166
166
  async maybeRun (auto, trigger) {
167
167
  if (!this.isEnabled(auto)) return
168
168
  const ctx = this.makeCtx(trigger)
169
- const trig = await engine.evalList(auto.trigger || [], ctx)
170
- const matched = !(auto.trigger || []).length || trig.pass
169
+ const trig = await engine.evalListAll(auto.trigger || [], ctx)
170
+ const matched = engine.triggerListMatched(auto.trigger, trig.results)
171
171
 
172
172
  if (!matched) {
173
173
  this.lastTruthy[auto.id] = false
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "signalk-automation-plugin",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "Home Assistant-like YAML automations for Signal K",
5
5
  "main": "plugin/index.js",
6
6
  "keywords": [
package/public/app.js CHANGED
@@ -135,7 +135,17 @@ function fmtRunRecord (t) {
135
135
 
136
136
  function fmtTime (iso) {
137
137
  if (!iso) return ''
138
- try { return new Date(iso).toLocaleString() } catch (_) { return iso }
138
+ try {
139
+ return new Date(iso).toLocaleString('nl-NL', {
140
+ year: 'numeric',
141
+ month: '2-digit',
142
+ day: '2-digit',
143
+ hour: '2-digit',
144
+ minute: '2-digit',
145
+ second: '2-digit',
146
+ hour12: false
147
+ })
148
+ } catch (_) { return iso }
139
149
  }
140
150
 
141
151
  function escapeHtml (s) {
package/public/index.html CHANGED
@@ -5,7 +5,7 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1" />
6
6
  <title>Signal K Automations</title>
7
7
  <link rel="icon" href="icon.png" />
8
- <link rel="stylesheet" href="style.css?v=20260915log" />
8
+ <link rel="stylesheet" href="style.css?v=20260915h24" />
9
9
  </head>
10
10
  <body>
11
11
  <header>
@@ -61,6 +61,6 @@
61
61
  </div>
62
62
  </section>
63
63
  </main>
64
- <script src="app.js?v=20260915log"></script>
64
+ <script src="app.js?v=20260915h24"></script>
65
65
  </body>
66
66
  </html>