i use this node to display endTime of the sun in Dashboard : node-red-contrib-sunpos
Run on a RPI, This is the result :
- on top : the endTime in US format
- on bottom (for information) : the time in a chart in FR format
[{"id":"451fc132.9331d","type":"inject","z":"fe2c7bc6.bd49c8","name":"make request","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":"","x":96.04759216308594,"y":2122.65452003479,"wires":[["3df695cb.25097a"]]},{"id":"3df695cb.25097a","type":"sunpos","z":"fe2c7bc6.bd49c8","name":"","lon":"6.4752","lat":"43.5427","start":"sunrise","startoffset":0,"end":"sunset","endoffset":0,"x":250,"y":2120,"wires":[["796a91ee.2919c","2147b18.79c844e"]]},{"id":"796a91ee.2919c","type":"function","z":"fe2c7bc6.bd49c8","name":"endTime +alt/azi+icone","func":"var seconds = msg.payload.endTime;\nvar endLocaleTime;\nvar azimuth = Math.round(msg.payload.azimuth*10)/10;//msg.payload.azimuth;//azimuth = azimuth.toFixed(1);\nvar altitude = Math.round(msg.payload.altitude*10)/10;//msg.payload.altitude;//altitude = altitude.toFixed(1);\nvar sunInSky = msg.payload.sunInSky;\n\n//transforme epoch en 21:01:449\nvar d = new Date(msg.payload.endTime);\nvar n = d.toLocaleTimeString();\nendLocaleTime = n;\n\n//compare si nuit ou jour ?\nvar secondsNow = msg.time;\nif (secondsNow > seconds || secondsNow < msg.startTime){\n flow.set('wvcPow5min',0 ); //evite 0.8w toute la nuit\n msg.razCountEnergy = 0;\n msg.state = \"wvcPow5min=0 !\";\n msg.icone = 'https://cdn.icon-icons.com/icons2/1370/PNG/128/if-weather-4-2682847_90799.png';//https://cdn.icon-icons.com/icons2/799/PNG/128/night-01_icon-icons.com_65776.png';//https://cdn.icon-icons.com/icons2/1465/PNG/512/640crescentmoon_100402.png';\n msg.title = 'Stand by !' ;\n \n}else{\n msg.razCountEnergy = 0;\n msg.state = \"Production !\";\n msg.icone = 'https://cdn.icon-icons.com/icons2/1370/PNG/128/if-weather-3-2682848_90785.png';//https://cdn.icon-icons.com/icons2/799/PNG/128/sunny512x512-01_icon-icons.com_65775.png';//https://cdn.icon-icons.com/icons2/1465/PNG/512/643sunwithface_101008.png';\n msg.title = 'Working good !' ;\n \n}if (secondsNow == seconds){\n msg.razCountEnergy = 1;\n msg.state = \"Production en pause !\";\n }\n\n//********** affiche le status du Node **********\nnode.status({text:n}); //value});\n\n//prepare les sorties\n node.send([{\n startTime:msg.startTime,\n endTime:msg.endTime,\n endLocaleTime:endLocaleTime,\n seconds:seconds,\n azimuth:azimuth,\n altitude:altitude\n \n },null,null]);\n \n node.send([null,{\n state:msg.state,\n icone:msg.icone,\n title:msg.title,\n razCountEnergy:msg.razCountEnergy,\n sunInSky:sunInSky\n \n },null]);\n \n node.send([null,null,{\n payload:altitude\n \n }]);\n /*\n msg.payload = [];//prepare les sorties\n node.send([{\n startTime:msg.startTime,\n endTime:msg.endTime,\n endLocaleTime:endLocaleTime,\n seconds:seconds,\n azimuth:azimuth,\n altitude:altitude\n \n },null]);\n \n node.send([null,{\n state:msg.state,\n icone:msg.icone,\n title:msg.title,\n razCountEnergy:msg.razCountEnergy,\n sunInSky:sunInSky\n \n }]);\n */\n \n \n \n /*\n msg.payload = [];//prepare les sorties\n node.send([{\n startTime:msg.startTime,\n endTime:msg.endTime,\n endLocaleTime:endLocaleTime,\n seconds:seconds,\n azimuth:azimuth,\n altitude:altitude\n \n },null]);\n \n node.send([null,{\n payload:msg.endTimeOn\n \n }]);\n */","outputs":3,"noerr":0,"x":462,"y":2113,"wires":[["3df592e4.ea359e","40a39504.ff86ec","f69ba939.ed66c8","557aeff4.a36cb","32bbb7dd.b9f828"],["9a43d3a.7772d3","d5355045.f137b"],["109fee9.3012011"]]},{"id":"40a39504.ff86ec","type":"ui_text","z":"fe2c7bc6.bd49c8","group":"8aeba035.813e","order":6,"width":"4","height":"1","name":"endTime","label":"<font color=grey>{{seconds}}s","format":"{{endLocaleTime}}","layout":"row-left","x":904.9406318664551,"y":2101.2142848968506,"wires":[]},{"id":"8aeba035.813e","type":"ui_group","z":"","name":"Power","tab":"255f2630.e1c57a","order":1,"disp":true,"width":"12","collapse":true},{"id":"255f2630.e1c57a","type":"ui_tab","z":"","name":"wvc","icon":"flash_on","order":2,"disabled":false,"hidden":false}]
This is the local variables in RPI :
My question : before few days the endTime is displayed in FR format while until now he was in US. Why display in US now ?