Skip to content

FaserF/ha-ctgpdx

Repository files navigation

CTGP Deluxe Home Assistant Sensor 🏎️

The ctgpdx sensor provides the latest CTGP Deluxe version available, allowing you to get notified when updates are released.

Features ✨

  • Latest Version: Tracks the current version of CTGP Deluxe.
  • Download Size: Shows the size of the download package.
  • Unpacked Size: Shows the required space on the SD card.
  • Release Date: Displays when the latest version was released.
  • Update Notifications: Use automations to get alerted on new releases.

Installation 🛠️

1. Using HACS (Recommended)

This integration can be added to HACS as a Custom Repository.

  1. Open HACS.
  2. Click on the 3 dots in the top right corner -> Custom repositories.
  3. Add https://github.com/FaserF/ha-ctgpdx and select category Integration.
  4. Click Download.

Open your Home Assistant instance and open a repository inside the Home Assistant Community Store.

2. Manual Installation

  1. Download the latest Release.
  2. Extract the ZIP file.
  3. Copy the ctgpdx folder to <config>/custom_components/.

Configuration ⚙️

  1. Go to Settings -> Devices & Services.
  2. Click Add Integration.
  3. Search for CTGP Deluxe.

Open your Home Assistant instance and start setting up a new integration.

Configuration Variables

None needed.

Sensors 📊

After installation, the suivant sensors will be available:

Sensor Name Icon Description
sensor.ctgp_dx_latest_version CTGP-DX Latest Version mdi:nintendo-switch The current version number (includes Release Date as attribute)
sensor.ctgp_dx_download_size CTGP-DX Download Size mdi:download-network Size of the ZIP file (Disabled by default)
sensor.ctgp_dx_unpacked_size CTGP-DX Unpacked Size mdi:folder-zip Space needed on SD card (Disabled by default)

Automations 🤖

Below are several examples of how you can use this integration in your automations.

1. Basic Notification on New Version (Mobile App)

This automation sends a notification to your phone whenever a new version is detected.

- id: 'ctgpdx_new_version_notification'
  alias: 'CTGP-DX: New Version Available'
  trigger:
    - platform: state
      entity_id: sensor.ctgp_dx_latest_version
  condition:
    - condition: template
      value_template: "{{ trigger.to_state.state not in ['unknown', 'unavailable'] }}"
    - condition: template
      value_template: "{{ trigger.from_state.state not in ['unknown', 'unavailable'] }}"
    - condition: template
      value_template: "{{ trigger.to_state.state != trigger.from_state.state }}"
  action:
    - service: notify.mobile_app_your_device
      data:
        title: '🎉 New CTGP-DX Version Available!'
        message: >
          New CTGP-DX Version **{{ states('sensor.ctgp_dx_latest_version') }}** released at {{ state_attr('sensor.ctgp_dx_latest_version', 'release_date') }} is now available!
          Download: {{ state_attr('sensor.ctgp_dx_latest_version', 'data_provided_by') }}
        data:
          url: "{{ state_attr('sensor.ctgp_dx_latest_version', 'data_provided_by') }}"
          clickAction: "{{ state_attr('sensor.ctgp_dx_latest_version', 'data_provided_by') }}"
  mode: single
2. Conditional Notification (Only if Update is Large)

Get notified only if the download size is greater than 2 GB.

- alias: 'CTGP-DX: Large Update Alert'
  trigger:
    - platform: state
      entity_id: sensor.ctgp_dx_latest_version
  condition:
    - condition: template
      value_template: "{{ states('sensor.ctgp_dx_download_size') | replace(' GB', '') | float > 2.0 }}"
  action:
    - service: notify.persistent_notification
      data:
        title: 'Huge Update Detected'
        message: 'A large CTGP-DX update ({{ states("sensor.ctgp_dx_download_size") }}) is out! Make sure your SD card has space.'
3. Announcement via Smart Speaker (TTS)

Announce the update via Alexa or Google Home.

- alias: 'CTGP-DX: Voice Announcement'
  trigger:
    - platform: state
      entity_id: sensor.ctgp_dx_latest_version
  condition:
    - condition: template
      value_template: "{{ trigger.to_state.state != trigger.from_state.state }}"
  action:
    - service: tts.google_say
      target:
        entity_id: media_player.living_room_speaker
      data:
        message: "Attention! A new version of CTGP Deluxe, version {{ states('sensor.ctgp_dx_latest_version') }}, has just been released."
4. Dashboard Alert (Conditional Card)

You can also use the version sensor to show a conditional card on your dashboard only when the version matches a certain pattern or changes.

# In your Lovelace configuration
type: conditional
conditions:
  - entity: sensor.ctgp_dx_latest_version
    state_not: "unknown"
card:
  type: entities
  entities:
    - entity: sensor.ctgp_dx_latest_version
      name: "Latest Mod Version"

Bug reporting

Open an issue over at GitHub issues. Please prefer sending over a log with debugging enabled.

To enable debugging enter the following in your configuration.yaml:

logger:
    logs:
        custom_components.ctgpdx: debug

Thanks to

The data is scraped from the official ctgpdx.com website. All credits for the mod go to the CTGP Deluxe Team!

About

Homeassistant Integration for fetching latest ctgpdx version

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Contributors

Languages