Does anyone know of a Lottery Results integration?

Does anyone here have a project of integrating the Lottery results into their Home Assistant. If so please share

2 Likes

Stumbled upon this and I too would be interested. Having option for Mega Millions and Powerball numbers with winner and payout info. Maybe we can reverse engineer a related Sports gambling integration/card

Hi there, I ended up creating my own South African Lottery API. Just search Resultsza api in Google. Here are the API endpoints available currently:

1. Get Latest Results

Retrieve the latest results for all lottery games in a single call. Results include division details, winning numbers, and prize breakdowns.

Endpoint: GET /api/get_latest_results
Example Use: Display real-time lottery results on your platform.
Optional Parameter: date=YYYY-MM-DD for specific draw dates.


2. Get Results by Game

Fetch draw results for a specific game type, including historical data.

Endpoint: GET /api/get_results_by_game
Example Use: Offer filtered results for games like Lotto, Powerball, or Daily Lotto.
Optional Parameter: date=YYYY-MM-DD for results from a specific date.


3. Generate Random Numbers

Generate random numbers according to the rules of any lottery game type. Perfect for users who want to play with a twist of randomness.

Endpoint: GET /api/generate_random_numbers
Example Use: Help users generate quick picks or lucky numbers.
Optional Parameter: lines=NUMBER_OF_LINES for multiple lines of numbers.


4. Get Hot and Cold Numbers

Retrieve the most frequently (hot) and least frequently (cold) drawn numbers for any game type.

Endpoint: GET /api/get_hot_cold_numbers_stats
Example Use: Offer trend insights and statistics to players.


5. Get Number Frequencies

Fetch the frequency of specific numbers being drawn, with data on when they were last drawn.

Endpoint: GET /api/get_number_frequencies
Example Use: Enhance user decision-making with detailed draw patterns.


6. Get Number Pairs

Fetch the most commonly drawn number pairs for a game type (Top 10 pairs).

Endpoint: GET /api/get_number_pairs
Example Use: Add statistical tools for advanced lottery analysis.


7. Winning Number Checker

Submit played numbers and check them against the official winning numbers of a specific game type and draw date. Get match details, prize division, and winnings.

Endpoint: POST /api/check_played_numbers
Example Use: Build a service for players to verify their tickets.
Supports: Up to 10 lines of numbers per request.


8. Bulk Number Checker

Check up to 500 lines of played numbers against winning numbers. Ideal for power users or businesses handling large datasets.

Endpoint: POST /api/bulk_check_numbers
Example Use: Streamline ticket validation for retailers or aggregators.
Token Consumption: Based on the number of lines checked. (5 tokens for up to 50 lines check, 10 tokens for up to 100 lines checked and so forth)


9. Text-to-Lucky Numbers (New!)

A unique and fun way to generate personalized lottery numbers based on text input—whether it’s a name, a favorite quote, or anything else! The algorithm ensures adherence to game rules and produces unique numbers for every text input.

Endpoint: POST /api/text_to_lucky_numbers
Example Use: Add an engaging feature to your platform that personalizes lucky numbers.
Token Consumption: Only 1 token per request.
Supported Games: Lotto, Powerball, Daily Lotto.


10. Check API Token Balance

Easily check your remaining API token balance. This call does not consume any tokens.

Endpoint: GET /check_api_key_balance
Example Use: Monitor usage and plan future requests.

Does anyone know why this does not exist in hacs?
would someone get in trouble?

I would love to have an integration that checks the Powerball and mega millions lottery values and notifies me if it’s over a given threshold. I know I have to use the restful API method, but I’m lost for finding a free service that provides the lottery amounts.

To get notification when mega millions or Powerball goes over 500 million, I ended up doing this configuration using restful API with APIverve:

Configuration yml file:

sensor:
  - platform: rest
    name: mega_millions_jackpot
    resource: https://api.apiverve.com/v1/lottery?numbers=megamillions
    value_template: "{{ value_json.data.jackpot | replace('$', '') | replace(' Million', '000000') | int }}"
    headers:
      x-api-key: YOUR_API_KEY
    scan_interval: 86400
  - platform: rest
    name: powerball_jackpot
    resource: https://api.apiverve.com/v1/lottery?numbers=powerball
    value_template: "{{ value_json.data.jackpot | replace('$', '') | replace(' Million', '000000') | int }}"
    headers:
      x-api-key: YOUR_API_KEY
    scan_interval: 86400

Automation:

alias: 'Lottery Jackpot Notification'
  trigger:
    - platform: state
      entity_id: sensor.mega_millions_jackpot
    - platform: state
      entity_id: sensor.powerball_jackpot
  condition:
    - condition: template
      value_template: >
        {{ states('sensor.mega_millions_jackpot') | int > 500000000 or
           states('sensor.powerball_jackpot') | int > 500000000 }}
  action:
    - service: notify.mobile_app_<your_phone_name>
      data:
        title: "Lottery Jackpot Alert! 🤑"
        message: >
          The lottery jackpots are high!
          
          Mega Millions: ${{ '{:,.0f}'.format(states('sensor.mega_millions_jackpot') | int) }}
          
          Powerball: ${{ '{:,.0f}'.format(states('sensor.powerball_jackpot') | int) }}


Here on the next 3 posts are what I have developed after a few weeks of AI and trial and errors, it recovers the Euro Millions lottery results for both Tuesday’s and Friday’s draws. You can also add 3 lines of your own numbers in to the Friday’s Checker and the same numbers are used to check if you won on either of the Euro Millions weekly draws. Just change the “9,9,9,9” to your preferred numbers or use the created Input Fields on your Dashboard View. I used “Action-Cards” so you would need to install that integration on HACS. if you click on the results checker views then it opens the corresponding website.

Here is my Dashboard view cards (just create a new dashboard view and edit in .yaml to add the following:

type: sections
title: lottery
icon: mdi:slot-machine-outline
cards:
  - type: custom:gap-card
    height: 400
  - type: custom:gap-card
    height: 400
sections:
  - type: grid
    cards:
      - type: custom:actions-card
        card:
          type: vertical-stack
          cards:
            - type: entities
              title: Euro-Millions Tuesday's Draw
              entities:
                - entity: input_boolean.euromillions_checking_tuesday_enabled
                  icon: mdi:magnify
                - entity: sensor.euro_millions_tuesday_s_numbers
                  name: Tuesday's Numbers
                - entity: sensor.euro_millions_tuesday_s_lucky_stars
                  name: Tuesday's Lucky Stars
                - entity: sensor.euromillions_tuesday_millionaire_maker
                  name: Millionaire Maker
                - entity: sensor.euro_millions_jackpot
        tap_action:
          action: url
          target: _blank
          url_path: https://www.euro-millions.com/
      - type: custom:actions-card
        card:
          type: entities
          title: Tuesday's Results & Winnings
          entities:
            - entity: sensor.euro_millions_line_1_tuesday_result
              name: Line 1 Result
              secondary_info: attribute
              attribute: prize_estimate
            - entity: sensor.euro_millions_line_2_tuesday_result
              name: Line 2 Result
              secondary_info: attribute
              attribute: prize_estimate
            - entity: sensor.euro_millions_line_3_tuesday_result
              name: Line 3 Result
              secondary_info: attribute
              attribute: prize_estimate
            - entity: sensor.euro_millions_tuesday_summary
              name: Summary
              icon: mdi:trophy
        tap_action:
          action: url
          target: _blank
          url_path: https://www.euro-millions.com/results-checker
  - type: grid
    cards:
      - type: custom:actions-card
        card:
          type: entities
          title: My Lucky Numbers
          entities:
            - entity: input_text.euromillions_line1_numbers
            - entity: input_text.euromillions_line1_stars
            - entity: input_text.euromillions_line2_numbers
            - entity: input_text.euromillions_line2_stars
            - entity: input_text.euromillions_line3_numbers
            - entity: input_text.euromillions_line3_stars
        tap_action:
          action: url
          target: _blank
          url_path: https://www.euro-millions.com/results-checker
        hold_action:
          action: none
        double_tap_action:
          action: none
        swipe_left_action:
          action: none
        swipe_right_action:
          action: none
        swipe_up_action:
          action: none
        swipe_down_action:
          action: none
      - type: custom:actions-card
        card:
          type: vertical-stack
          cards:
            - type: entities
              title: Mega-Millions Lotto
              entities:
                - entity: sensor.mega_millions_last_numbers
                  icon: mdi:slot-machine-outline
                  name: Last Winning Numbers
                - entity: sensor.mega_millions_last_winners
                - entity: sensor.euro_millions_next_draw_day
                  name: Next Draw on
                - entity: sensor.mega_millions_jackpot
                - entity: sensor.mega_millions_cash_value
        tap_action:
          action: url
          target: _blank
          url_path: http://www.mega-millions.com
  - type: grid
    cards:
      - type: custom:actions-card
        card:
          type: vertical-stack
          cards:
            - type: entities
              title: Euro-Millions Friday's Draw
              entities:
                - entity: input_boolean.euromillions_checking_friday_enabled
                  icon: mdi:magnify
                - entity: sensor.euro_millions_friday_s_numbers
                  name: Friday's Numbers
                - entity: sensor.euro_millions_friday_s_lucky_stars
                  name: Friday's Lucky Stars
                - entity: sensor.euromillions_friday_millionaire_maker
                  name: Millionaire Maker
                - entity: sensor.euro_millions_jackpot
        tap_action:
          action: url
          target: _blank
          url_path: http://www.euro-millions.com
        hold_action:
          action: none
        double_tap_action:
          action: none
        swipe_left_action:
          action: none
        swipe_right_action:
          action: none
        swipe_up_action:
          action: none
        swipe_down_action:
          action: none
      - type: custom:actions-card
        card:
          type: entities
          title: Friday's Results & Winnings
          entities:
            - entity: sensor.euro_millions_line_1_friday_result
              name: Line 1 Result
              secondary_info: attribute
              attribute: prize_estimate
            - entity: sensor.euro_millions_line_2_friday_result
              name: Line 2 Result
              secondary_info: attribute
              attribute: prize_estimate
            - entity: sensor.euro_millions_line_3_friday_result
              name: Line 3 Result
              secondary_info: attribute
              attribute: prize_estimate
            - entity: sensor.euro_millions_friday_summary
              name: Summary
              icon: mdi:trophy
        tap_action:
          action: url
          target: _blank
          url_path: https://www.euro-millions.com/results-checker
        hold_action:
          action: none
        double_tap_action:
          action: none
        swipe_left_action:
          action: none
        swipe_right_action:
          action: none
        swipe_up_action:
          action: none
        swipe_down_action:
          action: none

Here are the Euro Millions Rest Sensors and Sensors .yaml:

# Euro-Millions Lottery REST Sensors Configuration
# Fixed version - Add this to your configuration.yaml file

rest:
  - resource: "https://www.euro-millions.com/results"
    scan_interval: 3600  # Check every hour
    headers:
      User-Agent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"
    sensor:

# Latest Draw Numbers (Main 5 numbers from Latest Tuesday Draw)
      - name: "Euro-Millions Tuesday Numbers"
        unique_id: euromillions_tuesday_numbers
        value_template: >
          {% set tuesday_block = value | regex_findall_index("Tuesday's Result[\\s\\S]*?Draw Details", 0) %}
          {% if tuesday_block %}
            {% set numbers = tuesday_block | regex_findall('class=["\']?(?:resultBall ball)[^"\']*["\'][^>]*>\\s*([0-9]{1,2})\\s*<') %}
            {% if numbers | length >= 5 %}
              {{ numbers[0:5] | join(', ') }}
            {% else %}
              "No results"
            {% endif %}
          {% else %}
            "No Tuesday result found"
          {% endif %}
        icon: "mdi:numeric"

# Latest Draw Lucky Stars (from Tuesday)
      - name: "Euro-Millions Tuesday Lucky Stars"
        unique_id: euromillions_tuesday_stars
        value_template: >
          {% set tuesday_block = value | regex_findall_index("Tuesday's Result[\\s\\S]*?Draw Details", 0) %}
          {% if tuesday_block %}
            {% set stars = tuesday_block | regex_findall('class=["\']?(?:resultBall lucky-star)[^"\']*["\'][^>]*>\\s*([0-9]{1,2})\\s*<') %}
            {% if stars | length >= 2 %}
              {{ stars[0:2] | join(', ') }}
            {% else %}
              "No results"
            {% endif %}
          {% else %}
            "No Tuesday result found"
          {% endif %}
        icon: "mdi:star"
        
      - name: "Euro-Millions Jackpot"
        unique_id: euromillions_jackpot
        value_template: >
          {% set jackpot = value | regex_findall_index('jackpot.*?(€[0-9]+(?:\\.[0-9]+)?\\s+Million)', 0) %}
          {% if jackpot %}
            {{ jackpot | trim }}
          {% else %}
            "Unknown"
          {% endif %}
        icon: "mdi:currency-eur"

# Is it a Rollover next Draw?
      - name: "Euro-Millions Rollover"
        unique_id: euromillions_rollover
        value_template: >
          {% set rollover = value | regex_findall_index('<div class=["\']?box bannerBox j1 fx btwn acen wrapSM["\']?[^>]*>(.*?)</div>', 0) %}
          {% if rollover %}
            !! It's a Rollover Next Draw: {{ rollover | trim }} !!
          {% else %}
            "Not this time baby!"
          {% endif %}
        icon: "mdi:currency-eur"



# Millionaire Maker Code Tuesday's
      - name: "EuroMillions Tuesday Millionaire Maker"
        unique_id: euromillions_millionaire_maker_tuesday
        value_template: >
          {% set tuesday_block = value | regex_findall_index("Tuesday's Result[\\s\\S]*?Draw Details", 0) %}
          {% if tuesday_block %}
            {% set codes = tuesday_block | regex_findall('class=["\']?raffle["\']?[^>]*>\s*([A-Z]{4} [0-9]{5})') %}
            {% if codes | length > 0 %}
              {{ codes[0] | trim }}
            {% else %}
              "Unknown"
            {% endif %}
          {% endif %}
        icon: "mdi:ticket"

# Millionaire Maker Code Friday's
      - name: "EuroMillions Friday Millionaire Maker"
        unique_id: euromillions_millionaire_maker_friday
        value_template: >
          {% set friday_block = value | regex_findall_index("Friday's Result[\\s\\S]*?Draw Details", 0) %}
          {% if friday_block %}
            {% set codes = friday_block | regex_findall('class=["\']?raffle["\']?[^>]*>\s*([A-Z]{4} [0-9]{5})') %}
            {% if codes | length > 0 %}
              {{ codes[0] | trim }}
            {% else %}
            "Unknown"
            {% endif %}
          {% endif %}
        icon: "mdi:ticket"

      # Latest Draw Numbers (Main 5 numbers from Latest Friday Draw)
      - name: "Euro-Millions Friday Numbers"
        unique_id: euromillions_friday_numbers
        value_template: >
          {% set friday_block = value | regex_findall_index("Friday's Result[\\s\\S]*?Draw Details", 0) %}
          {% if friday_block %}
            {% set numbers = friday_block | regex_findall('class=["\']?(?:resultBall ball)[^"\']*["\'][^>]*>\\s*([0-9]{1,2})\\s*<') %}
            {% if numbers | length >= 5 %}
              {{ numbers[0:5] | join(', ') }}
            {% else %}
              "No results"
            {% endif %}
          {% else %}
            "No Friday result found"
          {% endif %}
        icon: "mdi:numeric"

      # Latest Draw Lucky Stars (from Friday)
      - name: "Euro-Millions Friday Lucky Stars"
        unique_id: euromillions_friday_stars
        value_template: >
          {% set friday_block = value | regex_findall_index("Friday's Result[\\s\\S]*?Draw Details", 0) %}
          {% if friday_block %}
            {% set stars = friday_block | regex_findall('class=["\']?(?:resultBall lucky-star)[^"\']*["\'][^>]*>\\s*([0-9]{1,2})\\s*<') %}
            {% if stars | length >= 2 %}
              {{ stars[0:2] | join(', ') }}
            {% else %}
              "No results"
            {% endif %}
          {% else %}
            "No Friday result found"
          {% endif %}
        icon: "mdi:star"
        
# Template sensors for better formatting
template:
  - sensor:
      # Next Draw Day Calculator
      - name: "Euro-Millions Next Draw Day"
        unique_id: euromillions_next_draw_day
        state: >
          {% set today = now().weekday() %}
          {% if today in [0, 5, 6] %}
            Tuesday
          {% elif today in [1, 2, 3, 4] %}
            Friday
          {% else %}
            Tuesday
          {% endif %}
        icon: "mdi:calendar-star"

# Full summary with jackpot
      - name: "Euro-Millions Tuesday Summary"
        unique_id: euromillions_tuesday_summary
        state: >
          {% set numbers = states('sensor.euro_millions_tuesday_s_numbers') %}
          {% set stars = states('sensor.euro_millions_tuesday_s_lucky_stars') %}
          {% set jackpot = states('sensor.euro_millions_jackpot') %}
          {% set maker = states('sensor.euromillions_tuesday_millionaire_maker') %}
          {% if numbers not in ['unknown', 'unavailable', 'No results'] %}
            Tuesday | {{ numbers }} + {{ stars }} | {{ jackpot }} | {{ maker }}
          {% else %}
            "No data available"
          {% endif %}
        icon: "mdi:lottery-ticket"
        
# Full summary with jackpot
      - name: "Euro-Millions Friday Summary"
        unique_id: euromillions_friday_summary
        state: >
          {% set numbers = states('sensor.euro_millions_friday_s_numbers') %}
          {% set stars = states('sensor.euro_millions_friday_s_lucky_stars') %}
          {% set jackpot = states('sensor.euro_millions_jackpot') %}
          {% set maker = states('sensor.euromillions_friday_millionaire_maker') %}
          {% if numbers not in ['unknown', 'unavailable', 'No results'] %}
            Friday | {{ numbers }} + {{ stars }} | {{ jackpot }} | {{ maker }}
          {% else %}
            "No data available"
          {% endif %}
        icon: "mdi:lottery-ticket"
# Euro-Millions Lottery Millionaire Maker REST Sensors Configuration


rest:
  - resource: "https://www.euro-millions.com/uk-millionaire-maker"
    scan_interval: 3600  # Check every hour
    headers:
      User-Agent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"
    sensor:


# Last two Millionaire Maker Numbers
      - name: "Last Two Millionaire Maker Codes"
        unique_id: last_two_euromillions_millionaire_maker_codes
        value_template: >
          {% set codes = value | regex_findall('<div class="raffleBox"[^>]*>([A-Z]{4} [0-9]{5})</div>') %}
          {% if codes | length >= 2 %}
            Latest Draw: {{ codes[0] ~ ' | Previous Draw: ' ~ codes[1] }}
          {% elif codes | length == 1 %}
            {{ codes[0] }}
          {% else %}
            "No codes found"
          {% endif %}
        icon: "mdi:ticket"
        
# Latest Draw Millionaire Maker Numbers
      - name: "Latest Draw Millionaire Maker Code"
        unique_id: latest_euromillions_millionaire_maker_code
        value_template: >
          {% set codes = value | regex_findall('<div class="raffleBox"[^>]*>([A-Z]{4} [0-9]{5})</div>') %}
          {% if codes | length >= 2 %}
            Latest Draw: {{ codes[0] }}
          {% else %}
            "No codes found"
          {% endif %}
        icon: "mdi:ticket"
        
# Previous Millionaire Maker Numbers
      - name: "Previous Draw Millionaire Maker Code"
        unique_id: previous_euromillions_millionaire_maker_code
        value_template: >
          {% set codes = value | regex_findall('<div class="raffleBox"[^>]*>([A-Z]{4} [0-9]{5})</div>') %}
          {% if codes | length >= 2 %}
            Previous Draw: {{ codes[1] }}
          {% else %}
            "No codes found"
          {% endif %}
        icon: "mdi:ticket"

Tuesday Draw Sensors:

################################################################
#                                                              #
# Euro-Millions TUESDAY'S Lottery Number Checker Configuration #
#                                                              #
################################################################

# Input fields for your 3 sets of lottery numbers

# Toggle to enable/disable tuesday checking
input_boolean:
  euromillions_checking_tuesday_enabled:
    name: "Enable Euro-Millions Tuesday Checking"
    initial: true
    icon: mdi:magnify

# Template sensors for checking matches and calculating prizes
template:
  sensor:
# Line 1 Checker
    - name: "Euro-Millions Line 1 Tuesday Result"
      unique_id: euromillions_line1_tuesday_result
      state: >
        {% if states('input_boolean.euromillions_checking_tuesday_enabled') == 'on' %}
          {% set winning_numbers = states('sensor.euro_millions_tuesday_s_numbers').split(',') | map('trim') | list %}
          {% set winning_stars = states('sensor.euro_millions_tuesday_s_lucky_stars').split(',') | map('trim') | list %}
          {% set my_numbers = states('input_text.euromillions_line1_numbers').split(',') | map('trim') | list %}
          {% set my_stars = states('input_text.euromillions_line1_stars').split(',') | map('trim') | list %}
          {% set number_matches = my_numbers | select('in', winning_numbers) | list | length %}
          {% set star_matches = my_stars | select('in', winning_stars) | list | length %}
          {% if number_matches == 5 and star_matches == 2 %}
            YOU ARE A JACKPOT WINNER!
          {% elif number_matches == 5 and star_matches == 1 %}
            2nd Prize
          {% elif number_matches == 5 and star_matches == 0 %}
            3rd Prize
          {% elif number_matches == 4 and star_matches == 2 %}
            4th Prize
          {% elif number_matches == 4 and star_matches == 1 %}
            5th Prize
          {% elif number_matches == 3 and star_matches == 2 %}
            6th Prize
          {% elif number_matches == 4 and star_matches == 0 %}
            7th Prize
          {% elif number_matches == 2 and star_matches == 2 %}
            8th Prize
          {% elif number_matches == 3 and star_matches == 1 %}
            9th Prize
          {% elif number_matches == 3 and star_matches == 0 %}
            10th Prize
          {% elif number_matches == 1 and star_matches == 2 %}
            11th Prize
          {% elif number_matches == 2 and star_matches == 1 %}
            12th Prize
          {% elif number_matches == 2 and star_matches == 0 %}
            13th Prize
          {% else %}
            No Prize
          {% endif %}
        {% else %}
            Checking Disabled
        {% endif %}
      attributes:
        number_matches: >
          {% if states('input_boolean.euromillions_checking_tuesday_enabled') == 'on' %}
            {% set winning_numbers = states('sensor.euro_millions_tuesday_s_numbers').split(',') | map('trim') | list %}
            {% set my_numbers = states('input_text.euromillions_line1_numbers').split(',') | map('trim') | list %}
            {{ my_numbers | select('in', winning_numbers) | list | length }}
          {% else %}
            0
          {% endif %}
        star_matches: >
          {% if states('input_boolean.euromillions_checking_tuesday_enabled') == 'on' %}
            {% set winning_stars = states('sensor.euro_millions_tuesday_s_lucky_stars').split(',') | map('trim') | list %}
            {% set my_stars = states('input_text.euromillions_line1_stars').split(',') | map('trim') | list %}
            {{ my_stars | select('in', winning_stars) | list | length }}
          {% else %}
            0
          {% endif %}
        matched_numbers: >
          {% if states('input_boolean.euromillions_checking_tuesday_enabled') == 'on' %}
            {% set winning_numbers = states('sensor.euro_millions_tuesday_s_numbers').split(',') | map('trim') | list %}
            {% set my_numbers = states('input_text.euromillions_line1_numbers').split(',') | map('trim') | list %}
            {{ my_numbers | select('in', winning_numbers) | list | join(', ') }}
          {% else %}
            None
          {% endif %}
        matched_stars: >
          {% if states('input_boolean.euromillions_checking_tuesday_enabled') == 'on' %}
            {% set winning_stars = states('sensor.euro_millions_tuesday_s_lucky_stars').split(',') | map('trim') | list %}
            {% set my_stars = states('input_text.euromillions_line1_stars').split(',') | map('trim') | list %}
            {{ my_stars | select('in', winning_stars) | list | join(', ') }}
          {% else %}
            None
          {% endif %}
        prize_estimate: >
          {% set result = states('sensor.euro_millions_line1_tuesday_result') %}
          {% if result == 'YOU ARE A JACKPOT WINNER!' %}
            €50,000,000+
          {% elif result == '2nd Prize' %}
            €150,000 - €1,000,000
          {% elif result == '3rd Prize' %}
            €30,000 - €75,000
          {% elif result == '4th Prize' %}
            €2,000 - €5,000
          {% elif result == '5th Prize' %}
            €200 - €400
          {% elif result == '6th Prize' %}
            €80 - €150
          {% elif result == '7th Prize' %}
            €40 - €80
          {% elif result == '8th Prize' %}
            €20 - €40
          {% elif result == '9th Prize' %}
            €12 - €25
          {% elif result == '10th Prize' %}
            €10 - €20
          {% elif result == '11th Prize' %}
            €8 - €15
          {% elif result == '12th Prize' %}
            €6 - €12
          {% elif result == '13th Prize' %}
            €4 - €8
          {% else %}
            €0
          {% endif %}
        icon: mdi:ticket-confirmation
        
# Line 2 Checker
    - name: "Euro-Millions Line 2 Tuesday Result"
      unique_id: euromillions_line2_tuesday_result
      state: >
        {% if states('input_boolean.euromillions_checking_tuesday_enabled') == 'on' %}
          {% set winning_numbers = states('sensor.euro_millions_tuesday_s_numbers').split(',') | map('trim') | list %}
          {% set winning_stars = states('sensor.euro_millions_tuesday_s_lucky_stars').split(',') | map('trim') | list %}
          {% set my_numbers = states('input_text.euromillions_line2_numbers').split(',') | map('trim') | list %}
          {% set my_stars = states('input_text.euromillions_line2_stars').split(',') | map('trim') | list %}
          {% set number_matches = my_numbers | select('in', winning_numbers) | list | length %}
          {% set star_matches = my_stars | select('in', winning_stars) | list | length %}
          {% if number_matches == 5 and star_matches == 2 %}
            YOU ARE A JACKPOT WINNER!
          {% elif number_matches == 5 and star_matches == 1 %}
            2nd Prize
          {% elif number_matches == 5 and star_matches == 0 %}
            3rd Prize
          {% elif number_matches == 4 and star_matches == 2 %}
            4th Prize
          {% elif number_matches == 4 and star_matches == 1 %}
            5th Prize
          {% elif number_matches == 3 and star_matches == 2 %}
            6th Prize
          {% elif number_matches == 4 and star_matches == 0 %}
            7th Prize
          {% elif number_matches == 2 and star_matches == 2 %}
            8th Prize
          {% elif number_matches == 3 and star_matches == 1 %}
            9th Prize
          {% elif number_matches == 3 and star_matches == 0 %}
            10th Prize
          {% elif number_matches == 1 and star_matches == 2 %}
            11th Prize
          {% elif number_matches == 2 and star_matches == 1 %}
            12th Prize
          {% elif number_matches == 2 and star_matches == 0 %}
            13th Prize
          {% else %}
            No Prize
          {% endif %}
        {% else %}
            Checking Disabled
        {% endif %}
      attributes:
        number_matches: >
          {% if states('input_boolean.euromillions_checking_tuesday_enabled') == 'on' %}
            {% set winning_numbers = states('sensor.euro_millions_tuesday_s_numbers').split(',') | map('trim') | list %}
            {% set my_numbers = states('input_text.euromillions_line2_numbers').split(',') | map('trim') | list %}
            {{ my_numbers | select('in', winning_numbers) | list | length }}
          {% else %}
            0
          {% endif %}
        star_matches: >
          {% if states('input_boolean.euromillions_checking_tuesday_enabled') == 'on' %}
            {% set winning_stars = states('sensor.euro_millions_tuesday_s_lucky_stars').split(',') | map('trim') | list %}
            {% set my_stars = states('input_text.euromillions_line2_stars').split(',') | map('trim') | list %}
            {{ my_stars | select('in', winning_stars) | list | length }}
          {% else %}
            0
          {% endif %}
        matched_numbers: >
          {% if states('input_boolean.euromillions_checking_tuesday_enabled') == 'on' %}
            {% set winning_numbers = states('sensor.euro_millions_tuesday_s_numbers').split(',') | map('trim') | list %}
            {% set my_numbers = states('input_text.euromillions_line2_numbers').split(',') | map('trim') | list %}
            {{ my_numbers | select('in', winning_numbers) | list | join(', ') }}
          {% else %}
            None
          {% endif %}
        matched_stars: >
          {% if states('input_boolean.euromillions_checking_tuesday_enabled') == 'on' %}
            {% set winning_stars = states('sensor.euro_millions_tuesday_s_lucky_stars').split(',') | map('trim') | list %}
            {% set my_stars = states('input_text.euromillions_line2_stars').split(',') | map('trim') | list %}
            {{ my_stars | select('in', winning_stars) | list | join(', ') }}
          {% else %}
            None
          {% endif %}
        prize_estimate: >
          {% set result = states('sensor.euro_millions_line2_tuesday_result') %}
          {% if result == 'YOU ARE A JACKPOT WINNER!' %}
            €50,000,000+
          {% elif result == '2nd Prize' %}
            €150,000 - €1,000,000
          {% elif result == '3rd Prize' %}
            €30,000 - €75,000
          {% elif result == '4th Prize' %}
            €2,000 - €5,000
          {% elif result == '5th Prize' %}
            €200 - €400
          {% elif result == '6th Prize' %}
            €80 - €150
          {% elif result == '7th Prize' %}
            €40 - €80
          {% elif result == '8th Prize' %}
            €20 - €40
          {% elif result == '9th Prize' %}
            €12 - €25
          {% elif result == '10th Prize' %}
            €10 - €20
          {% elif result == '11th Prize' %}
            €8 - €15
          {% elif result == '12th Prize' %}
            €6 - €12
          {% elif result == '13th Prize' %}
            €4 - €8
          {% else %}
            €0
          {% endif %}
        icon: mdi:ticket-confirmation
        
# Line 3 Checker
    - name: "Euro-Millions Line 3 Tuesday Result"
      unique_id: euromillions_line3_tuesday_result
      state: >
        {% if states('input_boolean.euromillions_checking_tuesday_enabled') == 'on' %}
          {% set winning_numbers = states('sensor.euro_millions_tuesday_s_numbers').split(',') | map('trim') | list %}
          {% set winning_stars = states('sensor.euro_millions_tuesday_s_lucky_stars').split(',') | map('trim') | list %}
          {% set my_numbers = states('input_text.euromillions_line3_numbers').split(',') | map('trim') | list %}
          {% set my_stars = states('input_text.euromillions_line3_stars').split(',') | map('trim') | list %}
          {% set number_matches = my_numbers | select('in', winning_numbers) | list | length %}
          {% set star_matches = my_stars | select('in', winning_stars) | list | length %}
          {% if number_matches == 5 and star_matches == 2 %}
            YOU ARE A JACKPOT WINNER!
          {% elif number_matches == 5 and star_matches == 1 %}
            2nd Prize
          {% elif number_matches == 5 and star_matches == 0 %}
            3rd Prize
          {% elif number_matches == 4 and star_matches == 2 %}
            4th Prize
          {% elif number_matches == 4 and star_matches == 1 %}
            5th Prize
          {% elif number_matches == 3 and star_matches == 2 %}
            6th Prize
          {% elif number_matches == 4 and star_matches == 0 %}
            7th Prize
          {% elif number_matches == 2 and star_matches == 2 %}
            8th Prize
          {% elif number_matches == 3 and star_matches == 1 %}
            9th Prize
          {% elif number_matches == 3 and star_matches == 0 %}
            10th Prize
          {% elif number_matches == 1 and star_matches == 2 %}
            11th Prize
          {% elif number_matches == 2 and star_matches == 1 %}
            12th Prize
          {% elif number_matches == 2 and star_matches == 0 %}
            13th Prize
          {% else %}
            No Prize
          {% endif %}
        {% else %}
            Checking Disabled
        {% endif %}
      attributes:
        number_matches: >
          {% if states('input_boolean.euromillions_checking_tuesday_enabled') == 'on' %}
            {% set winning_numbers = states('sensor.euro_millions_tuesday_s_numbers').split(',') | map('trim') | list %}
            {% set my_numbers = states('input_text.euromillions_line3_numbers').split(',') | map('trim') | list %}
            {{ my_numbers | select('in', winning_numbers) | list | length }}
          {% else %}
            0
          {% endif %}
        star_matches: >
          {% if states('input_boolean.euromillions_checking_tuesday_enabled') == 'on' %}
            {% set winning_stars = states('sensor.euro_millions_tuesday_s_lucky_stars').split(',') | map('trim') | list %}
            {% set my_stars = states('input_text.euromillions_line3_stars').split(',') | map('trim') | list %}
            {{ my_stars | select('in', winning_stars) | list | length }}
          {% else %}
            0
          {% endif %}
        matched_numbers: >
          {% if states('input_boolean.euromillions_checking_tuesday_enabled') == 'on' %}
            {% set winning_numbers = states('sensor.euro_millions_tuesday_s_numbers').split(',') | map('trim') | list %}
            {% set my_numbers = states('input_text.euromillions_line3_numbers').split(',') | map('trim') | list %}
            {{ my_numbers | select('in', winning_numbers) | list | join(', ') }}
          {% else %}
            None
          {% endif %}
        matched_stars: >
          {% if states('input_boolean.euromillions_checking_tuesday_enabled') == 'on' %}
            {% set winning_stars = states('sensor.euro_millions_tuesday_s_lucky_stars').split(',') | map('trim') | list %}
            {% set my_stars = states('input_text.euromillions_line3_stars').split(',') | map('trim') | list %}
            {{ my_stars | select('in', winning_stars) | list | join(', ') }}
          {% else %}
            None
          {% endif %}
        prize_estimate: >
          {% set result = states('sensor.euro_millions_line3_tuesday_result') %}
          {% if result == 'YOU ARE A JACKPOT WINNER!' %}
            €50,000,000+
          {% elif result == '2nd Prize' %}
            €150,000 - €1,000,000
          {% elif result == '3rd Prize' %}
            €30,000 - €75,000
          {% elif result == '4th Prize' %}
            €2,000 - €5,000
          {% elif result == '5th Prize' %}
            €200 - €400
          {% elif result == '6th Prize' %}
            €80 - €150
          {% elif result == '7th Prize' %}
            €40 - €80
          {% elif result == '8th Prize' %}
            €20 - €40
          {% elif result == '9th Prize' %}
            €12 - €25
          {% elif result == '10th Prize' %}
            €10 - €20
          {% elif result == '11th Prize' %}
            €8 - €15
          {% elif result == '12th Prize' %}
            €6 - €12
          {% elif result == '13th Prize' %}
            €4 - €8
          {% else %}
            €0
          {% endif %}
        icon: mdi:ticket-confirmation
        
# Summary sensor
    - name: "Euro-Millions Tuesday Winnings"
      unique_id: euromillions_tuesday_winnings
      state: >
          {% set line1 = states('sensor.euromillions_line1_tuesday_result') %}
          {% set line2 = states('sensor.euromillions_line2_tuesday_result') %}
          {% set line3 = states('sensor.euromillions_line3_tuesday_result') %}
          {% set winners = [] %}
          {% if line1 not in ['No Prize', 'Checking Disabled'] %}
            {% set winners = winners + ['Line 1: ' + line1] %}
          {% endif %}
          {% if line2 not in ['No Prize', 'Checking Disabled'] %}
            {% set winners = winners + ['Line 2: ' + line2] %}
          {% endif %}
          {% if line3 not in ['No Prize', 'Checking Disabled'] %}
            {% set winners = winners + ['Line 3: ' + line3] %}
          {% endif %}
          {% if winners | length > 0 %}
            {{ winners | join(' | ') }}
          {% else %}
            No Prizes Won
          {% endif %}
      icon: mdi:trophy

Friday Draw Sensors:

###############################################################
#                                                             #
# Euro-Millions FRIDAY'S Lottery Number Checker Configuration #
#                                                             #
###############################################################

# Input fields for your 3 sets of lottery numbers
input_text:
  # Line 1 Numbers
  euromillions_line1_numbers:
    name: "Line 1 - Main Numbers"
    initial: "9,9,9,9,9"
    pattern: '^(\d{1,2},){4}\d{1,2}$'
    max: 14
    
  euromillions_line1_stars:
    name: "Line 1 - Lucky Stars"
    initial: "9,9"
    pattern: '^\d{1,2},\d{1,2}$'
    max: 5
    
  # Line 2 Numbers
  euromillions_line2_numbers:
    name: "Line 2 - Main Numbers"
    initial: "9,9,9,9,9"
    pattern: '^(\d{1,2},){4}\d{1,2}$'
    max: 14
    
  euromillions_line2_stars:
    name: "Line 2 - Lucky Stars"
    initial: "9,9"
    pattern: '^\d{1,2},\d{1,2}$'
    max: 5
    
  # Line 3 Numbers
  euromillions_line3_numbers:
    name: "Line 3 - Main Numbers"
    initial: "9,9,9,9,9"
    pattern: '^(\d{1,2},){4}\d{1,2}$'
    max: 14
    
  euromillions_line3_stars:
    name: "Line 3 - Lucky Stars"
    initial: "9,9"
    pattern: '^\d{1,2},\d{1,2}$'
    max: 5

# Toggle to enable/disable friday checking
input_boolean:
  euromillions_checking_friday_enabled:
    name: "Enable Euro-Millions Friday Checking"
    initial: true
    icon: mdi:magnify

# Template sensors for checking matches and calculating prizes
template:
  sensor:
# Line 1 Checker
    - name: "Euro-Millions Line 1 Friday Result"
      unique_id: euromillions_line1_friday_result
      state: >
        {% if states('input_boolean.euromillions_checking_friday_enabled') == 'on' %}
          {% set winning_numbers = states('sensor.euro_millions_friday_s_numbers').split(',') | map('trim') | list %}
          {% set winning_stars = states('sensor.euro_millions_friday_s_lucky_stars').split(',') | map('trim') | list %}
          {% set my_numbers = states('input_text.euromillions_line1_numbers').split(',') | map('trim') | list %}
          {% set my_stars = states('input_text.euromillions_line1_stars').split(',') | map('trim') | list %}
          {% set number_matches = my_numbers | select('in', winning_numbers) | list | length %}
          {% set star_matches = my_stars | select('in', winning_stars) | list | length %}
          {% if number_matches == 5 and star_matches == 2 %}
            YOU ARE A JACKPOT WINNER!
          {% elif number_matches == 5 and star_matches == 1 %}
            2nd Prize
          {% elif number_matches == 5 and star_matches == 0 %}
            3rd Prize
          {% elif number_matches == 4 and star_matches == 2 %}
            4th Prize
          {% elif number_matches == 4 and star_matches == 1 %}
            5th Prize
          {% elif number_matches == 3 and star_matches == 2 %}
            6th Prize
          {% elif number_matches == 4 and star_matches == 0 %}
            7th Prize
          {% elif number_matches == 2 and star_matches == 2 %}
            8th Prize
          {% elif number_matches == 3 and star_matches == 1 %}
            9th Prize
          {% elif number_matches == 3 and star_matches == 0 %}
            10th Prize
          {% elif number_matches == 1 and star_matches == 2 %}
            11th Prize
          {% elif number_matches == 2 and star_matches == 1 %}
            12th Prize
          {% elif number_matches == 2 and star_matches == 0 %}
            13th Prize
          {% else %}
            No Prize
          {% endif %}
        {% else %}
            Checking Disabled
        {% endif %}
      attributes:
        number_matches: >
          {% if states('input_boolean.euromillions_checking_friday_enabled') == 'on' %}
            {% set winning_numbers = states('sensor.euro_millions_friday_s_numbers').split(',') | map('trim') | list %}
            {% set my_numbers = states('input_text.euromillions_line1_numbers').split(',') | map('trim') | list %}
            {{ my_numbers | select('in', winning_numbers) | list | length }}
          {% else %}
            0
          {% endif %}
        star_matches: >
          {% if states('input_boolean.euromillions_checking_friday_enabled') == 'on' %}
            {% set winning_stars = states('sensor.euro_millions_friday_s_lucky_stars').split(',') | map('trim') | list %}
            {% set my_stars = states('input_text.euromillions_line1_stars').split(',') | map('trim') | list %}
            {{ my_stars | select('in', winning_stars) | list | length }}
          {% else %}
            0
          {% endif %}
        matched_numbers: >
          {% if states('input_boolean.euromillions_checking_friday_enabled') == 'on' %}
            {% set winning_numbers = states('sensor.euro_millions_friday_s_numbers').split(',') | map('trim') | list %}
            {% set my_numbers = states('input_text.euromillions_line1_numbers').split(',') | map('trim') | list %}
            {{ my_numbers | select('in', winning_numbers) | list | join(', ') }}
          {% else %}
            None
          {% endif %}
        matched_stars: >
          {% if states('input_boolean.euromillions_checking_friday_enabled') == 'on' %}
            {% set winning_stars = states('sensor.euro_millions_friday_s_lucky_stars').split(',') | map('trim') | list %}
            {% set my_stars = states('input_text.euromillions_line1_stars').split(',') | map('trim') | list %}
            {{ my_stars | select('in', winning_stars) | list | join(', ') }}
          {% else %}
            None
          {% endif %}
        prize_estimate: >
          {% set result = states('sensor.euro_millions_line1_friday_result') %}
          {% if result == 'YOU ARE A JACKPOT WINNER!' %}
            €50,000,000+
          {% elif result == '2nd Prize' %}
            €150,000 - €1,000,000
          {% elif result == '3rd Prize' %}
            €30,000 - €75,000
          {% elif result == '4th Prize' %}
            €2,000 - €5,000
          {% elif result == '5th Prize' %}
            €200 - €400
          {% elif result == '6th Prize' %}
            €80 - €150
          {% elif result == '7th Prize' %}
            €40 - €80
          {% elif result == '8th Prize' %}
            €20 - €40
          {% elif result == '9th Prize' %}
            €12 - €25
          {% elif result == '10th Prize' %}
            €10 - €20
          {% elif result == '11th Prize' %}
            €8 - €15
          {% elif result == '12th Prize' %}
            €6 - €12
          {% elif result == '13th Prize' %}
            €4 - €8
          {% else %}
            €0
          {% endif %}
        icon: mdi:ticket-confirmation
        
# Line 2 Checker
    - name: "Euro-Millions Line 2 Friday Result"
      unique_id: euromillions_line2_friday_result
      state: >
        {% if states('input_boolean.euromillions_checking_friday_enabled') == 'on' %}
          {% set winning_numbers = states('sensor.euro_millions_friday_s_numbers').split(',') | map('trim') | list %}
          {% set winning_stars = states('sensor.euro_millions_friday_s_lucky_stars').split(',') | map('trim') | list %}
          {% set my_numbers = states('input_text.euromillions_line2_numbers').split(',') | map('trim') | list %}
          {% set my_stars = states('input_text.euromillions_line2_stars').split(',') | map('trim') | list %}
          {% set number_matches = my_numbers | select('in', winning_numbers) | list | length %}
          {% set star_matches = my_stars | select('in', winning_stars) | list | length %}
          {% if number_matches == 5 and star_matches == 2 %}
            YOU ARE A JACKPOT WINNER!
          {% elif number_matches == 5 and star_matches == 1 %}
            2nd Prize
          {% elif number_matches == 5 and star_matches == 0 %}
            3rd Prize
          {% elif number_matches == 4 and star_matches == 2 %}
            4th Prize
          {% elif number_matches == 4 and star_matches == 1 %}
            5th Prize
          {% elif number_matches == 3 and star_matches == 2 %}
            6th Prize
          {% elif number_matches == 4 and star_matches == 0 %}
            7th Prize
          {% elif number_matches == 2 and star_matches == 2 %}
            8th Prize
          {% elif number_matches == 3 and star_matches == 1 %}
            9th Prize
          {% elif number_matches == 3 and star_matches == 0 %}
            10th Prize
          {% elif number_matches == 1 and star_matches == 2 %}
            11th Prize
          {% elif number_matches == 2 and star_matches == 1 %}
            12th Prize
          {% elif number_matches == 2 and star_matches == 0 %}
            13th Prize
          {% else %}
            No Prize
          {% endif %}
        {% else %}
            Checking Disabled
        {% endif %}
      attributes:
        number_matches: >
          {% if states('input_boolean.euromillions_checking_friday_enabled') == 'on' %}
            {% set winning_numbers = states('sensor.euro_millions_friday_s_numbers').split(',') | map('trim') | list %}
            {% set my_numbers = states('input_text.euromillions_line2_numbers').split(',') | map('trim') | list %}
            {{ my_numbers | select('in', winning_numbers) | list | length }}
          {% else %}
            0
          {% endif %}
        star_matches: >
          {% if states('input_boolean.euromillions_checking_friday_enabled') == 'on' %}
            {% set winning_stars = states('sensor.euro_millions_friday_s_lucky_stars').split(',') | map('trim') | list %}
            {% set my_stars = states('input_text.euromillions_line2_stars').split(',') | map('trim') | list %}
            {{ my_stars | select('in', winning_stars) | list | length }}
          {% else %}
            0
          {% endif %}
        matched_numbers: >
          {% if states('input_boolean.euromillions_checking_friday_enabled') == 'on' %}
            {% set winning_numbers = states('sensor.euro_millions_friday_s_numbers').split(',') | map('trim') | list %}
            {% set my_numbers = states('input_text.euromillions_line2_numbers').split(',') | map('trim') | list %}
            {{ my_numbers | select('in', winning_numbers) | list | join(', ') }}
          {% else %}
            None
          {% endif %}
        matched_stars: >
          {% if states('input_boolean.euromillions_checking_friday_enabled') == 'on' %}
            {% set winning_stars = states('sensor.euro_millions_friday_s_lucky_stars').split(',') | map('trim') | list %}
            {% set my_stars = states('input_text.euromillions_line2_stars').split(',') | map('trim') | list %}
            {{ my_stars | select('in', winning_stars) | list | join(', ') }}
          {% else %}
            None
          {% endif %}
        prize_estimate: >
          {% set result = states('sensor.euro_millions_line2_friday_result') %}
          {% if result == 'YOU ARE A JACKPOT WINNER!' %}
            €50,000,000+
          {% elif result == '2nd Prize' %}
            €150,000 - €1,000,000
          {% elif result == '3rd Prize' %}
            €30,000 - €75,000
          {% elif result == '4th Prize' %}
            €2,000 - €5,000
          {% elif result == '5th Prize' %}
            €200 - €400
          {% elif result == '6th Prize' %}
            €80 - €150
          {% elif result == '7th Prize' %}
            €40 - €80
          {% elif result == '8th Prize' %}
            €20 - €40
          {% elif result == '9th Prize' %}
            €12 - €25
          {% elif result == '10th Prize' %}
            €10 - €20
          {% elif result == '11th Prize' %}
            €8 - €15
          {% elif result == '12th Prize' %}
            €6 - €12
          {% elif result == '13th Prize' %}
            €4 - €8
          {% else %}
            €0
          {% endif %}
        icon: mdi:ticket-confirmation
        
# Line 3 Checker
    - name: "Euro-Millions Line 3 Friday Result"
      unique_id: euromillions_line3_friday_result
      state: >
        {% if states('input_boolean.euromillions_checking_friday_enabled') == 'on' %}
          {% set winning_numbers = states('sensor.euro_millions_friday_s_numbers').split(',') | map('trim') | list %}
          {% set winning_stars = states('sensor.euro_millions_friday_s_lucky_stars').split(',') | map('trim') | list %}
          {% set my_numbers = states('input_text.euromillions_line3_numbers').split(',') | map('trim') | list %}
          {% set my_stars = states('input_text.euromillions_line3_stars').split(',') | map('trim') | list %}
          {% set number_matches = my_numbers | select('in', winning_numbers) | list | length %}
          {% set star_matches = my_stars | select('in', winning_stars) | list | length %}
          {% if number_matches == 5 and star_matches == 2 %}
            YOU ARE A JACKPOT WINNER!
          {% elif number_matches == 5 and star_matches == 1 %}
            2nd Prize
          {% elif number_matches == 5 and star_matches == 0 %}
            3rd Prize
          {% elif number_matches == 4 and star_matches == 2 %}
            4th Prize
          {% elif number_matches == 4 and star_matches == 1 %}
            5th Prize
          {% elif number_matches == 3 and star_matches == 2 %}
            6th Prize
          {% elif number_matches == 4 and star_matches == 0 %}
            7th Prize
          {% elif number_matches == 2 and star_matches == 2 %}
            8th Prize
          {% elif number_matches == 3 and star_matches == 1 %}
            9th Prize
          {% elif number_matches == 3 and star_matches == 0 %}
            10th Prize
          {% elif number_matches == 1 and star_matches == 2 %}
            11th Prize
          {% elif number_matches == 2 and star_matches == 1 %}
            12th Prize
          {% elif number_matches == 2 and star_matches == 0 %}
            13th Prize
          {% else %}
            No Prize
          {% endif %}
        {% else %}
            Checking Disabled
        {% endif %}
      attributes:
        number_matches: >
          {% if states('input_boolean.euromillions_checking_friday_enabled') == 'on' %}
            {% set winning_numbers = states('sensor.euro_millions_friday_s_numbers').split(',') | map('trim') | list %}
            {% set my_numbers = states('input_text.euromillions_line3_numbers').split(',') | map('trim') | list %}
            {{ my_numbers | select('in', winning_numbers) | list | length }}
          {% else %}
            0
          {% endif %}
        star_matches: >
          {% if states('input_boolean.euromillions_checking_friday_enabled') == 'on' %}
            {% set winning_stars = states('sensor.euro_millions_friday_s_lucky_stars').split(',') | map('trim') | list %}
            {% set my_stars = states('input_text.euromillions_line3_stars').split(',') | map('trim') | list %}
            {{ my_stars | select('in', winning_stars) | list | length }}
          {% else %}
            0
          {% endif %}
        matched_numbers: >
          {% if states('input_boolean.euromillions_checking_friday_enabled') == 'on' %}
            {% set winning_numbers = states('sensor.euro_millions_friday_s_numbers').split(',') | map('trim') | list %}
            {% set my_numbers = states('input_text.euromillions_line3_numbers').split(',') | map('trim') | list %}
            {{ my_numbers | select('in', winning_numbers) | list | join(', ') }}
          {% else %}
            None
          {% endif %}
        matched_stars: >
          {% if states('input_boolean.euromillions_checking_friday_enabled') == 'on' %}
            {% set winning_stars = states('sensor.euro_millions_friday_s_lucky_stars').split(',') | map('trim') | list %}
            {% set my_stars = states('input_text.euromillions_line3_stars').split(',') | map('trim') | list %}
            {{ my_stars | select('in', winning_stars) | list | join(', ') }}
          {% else %}
            None
          {% endif %}
        prize_estimate: >
          {% set result = states('sensor.euro_millions_line3_friday_result') %}
          {% if result == 'YOU ARE A JACKPOT WINNER!' %}
            €50,000,000+
          {% elif result == '2nd Prize' %}
            €150,000 - €1,000,000
          {% elif result == '3rd Prize' %}
            €30,000 - €75,000
          {% elif result == '4th Prize' %}
            €2,000 - €5,000
          {% elif result == '5th Prize' %}
            €200 - €400
          {% elif result == '6th Prize' %}
            €80 - €150
          {% elif result == '7th Prize' %}
            €40 - €80
          {% elif result == '8th Prize' %}
            €20 - €40
          {% elif result == '9th Prize' %}
            €12 - €25
          {% elif result == '10th Prize' %}
            €10 - €20
          {% elif result == '11th Prize' %}
            €8 - €15
          {% elif result == '12th Prize' %}
            €6 - €12
          {% elif result == '13th Prize' %}
            €4 - €8
          {% else %}
            €0
          {% endif %}
        icon: mdi:ticket-confirmation
        
# Summary sensor
    - name: "Euro-Millions Friday Winnings"
      unique_id: euromillions_friday_winnings
      state: >
        {% set line1 = states('sensor.euro_millions_line_1_friday_result') | trim %}
        {% set line2 = states('sensor.euro_millions_line_2_friday_result') | trim %}
        {% set line3 = states('sensor.euro_millions_line_3_friday_result') | trim %}
        {% set winners = [] %}
        {% if line1 not in ['No Prize', 'Checking Disabled', 'unavailable', 'unknown'] %}
          {% set winners = winners + ['Line 1: ' + line1] %}
        {% endif %}
        {% if line2 not in ['No Prize', 'Checking Disabled', 'unavailable', 'unknown'] %}
          {% set winners = winners + ['Line 2: ' + line2] %}
        {% endif %}
        {% if line3 not in ['No Prize', 'Checking Disabled', 'unavailable', 'unknown'] %}
          {% set winners = winners + ['Line 3: ' + line3] %}
        {% endif %}
        {% if winners | length > 0 %}
          {{ winners | join(' | ') }}
        {% else %}
          No Prizes Won
        {% endif %}
      icon: mdi:trophy

The Mega Millions (USA Lottery) is just the weekly draw results but you could integrate the results checking if you play the Mega Millions. THe Dashboard View yaml was already included in the post above, here is the Rest Sensor for the Mega Millions Lottery to work with the Dashboard view:

# /config/rest.yaml
rest:
  - scan_interval: 900  # 15 minutes - good interval
    timeout: 30  # Add timeout for reliability
    resource: https://www.megamillions.com/cmspages/utilservice.asmx/GetLatestDrawData
    headers:
      User-Agent: "Home Assistant"
    sensor:

      # Last draw winning numbers
      - name: "Mega Millions Last Numbers"
        unique_id: mega_millions_last_numbers
        icon: mdi:numeric
        value_template: >
          {% if value_json is defined and value_json['string'] is defined %}
            {% set data = value_json['string']['#text'] | from_json %}
            {% set drawing = data['Drawing'] %}
            {% set main_numbers = [drawing['N1'], drawing['N2'], drawing['N3'], drawing['N4'], drawing['N5']] %}
           {{ main_numbers | join(', ') ~ ' + ' ~ drawing['MBall'] }}
          {% else %}
            {{ states('sensor.mega_millions_last_numbers') }}
          {% endif %}




      # Prize amount
      - name: "Mega Millions Jackpot"
        unique_id: mega_millions_jackpot_amount
        icon: mdi:currency-usd
        unit_of_measurement: "USD"
        availability: "{{ value_json is defined and value_json['string'] is defined }}"
        value_template: >
          {% if value_json is defined and value_json['string'] is defined %}
            {% set data = value_json['string']['#text'] | from_json %}
            {{ data['Jackpot']['NextPrizePool'] | replace('$', '') | replace(',', '') | int(0) }}
          {% else %}
            {{ states('sensor.mega_millions_jackpot') }}
          {% endif %}

      # Cash value
      - name: "Mega Millions Cash Value"
        unique_id: mega_millions_cash_value
        icon: mdi:cash-multiple
        unit_of_measurement: "USD"
        availability: "{{ value_json is defined and value_json['string'] is defined }}"
        value_template: >
          {% if value_json is defined and value_json['string'] is defined %}
            {% set data = value_json['string']['#text'] | from_json %}
            {{ data['Jackpot']['NextCashValue'] | replace('$', '') | replace(',', '') | int(0) }}
          {% else %}
            {{ states('sensor.mega_millions_cash_value') }}
          {% endif %}

      # Winners from last draw
      - name: "Mega Millions Last Winners"
        unique_id: mega_millions_last_winners
        icon: mdi:account-multiple
        availability: "{{ value_json is defined and value_json['string'] is defined }}"
        value_template: >
          {% if value_json is defined and value_json['string'] is defined %}
            {% set data = value_json['string']['#text'] | from_json %}
            {{ data['Jackpot']['Winners'] | int(0) }}
          {% else %}
            {{ states('sensor.mega_millions_last_winners') }}
          {% endif %}




template:
  - sensor:
# Better formatting This would display as: 13-24-41-42-70 + MB: 18
      - name: "Mega Millions Numbers Formatted"
        unique_id: mega_millions_numbers_formatted
        icon: mdi:lottery
        state: >
          {% set nums = states('sensor.mega_millions_last_numbers').split() %}
          {% if nums | length == 6 %}
            {{ nums[0:5] | join(', ') }} + MB: {{ nums[5] }}
          {% else %}
            {{ states('sensor.mega_millions_last_numbers') }}
          {% endif %}

      # Numbers with separated attributes
      - name: "Mega Millions Numbers Info"
        unique_id: mega_millions_numbers_info
        icon: mdi:numeric
        availability: "{{ states('sensor.mega_millions_last_numbers') != 'unknown' }}"
        state: "{{ states('sensor.mega_millions_last_numbers') }}"
        attributes:
          main_numbers: >
            {% if states('sensor.mega_millions_last_numbers') != 'unknown' %}
              {% set numbers = states('sensor.mega_millions_last_numbers').split() %}
              {{ numbers[0:5] | join(', ') if numbers | length >= 5 else 'Unknown' }}
            {% endif %}
          mega_ball: >
            {% if states('sensor.mega_millions_last_numbers') != 'unknown' %}
              {% set numbers = states('sensor.mega_millions_last_numbers').split() %}
              {{ numbers[5] if numbers | length > 5 else 'Unknown' }}
            {% endif %}

      # Jackpot with formatted attributes
      - name: "Mega Millions Jackpot Info"
        unique_id: mega_millions_jackpot_info
        icon: mdi:currency-usd
        unit_of_measurement: "USD"
        availability: "{{ states('sensor.mega_millions_jackpot') | is_number }}"
        state: "{{ states('sensor.mega_millions_jackpot') }}"
        attributes:
          formatted_amount: >
            {% if states('sensor.mega_millions_jackpot') | is_number %}
              ${{ '{:,}'.format(states('sensor.mega_millions_jackpot') | int) }}
            {% endif %}
          amount_millions: >
            {% if states('sensor.mega_millions_jackpot') | is_number %}
              {{ (states('sensor.mega_millions_jackpot') | int / 1000000) | round(0) | int }} Million
            {% endif %}

      # Cash value with formatted attributes
      - name: "Mega Millions Cash Info"
        unique_id: mega_millions_cash_info
        icon: mdi:cash-multiple
        unit_of_measurement: "USD"
        availability: "{{ states('sensor.mega_millions_cash_value') | is_number }}"
        state: "{{ states('sensor.mega_millions_cash_value') }}"
        attributes:
          formatted_amount: >
            {% if states('sensor.mega_millions_cash_value') | is_number %}
              ${{ '{:,}'.format(states('sensor.mega_millions_cash_value') | int) }}
            {% endif %}
          amount_millions: >
            {% if states('sensor.mega_millions_cash_value') | is_number %}
              {{ (states('sensor.mega_millions_cash_value') | int / 1000000) | round(1) }} Million
            {% endif %}
          cash_vs_annuity_ratio: >
            {% if states('sensor.mega_millions_jackpot') | is_number and states('sensor.mega_millions_cash_value') | is_number %}
              {% set jackpot = states('sensor.mega_millions_jackpot') | int %}
              {% set cash = states('sensor.mega_millions_cash_value') | int %}
              {{ ((cash / jackpot) * 100) | round(1) if jackpot > 0 else 0 }}% of annuity
            {% endif %}

      # Winners with status attribute
      - name: "Mega Millions Winners Info"
        unique_id: mega_millions_winners_info
        icon: mdi:account-multiple
        availability: "{{ states('sensor.mega_millions_last_winners') | is_number }}"
        state: "{{ states('sensor.mega_millions_last_winners') }}"
        attributes:
          winner_status: >
            {% set winners = states('sensor.mega_millions_last_winners') | int(0) %}
            {% if winners == 0 %}
              No jackpot winners - rollover
            {% elif winners == 1 %}
              1 jackpot winner
            {% else %}
              {{ winners }} jackpot winners
            {% endif %}

      # Jackpot growth tracking
      - name: "Mega Millions Jackpot Growth"
        unique_id: mega_millions_jackpot_growth
        icon: mdi:trending-up
        availability: "{{ states('sensor.mega_millions_jackpot') | is_number }}"
        state: >
          {% set current = states('sensor.mega_millions_jackpot') | int(0) %}
          {% set previous = state_attr('sensor.mega_millions_jackpot_growth', 'previous_amount') | int(current) %}
          {% if current != previous %}
            {% if current > previous %}
              Increased
            {% elif current < previous %}
              Decreased  
            {% else %}
              Unchanged
            {% endif %}
          {% else %}
            Unchanged
          {% endif %}
        attributes:
          current_amount: "{{ states('sensor.mega_millions_jackpot') | int(0) }}"
          previous_amount: "{{ states('sensor.mega_millions_jackpot') | int(0) }}"
          change_amount: >
            {% set current = states('sensor.mega_millions_jackpot') | int(0) %}
            {% set previous = state_attr('sensor.mega_millions_jackpot_growth', 'previous_amount') | int(current) %}
            {{ current - previous }}
          formatted_change: >
            {% set current = states('sensor.mega_millions_jackpot') | int(0) %}
            {% set previous = state_attr('sensor.mega_millions_jackpot_growth', 'previous_amount') | int(current) %}
            {% set change = current - previous %}
            {% if change > 0 %}
              +${{ '{:,}'.format(change) }}
            {% elif change < 0 %}
              -${{ '{:,}'.format(change * -1) }}
            {% else %}
              No change
            {% endif %}

      # Lottery summary
      - name: "Mega Millions Summary"
        unique_id: mega_millions_summary
        icon: mdi:information
        availability: >
          {{ states('sensor.mega_millions_jackpot') | is_number and
             states('sensor.mega_millions_next_draw_date') != 'unknown' }}
        state: >
          {% set jackpot = states('sensor.mega_millions_jackpot') | int(0) %}
          {% set millions = (jackpot / 1000000) | round(0) %}
          ${{ millions }}M Jackpot
        attributes:
          next_draw: "{{ state_attr('sensor.mega_millions_next_draw_info', 'formatted_date') }}"
          jackpot_amount: "{{ state_attr('sensor.mega_millions_jackpot_info', 'formatted_amount') }}"
          cash_value: "{{ state_attr('sensor.mega_millions_cash_info', 'formatted_amount') }}"
          last_numbers: "{{ states('sensor.mega_millions_last_numbers') }}"
          last_winners: "{{ state_attr('sensor.mega_millions_winners_info', 'winner_status') }}"
          odds: "1 in 302,575,350"
          ticket_price: "$2"

The End Result looks like this: