Moon visibility sensor (+switch?) - Can someone help me figure it out?

Hi everyone,

My 2 year old absolutely loves seeing the moon, so I would like to have a custom button card displaying when the moon is visible on our wall dashboard. All of this I can do, but I just need to make a sensor for it, and have not been able to figure it out. Only how to show the phase of the moon as the icon, which is also part of the task.

What I need is probably some sensors and if formulas, but I got no clue how to set it up. I found an API that can pull the moon rise/set times. So I guess that if it was possible to turn on a “Moon Visible” switch when the moon has risen, and the sky visibility is above some level - it would do.

Someone up for helping?

Have you tried the Moon Sensor?

Moon Sensor only tells you what the phase is, not whether it is visible at your location. Glancing through some of the source code, it should be fairly easy to create a moon visibility sensor similar to the sun visibility sensor. My coding skills with HA aren’t quite up to that task yet :frowning:

Then perhaps you can use a RESTful Sensor to acquire the moonrise/set times.

Did you ever get this working?