Moon sensor - more information?

First - thanks to the many hard working and clever people that have made HA to what it is. And yet we constantly demand more… :slightly_smiling_face:

Thanks also for making the moon sensor. But, would it be possible to add some more information to it? My wish list:

  • Moon age (days since last new moon)
  • Next full moon (date and/or days until)
  • Next new moon (date and/or days until)

…And of course a symbol that changes with the moon phase, similar to the changing symbol of the yr-platform (https://home-assistant.io/components/sensor.yr/).

1 Like

I’ve been wanting to extract the same data. Mostly Full and New moon. I have planned on trying the examples from the Sun component, but haven’t had time yet. It would be great to get more info on how to work with this component. TL;DR “Bump”

1 Like

And % illumination.

Great that I’m not the only one with an interest in the moon sensor! But don’t forget to hit the “vote” button. :slight_smile:

1 Like

I’d like to know:

Is the moon is up right now?
Will the moon be up at midnight?

For generating alerts for good conditions for viewing night sky

The phases of the moon with Dates & Times can be retrieved from google calendars.

1 Like

And if you want illumination, I just recently asked for and received an update to the DarkSky sensor for moonphase.

hi, did anyone get this working with dates and times of moon phases?

I have a changing moon phase icon.

If you’re using Home Assistant Core you can use this:

This can be done with

Moon rise and moon set times would be nice, just like sun rise and sun set times.

1 Like

I really like how the website Moon Giant (https://www.moongiant.com/) is doing it. As an aside, I noticed that the moon sensor in my Home Assistant setup never shows either Full Moon or New Moon. It goes straight from Waxing to Waning Gibbous (no full moon in between) and such, but maybe that is just my setup.

This is available in the astroweather integration:

Screenshot 2021-08-22 at 20-06-17 Overview - Home Assistant

4 Likes

I have the same problem with it never showing full or new moon. Must be a problem with the integration.

Any movement on this request yet?

Yes, and also via Node-RED’s node-red-contrib-sun-position

New sensor in HA from NR:

2 Likes

Here is my new “Moon” device and sensors in HA from node-red-contrib-sun-position.
(if inappropriate for this thread I will delete)

image

3 Likes

Hay thats awesome!!,
am super interested in setting this up. Can you please post your Node setup code here? also the dashboard code? Super super appreciate it !!

Here’s the flow…

My Moon Flow

[{"id":"cd73508c3ee2c589","type":"tab","label":"Moon","disabled":false,"info":"","env":[]},{"id":"d99ac08d.fdb94","type":"moon-position","z":"cd73508c3ee2c589","name":"","positionConfig":"31826811.22a458","rules":[],"topic":"","outputs":1,"x":320,"y":480,"wires":[["01425d6b40433043","4d098cf69c0d1386","ee64561f7d544557","9fed9ae5a7e67ec0","0d3f91975205d04d","8ca42cdafedce756","770ae4c3f5715e54","2cf84b33f3348465","4499d65ead8a0323","f4f1a84c79fb70fa","8037990bab97d27d","c86dba61d4294d46","43902da3a9d9c64b","d8f1dc37a1d445f6","1ede46c7c1abb3c2","37af0e66c01f18bf","1d386581e79cca65","7bc7e846a2cf8486"]]},{"id":"01425d6b40433043","type":"ha-binary-sensor","z":"cd73508c3ee2c589","name":"above horizon","entityConfig":"e83de2bfb20f08c8","version":0,"state":"payload.isUp","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":620,"y":40,"wires":[[]]},{"id":"4d098cf69c0d1386","type":"debug","z":"cd73508c3ee2c589","name":"Moon","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":370,"y":420,"wires":[]},{"id":"4499d65ead8a0323","type":"ha-sensor","z":"cd73508c3ee2c589","name":"illumination.phaseValue","entityConfig":"16245a092f465ac3","version":0,"state":"payload.illumination.phaseValue","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":650,"y":460,"wires":[[]]},{"id":"2cf84b33f3348465","type":"ha-sensor","z":"cd73508c3ee2c589","name":"illumination.phase.name","entityConfig":"6a26472d3857b1a9","version":0,"state":"payload.illumination.phase.name","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":650,"y":400,"wires":[[]]},{"id":"770ae4c3f5715e54","type":"ha-sensor","z":"cd73508c3ee2c589","name":"illumination.fraction","entityConfig":"cd8195b35d10427e","version":0,"state":"payload.illumination.fraction","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":630,"y":340,"wires":[[]]},{"id":"7c20d89035c6e176","type":"ha-sensor","z":"cd73508c3ee2c589","name":"illumination.angle","entityConfig":"d1eecc257e9491ba","version":0,"state":"payload.illumination.angle","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":930,"y":320,"wires":[[]]},{"id":"8ca42cdafedce756","type":"ha-sensor","z":"cd73508c3ee2c589","name":"parallacticAngle","entityConfig":"fbee95713584b7e3","version":0,"state":"payload.parallacticAngle","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":620,"y":280,"wires":[[]]},{"id":"0d3f91975205d04d","type":"ha-sensor","z":"cd73508c3ee2c589","name":"distance","entityConfig":"aed9837121d8389c","version":0,"state":"payload.distance","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":600,"y":220,"wires":[[]]},{"id":"9fed9ae5a7e67ec0","type":"ha-sensor","z":"cd73508c3ee2c589","name":"altitude","entityConfig":"ca133e560867ffbb","version":0,"state":"payload.altitude","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":600,"y":160,"wires":[[]]},{"id":"ee64561f7d544557","type":"ha-sensor","z":"cd73508c3ee2c589","name":"azimuth","entityConfig":"b3cdc18e8f681572","version":0,"state":"payload.azimuth","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":600,"y":100,"wires":[[]]},{"id":"cd0da6c80ccb618c","type":"ha-sensor","z":"cd73508c3ee2c589","name":"illumination.phase.angle","entityConfig":"096da4ca249a11d2","version":0,"state":"payload.illumination.phase.angle","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":950,"y":480,"wires":[[]]},{"id":"f4f1a84c79fb70fa","type":"ha-sensor","z":"cd73508c3ee2c589","name":"illumination.zenithAngle","entityConfig":"adf4bcd33a0bdfa2","version":0,"state":"payload.illumination.zenithAngle","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":650,"y":520,"wires":[[]]},{"id":"8037990bab97d27d","type":"ha-sensor","z":"cd73508c3ee2c589","name":"times.rise","entityConfig":"795c29977f2fde78","version":0,"state":"payload.times.rise","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":600,"y":580,"wires":[[]]},{"id":"c86dba61d4294d46","type":"ha-sensor","z":"cd73508c3ee2c589","name":"times.set","entityConfig":"ec1cbad4d9505762","version":0,"state":"payload.times.set","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":600,"y":640,"wires":[[]]},{"id":"1ede46c7c1abb3c2","type":"ha-sensor","z":"cd73508c3ee2c589","name":"times.highest","entityConfig":"13c87a39444188b0","version":0,"state":"payload.times.highest","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":610,"y":820,"wires":[[]]},{"id":"37af0e66c01f18bf","type":"ha-sensor","z":"cd73508c3ee2c589","name":"timesNext.rise","entityConfig":"685d8471bbb8bac3","version":0,"state":"payload.timesNext.rise","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":620,"y":880,"wires":[[]]},{"id":"1d386581e79cca65","type":"ha-sensor","z":"cd73508c3ee2c589","name":"timesNext.set","entityConfig":"05c90a4ef4106306","version":0,"state":"payload.timesNext.set","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":620,"y":940,"wires":[[]]},{"id":"43902da3a9d9c64b","type":"ha-binary-sensor","z":"cd73508c3ee2c589","name":"moon.AlwaysDown","entityConfig":"14ef7b17b7af197a","version":0,"state":"payload.times.alwaysDown","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":630,"y":760,"wires":[[]]},{"id":"d8f1dc37a1d445f6","type":"ha-binary-sensor","z":"cd73508c3ee2c589","name":"moon.alwaysUp","entityConfig":"99ef085f01b6abcb","version":0,"state":"payload.times.alwaysUp","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":620,"y":700,"wires":[[]]},{"id":"7bc7e846a2cf8486","type":"ha-sensor","z":"cd73508c3ee2c589","name":"timesNext.highest","entityConfig":"22b2306a5ab0a8af","version":0,"state":"payload.timesNext.highest","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":630,"y":1000,"wires":[[]]},{"id":"a744227844b59f34","type":"ha-sensor","z":"cd73508c3ee2c589","name":"Moon Age","entityConfig":"6a7749c3e795a668","version":0,"state":"453000000000","stateType":"num","attributes":[],"inputOverride":"allow","outputProperties":[],"x":300,"y":540,"wires":[[]]},{"id":"ac84bb62380670e8","type":"ha-sensor","z":"cd73508c3ee2c589","name":"Moon Density","entityConfig":"0b6cc163cc6279c3","version":0,"state":"3.34","stateType":"num","attributes":[],"inputOverride":"allow","outputProperties":[],"x":320,"y":600,"wires":[[]]},{"id":"5983f248b4210ec9","type":"ha-sensor","z":"cd73508c3ee2c589","name":"Moon Gravity","entityConfig":"2a5674e39c5fe24d","version":0,"state":"1.62","stateType":"num","attributes":[],"inputOverride":"allow","outputProperties":[],"x":310,"y":660,"wires":[[]]},{"id":"787bdac64db5d38e","type":"ha-sensor","z":"cd73508c3ee2c589","name":"Moon Radius","entityConfig":"ac7d7cfde27b4e50","version":0,"state":"1737.4","stateType":"num","attributes":[],"inputOverride":"allow","outputProperties":[],"x":310,"y":720,"wires":[[]]},{"id":"338f344d93d7ab9b","type":"ha-sensor","z":"cd73508c3ee2c589","name":"Moon Apparent Magnitude","entityConfig":"e1e183afd2ebe230","version":0,"state":"-12.74","stateType":"num","attributes":[],"inputOverride":"allow","outputProperties":[],"x":360,"y":780,"wires":[[]]},{"id":"c0c42b7af42d1e11","type":"inject","z":"cd73508c3ee2c589","name":"Timestamp","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"60","crontab":"","once":true,"onceDelay":"5","topic":"date-time","payload":"","payloadType":"date","x":110,"y":620,"wires":[["d99ac08d.fdb94","a744227844b59f34","ac84bb62380670e8","5983f248b4210ec9","787bdac64db5d38e","338f344d93d7ab9b"]]},{"id":"31826811.22a458","type":"position-config","name":"Home Location","isValide":"true","longitude":"0","latitude":"0","angleType":"deg","timeZoneOffset":99,"timeZoneDST":0,"stateTimeFormat":"3","stateDateFormat":"12","contextStore":""},{"id":"e83de2bfb20f08c8","type":"ha-entity-config","server":"c879ac61.99cd1","deviceConfig":"cf0cb29df689c97a","name":"Moon Above Horizon","version":"6","entityType":"binary_sensor","haConfig":[{"property":"name","value":"Above Horizon"},{"property":"icon","value":""},{"property":"entity_picture","value":""},{"property":"entity_category","value":""},{"property":"device_class","value":""}],"resend":true,"debugEnabled":false},{"id":"16245a092f465ac3","type":"ha-entity-config","server":"c879ac61.99cd1","deviceConfig":"cf0cb29df689c97a","name":"Moon Illumination Phase Value","version":"6","entityType":"sensor","haConfig":[{"property":"name","value":"Illumination Phase Value"},{"property":"icon","value":""},{"property":"entity_picture","value":""},{"property":"entity_category","value":""},{"property":"device_class","value":""},{"property":"unit_of_measurement","value":""},{"property":"state_class","value":""}],"resend":false,"debugEnabled":false},{"id":"6a26472d3857b1a9","type":"ha-entity-config","server":"c879ac61.99cd1","deviceConfig":"cf0cb29df689c97a","name":"Moon Illumination Phase","version":"6","entityType":"sensor","haConfig":[{"property":"name","value":"Illumination Phase"},{"property":"icon","value":""},{"property":"entity_picture","value":""},{"property":"entity_category","value":""},{"property":"device_class","value":""},{"property":"unit_of_measurement","value":""},{"property":"state_class","value":""}],"resend":false,"debugEnabled":false},{"id":"cd8195b35d10427e","type":"ha-entity-config","server":"c879ac61.99cd1","deviceConfig":"cf0cb29df689c97a","name":"Moon Illumination Fraction","version":"6","entityType":"sensor","haConfig":[{"property":"name","value":"Illumination Fraction"},{"property":"icon","value":""},{"property":"entity_picture","value":""},{"property":"entity_category","value":""},{"property":"device_class","value":""},{"property":"unit_of_measurement","value":""},{"property":"state_class","value":""}],"resend":false,"debugEnabled":false},{"id":"d1eecc257e9491ba","type":"ha-entity-config","server":"c879ac61.99cd1","deviceConfig":"cf0cb29df689c97a","name":"Moon Illumination Angle","version":"6","entityType":"sensor","haConfig":[{"property":"name","value":"Illumination Angle"},{"property":"icon","value":""},{"property":"entity_picture","value":""},{"property":"entity_category","value":""},{"property":"device_class","value":""},{"property":"unit_of_measurement","value":""},{"property":"state_class","value":""}],"resend":false,"debugEnabled":false},{"id":"fbee95713584b7e3","type":"ha-entity-config","server":"c879ac61.99cd1","deviceConfig":"cf0cb29df689c97a","name":"Moon Parallactic Angle","version":"6","entityType":"sensor","haConfig":[{"property":"name","value":"Parallactic Angle"},{"property":"icon","value":""},{"property":"entity_picture","value":""},{"property":"entity_category","value":""},{"property":"device_class","value":""},{"property":"unit_of_measurement","value":"°"},{"property":"state_class","value":""}],"resend":false,"debugEnabled":false},{"id":"aed9837121d8389c","type":"ha-entity-config","server":"c879ac61.99cd1","deviceConfig":"cf0cb29df689c97a","name":"Moon Distance","version":"6","entityType":"sensor","haConfig":[{"property":"name","value":"Distance"},{"property":"icon","value":""},{"property":"entity_picture","value":""},{"property":"entity_category","value":""},{"property":"device_class","value":"distance"},{"property":"unit_of_measurement","value":"km"},{"property":"state_class","value":"measurement"}],"resend":false,"debugEnabled":false},{"id":"ca133e560867ffbb","type":"ha-entity-config","server":"c879ac61.99cd1","deviceConfig":"cf0cb29df689c97a","name":"Moon Altitude","version":"6","entityType":"sensor","haConfig":[{"property":"name","value":"Altitude"},{"property":"icon","value":""},{"property":"entity_picture","value":""},{"property":"entity_category","value":""},{"property":"device_class","value":""},{"property":"unit_of_measurement","value":"°"},{"property":"state_class","value":""}],"resend":false,"debugEnabled":false},{"id":"b3cdc18e8f681572","type":"ha-entity-config","server":"c879ac61.99cd1","deviceConfig":"cf0cb29df689c97a","name":"Moon Azimuth","version":"6","entityType":"sensor","haConfig":[{"property":"name","value":"Azimuth"},{"property":"icon","value":""},{"property":"entity_picture","value":""},{"property":"entity_category","value":""},{"property":"device_class","value":""},{"property":"unit_of_measurement","value":"°"},{"property":"state_class","value":""}],"resend":true,"debugEnabled":false},{"id":"096da4ca249a11d2","type":"ha-entity-config","server":"c879ac61.99cd1","deviceConfig":"cf0cb29df689c97a","name":"Moon Illumination Phase Angle","version":"6","entityType":"sensor","haConfig":[{"property":"name","value":"Illumination Phase Angle"},{"property":"icon","value":""},{"property":"entity_picture","value":""},{"property":"entity_category","value":""},{"property":"device_class","value":""},{"property":"unit_of_measurement","value":"deg"},{"property":"state_class","value":"measurement"}],"resend":false,"debugEnabled":false},{"id":"adf4bcd33a0bdfa2","type":"ha-entity-config","server":"c879ac61.99cd1","deviceConfig":"cf0cb29df689c97a","name":"Moon Illumination Zenith Angle","version":"6","entityType":"sensor","haConfig":[{"property":"name","value":"Illumination Zenith Angle"},{"property":"icon","value":""},{"property":"entity_picture","value":""},{"property":"entity_category","value":""},{"property":"device_class","value":""},{"property":"unit_of_measurement","value":"°"},{"property":"state_class","value":""}],"resend":false,"debugEnabled":false},{"id":"795c29977f2fde78","type":"ha-entity-config","server":"c879ac61.99cd1","deviceConfig":"cf0cb29df689c97a","name":"Moon Rise","version":"6","entityType":"sensor","haConfig":[{"property":"name","value":"Moon Moon Rise "},{"property":"icon","value":""},{"property":"entity_picture","value":""},{"property":"entity_category","value":""},{"property":"device_class","value":"timestamp"},{"property":"unit_of_measurement","value":""},{"property":"state_class","value":""}],"resend":true,"debugEnabled":false},{"id":"ec1cbad4d9505762","type":"ha-entity-config","server":"c879ac61.99cd1","deviceConfig":"cf0cb29df689c97a","name":"Moon Set","version":"6","entityType":"sensor","haConfig":[{"property":"name","value":"Moon Moon Set"},{"property":"icon","value":""},{"property":"entity_picture","value":""},{"property":"entity_category","value":""},{"property":"device_class","value":"timestamp"},{"property":"unit_of_measurement","value":""},{"property":"state_class","value":""}],"resend":false,"debugEnabled":false},{"id":"13c87a39444188b0","type":"ha-entity-config","server":"c879ac61.99cd1","deviceConfig":"cf0cb29df689c97a","name":"Moon Time Highest","version":"6","entityType":"sensor","haConfig":[{"property":"name","value":"Time Highest"},{"property":"icon","value":""},{"property":"entity_picture","value":""},{"property":"entity_category","value":""},{"property":"device_class","value":"timestamp"},{"property":"unit_of_measurement","value":""},{"property":"state_class","value":""}],"resend":false,"debugEnabled":false},{"id":"685d8471bbb8bac3","type":"ha-entity-config","server":"c879ac61.99cd1","deviceConfig":"cf0cb29df689c97a","name":"Moon Next Rise","version":"6","entityType":"sensor","haConfig":[{"property":"name","value":"Next Rise"},{"property":"icon","value":""},{"property":"entity_picture","value":""},{"property":"entity_category","value":""},{"property":"device_class","value":"timestamp"},{"property":"unit_of_measurement","value":""},{"property":"state_class","value":""}],"resend":true,"debugEnabled":false},{"id":"05c90a4ef4106306","type":"ha-entity-config","server":"c879ac61.99cd1","deviceConfig":"cf0cb29df689c97a","name":"Moon Next Set","version":"6","entityType":"sensor","haConfig":[{"property":"name","value":"Next Set"},{"property":"icon","value":""},{"property":"entity_picture","value":""},{"property":"entity_category","value":""},{"property":"device_class","value":"timestamp"},{"property":"unit_of_measurement","value":""},{"property":"state_class","value":""}],"resend":false,"debugEnabled":false},{"id":"14ef7b17b7af197a","type":"ha-entity-config","server":"c879ac61.99cd1","deviceConfig":"cf0cb29df689c97a","name":"Moon Always Down","version":"6","entityType":"binary_sensor","haConfig":[{"property":"name","value":"Always Down"},{"property":"icon","value":""},{"property":"entity_picture","value":""},{"property":"entity_category","value":""},{"property":"device_class","value":""}],"resend":true,"debugEnabled":false},{"id":"99ef085f01b6abcb","type":"ha-entity-config","server":"c879ac61.99cd1","deviceConfig":"cf0cb29df689c97a","name":"Moon Always Up","version":"6","entityType":"binary_sensor","haConfig":[{"property":"name","value":"Always Up"},{"property":"icon","value":""},{"property":"entity_picture","value":""},{"property":"entity_category","value":""},{"property":"device_class","value":""}],"resend":false,"debugEnabled":false},{"id":"22b2306a5ab0a8af","type":"ha-entity-config","server":"c879ac61.99cd1","deviceConfig":"cf0cb29df689c97a","name":"Moon Next Highest","version":"6","entityType":"sensor","haConfig":[{"property":"name","value":"Next Highest"},{"property":"icon","value":""},{"property":"entity_picture","value":""},{"property":"entity_category","value":""},{"property":"device_class","value":"timestamp"},{"property":"unit_of_measurement","value":""},{"property":"state_class","value":""}],"resend":false,"debugEnabled":false},{"id":"6a7749c3e795a668","type":"ha-entity-config","server":"c879ac61.99cd1","deviceConfig":"cf0cb29df689c97a","name":"Moon Age","version":"6","entityType":"sensor","haConfig":[{"property":"name","value":"Moon Moon Age"},{"property":"icon","value":""},{"property":"entity_picture","value":""},{"property":"entity_category","value":"diagnostic"},{"property":"device_class","value":""},{"property":"unit_of_measurement","value":"years"},{"property":"state_class","value":""}],"resend":false,"debugEnabled":false},{"id":"0b6cc163cc6279c3","type":"ha-entity-config","server":"c879ac61.99cd1","deviceConfig":"cf0cb29df689c97a","name":"Moon Density","version":"6","entityType":"sensor","haConfig":[{"property":"name","value":"Moon Density"},{"property":"icon","value":""},{"property":"entity_picture","value":""},{"property":"entity_category","value":"diagnostic"},{"property":"device_class","value":""},{"property":"unit_of_measurement","value":"g/cm³"},{"property":"state_class","value":""}],"resend":false,"debugEnabled":false},{"id":"2a5674e39c5fe24d","type":"ha-entity-config","server":"c879ac61.99cd1","deviceConfig":"cf0cb29df689c97a","name":"Moon Gravity","version":"6","entityType":"sensor","haConfig":[{"property":"name","value":"Moon Gravity"},{"property":"icon","value":""},{"property":"entity_picture","value":""},{"property":"entity_category","value":"diagnostic"},{"property":"device_class","value":""},{"property":"unit_of_measurement","value":"m/s²"},{"property":"state_class","value":""}],"resend":false,"debugEnabled":false},{"id":"ac7d7cfde27b4e50","type":"ha-entity-config","server":"c879ac61.99cd1","deviceConfig":"cf0cb29df689c97a","name":"Moon Radius","version":"6","entityType":"sensor","haConfig":[{"property":"name","value":"Moon Radius"},{"property":"icon","value":""},{"property":"entity_picture","value":""},{"property":"entity_category","value":"diagnostic"},{"property":"device_class","value":""},{"property":"unit_of_measurement","value":"km"},{"property":"state_class","value":""}],"resend":false,"debugEnabled":false},{"id":"e1e183afd2ebe230","type":"ha-entity-config","server":"c879ac61.99cd1","deviceConfig":"cf0cb29df689c97a","name":"Moon Apparent Magnitude","version":"6","entityType":"sensor","haConfig":[{"property":"name","value":"Moon Apparent Magnitude"},{"property":"icon","value":""},{"property":"entity_picture","value":""},{"property":"entity_category","value":"diagnostic"},{"property":"device_class","value":""},{"property":"unit_of_measurement","value":"(V)"},{"property":"state_class","value":""}],"resend":false,"debugEnabled":false},{"id":"c879ac61.99cd1","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":false,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true},{"id":"cf0cb29df689c97a","type":"ha-device-config","name":"Node-Red Moon","hwVersion":"","manufacturer":"Node-RED","model":"node-red-contrib-sun-position","swVersion":"2.2.0-beta3"}]

1 Like

Here are my lovelace cards…

Button Card
type: custom:button-card
aspect_ratio: 1/0.6
show_entity_picture: true
show_name: true
show_state: true
show_label: true
entity: sensor.moon_phase
styles:
  card:
    - text-transform: capitalize
    - color: |
        [[[
         if (entity.state == 'full_moon')
           if (states['sun.sun'].state == 'below_horizon') 
             return "steelblue";
           else
             return "darkblue";
         else 
           if (states['sun.sun'].state == 'below_horizon') 
             return "white";
           else
             return "black"; 
        ]]]
    - background-color: |
        [[[
         if (states['sun.sun'].state == 'below_horizon') 
          return "black";
         else return "grey";
        ]]]
entity_picture: |
  [[[ return `/local/images/moon/${entity.state}-bg-removed.png`; ]]]
name: Moon Phase
label: |
  [[[
   return states['sensor.moon'].state.replace('_',' ');
  ]]]

image

Entities card
type: entities
entities:
  - entity: binary_sensor.above_horizon
  - type: attribute
    name: Phase
    entity: binary_sensor.above_horizon
    attribute: phase
  - type: attribute
    name: Altitude
    entity: binary_sensor.above_horizon
    attribute: altitude
  - type: attribute
    name: Azimuth
    entity: binary_sensor.above_horizon
    attribute: azimuth
  - type: attribute
    name: Illumination
    entity: binary_sensor.above_horizon
    attribute: illumination
  - type: attribute
    name: Moon Rise
    entity: binary_sensor.above_horizon
    attribute: rise
  - type: attribute
    name: Moon Set
    entity: binary_sensor.above_horizon
    attribute: set
  - type: attribute
    name: Next Set
    entity: binary_sensor.above_horizon
    attribute: next_set
  - type: attribute
    name: Next Rise
    entity: binary_sensor.above_horizon
    attribute: next_rise
  - type: attribute
    name: Next Rise
    entity: binary_sensor.above_horizon
    attribute: next_rise
  - type: attribute
    name: Next New Moon
    entity: binary_sensor.above_horizon
    attribute: next_new_moon
  - type: attribute
    name: Next Full Moon
    entity: binary_sensor.above_horizon
    attribute: next_full_moon
  - type: attribute
    name: Next 1st Quarter
    entity: binary_sensor.above_horizon
    attribute: next_first_quarter
  - type: attribute
    name: Next 3rd Quarter
    entity: binary_sensor.above_horizon
    attribute: next_third_quarter
state_color: true

1 Like