Earth Inclination/Declination

I thought of a new challenge while awake at 2am in the morning and set myself a challenge to build a picture of the Earth and rotate it on a card to show the declination in realtime.
As the earth was just about to transition into the winter phase, in the northern hemisphere, I thought this might be an opportune moment to watch the change.

So here is my card picture, which I tested out by injecting different degrees to ensure it works ok.

For anybody interested I am using the Custom Button Card to show an entity picture of the earth, which is rotated and a static background picture to show the degree scale. I will admit it was a bit tricky to get the graphics right and I wasnā€™t even sure I could really get it work.

Hi man, love your work. Can we see details of the code you used?

Thank you.

The data was obtained through using Node-red and the Sun-position Node.

The Custom Button Card config, which isnā€™t too complicated, once I had worked out how to get a background and a separate picture.

type: custom:button-card
entity: sensor.phasedata
show_entity_picture: true
show_label: false
show_state: false
show_name: false
show_icon: false
name: |
  [[[ 
    return "Declination: " + states['sensor.k_sun_declination'].state +" deg"
  ]]]
entity_picture: |
  [[[
      return "/local/sun/earth7.png";
   ]]]  
styles:
  card:
    - background: |
        [[[
          return 'url(/local/sun/backplatefin.png) round'
        ]]]   
    - padding: 0
    - height: 400px
    - width: 400px
    - border: 1
    - background-size: cover
  entity_picture:
    - width: 300px
    - height: 300px
    - rotate: |
        [[[ 
          return states['sensor.k_sun_declination'].state +"deg"
        ]]]

The picture of the earth was just something I found on the internet and I added the crosshair in photoshop. The scale was made by using the canvas guage card, and captured as screen image, which I then overlaid in photoshop to the right size and in the right place . The two images were then saved as individual files.

earth7

The tricky part was getting it all to line up properly and I expect there is a better way of doing all of this nonsense. However it did keep me amused for a while.

The other guage card below was simple enough.

type: custom:canvas-gauge-card
entity: sensor.k_sun_declination
card_height: 150
background_color: rgb(250, 250, 250)
gauge:
  colorPlate: rgb(250, 250, 250)
  animation: false
  exactTicks: true
  animationTarget: needle
  type: radial-gauge
  needleType: arrow
  needleWidth: 3
  colorNeedle: rgb(77, 84, 92, .90)
  colorNeedleEnd: rgb(150, 161, 176, 90)
  needleShadow: true
  colorNeedleShadowUp: rgba(209, 223, 240,.90)
  colorNeedleShadowDown: rgba(77, 84, 92, .10)
  colorNeedleCircleOuterEnd: rgba(209, 223, 240)
  colorNeedleCircleOuter: rgba(77, 84, 92)
  colorNeedleCircleInnerEnd: rgba(77, 84, 92)
  colorNeedleCircleInner: rgba(209, 223, 240)
  title: DECLINATION
  width: 250
  height: 250
  colorTitle: '#fffff'
  colorUnits: '#fffff'
  colorNumbers: '#fffff'
  borderShadowWidth: 0
  borderOuterWidth: 0
  borderMiddleWidth: 0
  borderInnerWidth: 0
  minValue: -23.45
  maxValue: 23.45
  startAngle: 90
  ticksAngle: 180
  valueBox: true
  majorTicks:
    - -23.45
    - -20
    - -15
    - -10
    - -5
    - 0
    - 5
    - 10
    - 15
    - 20
    - 23.45
  fontTitleWeight: bolder
  colorValueBoxBackground: rgba(245, 240, 240, .90)
  colorValueBoxRectEnd: rgba(186, 196, 209,.90)
  colorValueBoxRect: rgba(186, 196, 209,.10)
  colorValueBoxShadow: rgba(93, 98, 105, .90)
  valueInt: 0
  valueDec: 0
  valueBoxBorderRadius: 0
  valueBoxStroke: 0
  valueBoxWidth: 0
  minorTicks: 1
  strokeTicks: true
  highlights:
    - from: -23.45
      to: -1
      color: rgba(255, 200, 1, .99)
    - from: -1
      to: 1
      color: rgba(7, 165, 0, .99)
    - from: 1
      to: 23.45
      color: rgba(149, 197, 245, .99)

and the label underneath

type: custom:button-card
entity: sensor.totalexchange
show_icon: false
show_name: true
show_state: false
show_label: false
name: |
  [[[ 
    return "Declination: " + states['sensor.k_sun_declination'].state +" deg"
  ]]]
styles:
  card:
    - background-color: rgb(250, 250, 250)
      font-weight: bold
      font-size: 15px
      height: 7px
      border: 0

You might well think the entire process was a bit over the top for the end result, but the thing is, I wanted to just see if I could do it and being retired I obviously have too much time on my hands.

I seem to be a bit obsessed with the sun and the moon at the moment, but it is fascinating to see the synchronicity between the two and this simple graph of the sun and moon elevation is a little eye opener. When it is a full moon the two phases are entirely opposite and when it is a new moon the phases completely overlay. Simples I know, but, but I hadnā€™t appreciated that.
image

4 Likes

Not to take anything away from your work with this butā€¦

Iā€™m not sure you will see any type of ā€œchangeā€ in real time with your efforts.

the change from summer to winter (or better yet from autumn to winter) isnā€™t a sudden change but instead itā€™s a very very gradual change over days/weeks.

itā€™s so gradual that the change from winter->spring->summer->autumn->winter takes an entire year.

so effectively the ā€œchangeā€ is continuosly happening.

and the earth tilt doesnā€™t really change either. the axis tilt is always 23.5 degrees.

the only thing that changes is which face/position on the earth is pointing directly at the sun at noon.

unless of course Iā€™m misunderstanding your statement above. which is entirely possible.

Well yes you are correct on the actual terminology, the Earthā€™s axis is as you say is fixed at 23.5 deg. However I am showing here the relative apparant change from an Earthlings point of view, which affects the seasons. As this really is the sun facing the earth, I am aware the correct terminology is ā€˜The Sunā€™s Declinationā€™, but this wanā€™t supposed to be a physics lesson.

You are quite wrong about the change, yes it is not a sudden change, but I have watched this over the past 2 weeks gradually change from -x to +x, which is what I wished to show.
As I spend some of time in the Northern hemisphere and some in the Southern hemisphere, it is of interest to me to see the interaction between the Sun Moon and Earth and the comparisons between both locations, so you are not bursting my bubble. The real point of the exercise, which is what I said at the outset, was to see how to actually make a card that would show this, which was for me a learning curve.

ā€¦ Just thought I would add this: -
As per my original screenshot on the 24th September Declination was 0.921 deg.
Today on the 26th September (11:05) Declination is 1.514 deg
Faster than you think @finity

2 Likes

Just for you finity this is my moon page

1 Like