From d49ec9deab7573abd2f3ada1ad47154e466bcb09 Mon Sep 17 00:00:00 2001 From: Dave C-J Date: Sat, 19 Oct 2013 15:37:20 +0100 Subject: [PATCH] make sunrise/sunset second output ONLY trigger on actual transitions and not at startup. --- time/79-suncalc.html | 4 ++-- time/79-suncalc.js | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/time/79-suncalc.html b/time/79-suncalc.html index 92082d1d..7e595f86 100644 --- a/time/79-suncalc.html +++ b/time/79-suncalc.html @@ -54,8 +54,8 @@ diff --git a/time/79-suncalc.js b/time/79-suncalc.js index e44414d9..383824a3 100644 --- a/time/79-suncalc.js +++ b/time/79-suncalc.js @@ -40,6 +40,7 @@ function SunNode(n) { var moon = parseInt(SunCalc.getMoonFraction(now)*100)/100; msg = { payload:0, topic:"sun", moon:moon }; if ((e1 > 0) & (e2 < 0)) { msg.payload = 1; } + if (oldval == null) { oldval = msg.payload; } if (msg.payload != oldval) { oldval = msg.payload; msg2 = msg;