@jbudd
I have been all over the net trying to understand the differences in illumination and have a few ideas but the different number of days, 27 -29 for a complete moon cycle is confusing!
I am current here:
[{"id":"1744d37c2c9f5c5f","type":"tab","label":"Flow 1","disabled":false,"info":"","env":[]},{"id":"c5f4d76223400422","type":"function","z":"1744d37c2c9f5c5f","name":"","func":"var moonPhase = flow.get(\"location.daily[0].moon_phase\");\nvar payload = parseFloat(moonPhase);\nvar D = Math.ceil(payload * 29.5);\nvar T = payload * 29.5;\nvar phase;\nvar topic;\n\nif(payload === 0){\n phase = '<i class=\"wi wi-moon-new-dark\"></i>';\n topic = (\"New Moon\");\n}else if((payload > 0) && (payload < 0.25)){\n phase = '<i class=\"wi wi-moon-wax-cres-dark\"></i>';\n topic = (\"Waxing Crescent\");\n}else if(payload === 0.25){\n phase = '<i class=\"wi wi-moon-first-quart-dark\"></i>';\n topic = (\"First Quarter\");\n}else if((payload > 0.25) && (payload < 0.5)){\n phase = '<i class=\"wi wi-moon-wax-gibb-dark\"></i>';\n topic = (\"Waxing Gibbous\");\n}else if(payload === 0.5){\n phase = '<i class=\"wi wi-moon-wax-cres-dark\"></i>';\n topic = (\"Full Moon\");\n} else if((payload > 0.5) && (payload < 0.75)){\n phase = '<i class=\"wi wi-moon-wan-gibb-dark\"></i>';\n topic = (\"Waning Gibbous\");\n}else if(payload === 0.75){\n phase = '<i class=\"wi wi-moon-third-quart-dark\"></i>';\n topic = (\"Third Quarter\");\n}else if((payload > 0.75) && (payload < 1)){\n phase = '<i class=\"wi wi-moon-wan-cres-dark\"></i>';\n topic = (\"Waning Crescent\");\n}else{\n //not sure\n}\n\nvar illum;\nif(payload <= 0.5){\n illum = payload * 200;\n}\nif(payload > 0.5){\n illum = (1 - payload) * 200; \n}\nvar msg1 = {topic: topic,payload: phase};// phase\nvar msg2 = {payload: D};// day\nvar msg3 = {payload: illum};// illumination in %\nreturn [msg1,msg2,msg3];\n\n\n","outputs":3,"noerr":0,"initialize":"","finalize":"","libs":[],"x":311.111083984375,"y":137.77777099609375,"wires":[["d74a55c7e74d81c1","3f084befd06a9218"],["5298bc46ed70b8d2","817483d188f630f8"],["4209d280a1820157"]]},{"id":"8ed487c2fe3e8c8a","type":"inject","z":"1744d37c2c9f5c5f","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":101.111083984375,"y":237.77777099609375,"wires":[["c5f4d76223400422"]]},{"id":"d74a55c7e74d81c1","type":"debug","z":"1744d37c2c9f5c5f","name":"Calc","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":571.111083984375,"y":357.77777099609375,"wires":[]},{"id":"3f084befd06a9218","type":"ui_text","z":"1744d37c2c9f5c5f","group":"1c5e5c05ad9e01a5","order":4,"width":0,"height":0,"name":"Moon Phase","label":"{{msg.topic}}","format":"{{msg.payload}}","layout":"row-spread","className":"","x":751.111083984375,"y":117.77777099609375,"wires":[]},{"id":"5298bc46ed70b8d2","type":"ui_text","z":"1744d37c2c9f5c5f","group":"1c5e5c05ad9e01a5","order":5,"width":0,"height":0,"name":"","label":"Lunar Cycle Day","format":"{{msg.payload}}","layout":"row-spread","className":"","x":771.111083984375,"y":157.77777099609375,"wires":[]},{"id":"817483d188f630f8","type":"debug","z":"1744d37c2c9f5c5f","name":"Day","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":491.111083984375,"y":237.77777099609375,"wires":[]},{"id":"4209d280a1820157","type":"ui_text","z":"1744d37c2c9f5c5f","group":"1c5e5c05ad9e01a5","order":4,"width":0,"height":0,"name":"Moon Illumination","label":"Illumination (%)","format":"{{msg.payload | number:0}}","layout":"row-spread","className":"","x":791.111083984375,"y":197.77777099609375,"wires":[]},{"id":"1c5e5c05ad9e01a5","type":"ui_group","name":"Sun/Moon","tab":"9a876ff53a95da86","order":3,"disp":true,"width":"6","collapse":false,"className":""},{"id":"9a876ff53a95da86","type":"ui_tab","name":"Weather","icon":"dashboard","order":8,"disabled":false,"hidden":false}]
I will have to look at this over a period of time to determine what inaccuracies I have. The illumination percentage I have in Node-Red does not agree with my Huawei watch. When I looked yesterday if I increased the Lunar Cycle Day in my N-R by one, it agreed with my watch.
I am finding the the Cloud Cover data from OWM hopelessly inaccurate, it was showing 0 this morning for my location when to my eye it was about 80%!