Closed chrisg2003 closed 4 years ago
Hi @chrisg2003, Thanks for reaching out! Which version do you currently use? Could you please share the node's JSON with me? Thank you! C.
Hi
Thanks for the prompt reply.
JSON attached.
The only other thing is an injection of an negative offset for Sunset, but I have tried it with and without yielding the same result.
Thanks for your help.
Chris
On Tue, 26 May 2020 at 09:33, Cornelius Suermann notifications@github.com wrote:
Hi @chrisg2003 https://github.com/chrisg2003, Thanks for reaching out! Which version do you currently use? Could you please share the node's JSON with me? Thank you! C.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/csuermann/node-red-contrib-suncron/issues/8#issuecomment-633887406, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOUSWDBG6PLRMRU27662OLTRTN5GJANCNFSM4NKCRZIA .
Hi
Sorry not to answer question on version, I believe that I am on the latest.
Chris
On Tue, 26 May 2020 at 09:33, Cornelius Suermann notifications@github.com wrote:
Hi @chrisg2003 https://github.com/chrisg2003, Thanks for reaching out! Which version do you currently use? Could you please share the node's JSON with me? Thank you! C.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/csuermann/node-red-contrib-suncron/issues/8#issuecomment-633887406, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOUSWDBG6PLRMRU27662OLTRTN5GJANCNFSM4NKCRZIA .
@chrisg2003, Thanks for your reply, but I cannot find your attachment?! C.
Hi
Sorry about the problems.
Thanks for the prompt reply.
JSON attached.
The only other thing is an injection of an negative offset for Sunset, but I have tried it with and without yielding the same result.
Version number is 1.3.3.
Thanks for your help.
Chris
On Tue, 26 May 2020 at 14:55, Cornelius Suermann notifications@github.com wrote:
@chrisg2003 https://github.com/chrisg2003, Thanks for your reply, but I cannot find your attachment?! C.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/csuermann/node-red-contrib-suncron/issues/8#issuecomment-634040571, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOUSWDH4O5662UEAPKKYIHTRTPC5XANCNFSM4NKCRZIA .
@chrisg2003, there's still no attachment ;-) but I did some research and it seems that depending on your location certain sun events simply may not exist at this time of the year. Sounds really strange, I know. Check these comments on an issue of the suncalc dependency I'm using. Could that explain the strange behavior you're observing? If so, how do you think suncron should handle those cases?
Sorry. Not used to github protocols, I was just answering emails with an attachment. [ { "id": "5ae1933e.b4c87c", "type": "suncron", "z": "51ccb1d4.eae9e", "name": "", "replay": false, "lat": "50.9757", "lon": "-1.3862", "sunrisePayload": "true", "sunrisePayloadType": "bool", "sunriseTopic": "Dawn", "sunriseOffsetType": 1, "sunriseOffsetHours": 0, "sunriseOffsetMinutes": 0, "sunriseOffset": 0, "sunriseEndPayload": "", "sunriseEndPayloadType": "str", "sunriseEndTopic": "", "sunriseEndOffsetType": 1, "sunriseEndOffsetHours": 0, "sunriseEndOffsetMinutes": 0, "sunriseEndOffset": 0, "goldenHourEndPayload": "true", "goldenHourEndPayloadType": "bool", "goldenHourEndTopic": "Sunrise", "goldenHourEndOffsetType": 1, "goldenHourEndOffsetHours": 0, "goldenHourEndOffsetMinutes": 0, "goldenHourEndOffset": 0, "solarNoonPayload": "", "solarNoonPayloadType": "str", "solarNoonTopic": "", "solarNoonOffsetType": "-1", "solarNoonOffsetHours": 0, "solarNoonOffsetMinutes": "0", "solarNoonOffset": "0", "goldenHourPayload": "", "goldenHourPayloadType": "str", "goldenHourTopic": "", "goldenHourOffsetType": 1, "goldenHourOffsetHours": 0, "goldenHourOffsetMinutes": 0, "goldenHourOffset": 0, "sunsetStartPayload": "", "sunsetStartPayloadType": "str", "sunsetStartTopic": "", "sunsetStartOffsetType": 1, "sunsetStartOffsetHours": 0, "sunsetStartOffsetMinutes": 0, "sunsetStartOffset": 0, "sunsetPayload": "true", "sunsetPayloadType": "bool", "sunsetTopic": "LightingUptime", "sunsetOffsetType": "-1", "sunsetOffsetHours": "0", "sunsetOffsetMinutes": "0", "sunsetOffset": "0", "duskPayload": "true", "duskPayloadType": "bool", "duskTopic": "Dusk", "duskOffsetType": 1, "duskOffsetHours": 0, "duskOffsetMinutes": 0, "duskOffset": 0, "nauticalDuskPayload": "", "nauticalDuskPayloadType": "str", "nauticalDuskTopic": "", "nauticalDuskOffsetType": 1, "nauticalDuskOffsetHours": 0, "nauticalDuskOffsetMinutes": 0, "nauticalDuskOffset": 0, "nightPayload": "true", "nightPayloadType": "bool", "nightTopic": "DeadOfNight", "nightOffsetType": 1, "nightOffsetHours": 0, "nightOffsetMinutes": 0, "nightOffset": 0, "nadirPayload": "", "nadirPayloadType": "str", "nadirTopic": "", "nadirOffsetType": "1", "nadirOffsetHours": "0", "nadirOffsetMinutes": 0, "nadirOffset": "0", "nightEndPayload": "", "nightEndPayloadType": "str", "nightEndTopic": "", "nightEndOffsetType": 1, "nightEndOffsetHours": 0, "nightEndOffsetMinutes": 0, "nightEndOffset": 0, "nauticalDawnPayload": "", "nauticalDawnPayloadType": "str", "nauticalDawnTopic": "", "nauticalDawnOffsetType": 1, "nauticalDawnOffsetHours": 0, "nauticalDawnOffsetMinutes": 0, "nauticalDawnOffset": 0, "dawnPayload": "", "dawnPayloadType": "str", "dawnTopic": "", "dawnOffsetType": 1, "dawnOffsetHours": 0, "dawnOffsetMinutes": 0, "dawnOffset": 0, "x": 280, "y": 360, "wires": [ [ "6aa18c7e.04d4a4", "292555bd.60a12a" ] ] } ]
Hi
I have looked at the comments and don't quite understand. I'm in the UK and Sunrise was at 05:01 today according to Google at my location.
Chris
Sorry didn't mean to close it, not having a great day today.
:tada: This issue has been resolved in version 1.4.2 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
@chrisg2003, In your case the error seemed to be triggered by the 'night' event, which simply does not exist at your location at this time of the year. The error might have put the node in an error state that stopped it from functioning altogether. I fixed this by skipping 'invalid' sun events. They will simply be ignored and not be contained in the schedule for the day.
Thank you for resolving this so promptly.
Hi
Sorry to bother you again, but the new version has not appeared in the Pallette Manager of Node Red. Do I have to do something specific?
Thanks
Chris
On Wed, 27 May 2020 at 07:55, Cornelius Suermann notifications@github.com wrote:
@chrisg2003 https://github.com/chrisg2003, In your case the error seemed to be triggered by the 'night' event, which simply does not exist at your location at this time of the year. The error might have put the node in an error state that stopped it from functioning altogether. I fixed this by skipping 'invalid' sun events. They will simply be ignored and not be contained in the schedule for the day.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/csuermann/node-red-contrib-suncron/issues/8#issuecomment-634466676, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOUSWDGMA2DJLEZHWCQ3IIDRTS2MPANCNFSM4NKCRZIA .
My bad, Node-Red changed the way they pick up updates. I now triggered a re-index manually and expect the update to become visible shortly.
Many thanks.
Chris
On Thu, 28 May 2020 at 10:36, Cornelius Suermann notifications@github.com wrote:
My bad, Node-Red changed https://nodered.org/docs/creating-nodes/packaging the way they pick up updates. I now triggered a re-index manually and expect the update to become visible shortly.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/csuermann/node-red-contrib-suncron/issues/8#issuecomment-635232597, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOUSWDCF4KFKZZ5TZITVQGTRTYWCPANCNFSM4NKCRZIA .
Hi
I have updated to your latest version and am getting the following error: TypeError: Cannot read property 'sunEventTime' of undefined.
Code in my SetupUI function is as below:
[ { "id": "6aa18c7e.04d4a4", "type": "function", "z": "51ccb1d4.eae9e", "name": "Setup UI", "func": "var topic = msg.topic;\n// Fetch stored array\nvar states = flow.get(\"Events\",\"File\") || [];\n// Fetch Sunset offset\nvar offset = global.get(\"SunsetOffset\");\n//\n// Sunrise or Dawn(?)\nvar dstr = msg.schedule.sunrise.sunEventTime;\nvar timepos = dstr.indexOf('T')+1;\nvar time = dstr.substr(timepos, 5);\n states[0] = {Event: \"Dawn\", Time: time, Phase: \"Day\"};\n// Sunrise (Golden hour)\n dstr = msg.schedule.goldenHourEnd.sunEventTime;\n timepos = dstr.indexOf('T')+1;\n time = dstr.substr(timepos, 5);\n states[1] = {Event: \"Sunrise\", Time: time, Phase: \"Day\"};\n// Sunset\n dstr = msg.schedule.sunset.sunEventTime;\n timepos = dstr.indexOf('T')+1;\n time = dstr.substr(timepos, 5);\n states[2] = {Event: \"Sunset\", Time: time, Phase: \"\"};\n// sort out House Lights On time\n dstr = msg.schedule.sunset.cronTime;\n timepos = dstr.indexOf('T')+1;\n time = dstr.substr(timepos, 5);\n states[3] = {Event: \"Lights On\", Time: time, Phase: \"Evening\"}; \n// Dusk\n dstr = msg.schedule.dusk.sunEventTime;\n timepos = dstr.indexOf('T')+1;\n time = dstr.substr(timepos, 5);\n states[4] = {Event: \"Dusk\", Time: time, Phase: \"Dusk\"}; \n// Night\n dstr = msg.schedule.night.sunEventTime;\n timepos = dstr.indexOf('T')+1;\n time = dstr.substr(timepos, 5);\n states[5] = {Event: \"Night\", Time: time, Phase: \"Night\"}; \n// Updated \n var date = new Date();\n dstr = ('00' + date.getDate()).slice(-2) + '/' + ('00' +(date.getMonth()+1)).slice(-2); \n dstr = dstr + \" \" + ('00' + date.getHours()).slice(-2) + ':' + ('00' + date.getMinutes()).slice(-2);\n states[7] = {Event: \"Last Update\", Time: dstr, Phase: \"\"}; \n// Write out array\nflow.set(\"Events\",states,\"File\");\n// Update dashboard\nmsg.payload = states;\nreturn msg;\n\nschedule.sunrise.sunEventTime", "outputs": 1, "noerr": 0, "x": 460, "y": 360, "wires": [ [ "f8ef58d7.7c71e8" ] ] } ]
I have not changed my code but perhaps it was incorrect in the first place, please can you review.
Thanks
Chris
On Thu, 28 May 2020 at 10:46, Chris Gough chrisg2003@gmail.com wrote:
Many thanks.
Chris
On Thu, 28 May 2020 at 10:36, Cornelius Suermann notifications@github.com wrote:
My bad, Node-Red changed https://nodered.org/docs/creating-nodes/packaging the way they pick up updates. I now triggered a re-index manually and expect the update to become visible shortly.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/csuermann/node-red-contrib-suncron/issues/8#issuecomment-635232597, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOUSWDCF4KFKZZ5TZITVQGTRTYWCPANCNFSM4NKCRZIA .
Looks like your code is expecting the schedule object to contain certain sun events, which is no longer the case. Try guarding those sections like so:
if (msg.schedule.night) {
dstr = msg.schedule.night.sunEventTime;
}
Thank you, that did the trick.
Chris
On Thu, 28 May 2020 at 13:36, Cornelius Suermann notifications@github.com wrote:
Looks like your code is expecting the schedule object to contain certain sun events, which is no longer the case. Try guarding those sections like so:
if (msg.schedule.night) { dstr = msg.schedule.night.sunEventTime;}
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/csuermann/node-red-contrib-suncron/issues/8#issuecomment-635322779, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOUSWDCE2A4UC2GAIXIV26DRTZLDDANCNFSM4NKCRZIA .
Hi
This node has been working great.
This morning the node didn't report Sunrise and the log shows an error RangeError: Invalid time value.
I haven't changed anything so can you help with a possible explanation.
I have rebooted Pi but the problem persists, Pi is showing correct date and time.
Many thanks