Full Code of AlexxIT/DashCast for AI

master 39efa2599074 cached
10 files
6.3 KB
1.8k tokens
5 symbols
1 requests
Download .txt
Repository: AlexxIT/DashCast
Branch: master
Commit: 39efa2599074
Files: 10
Total size: 6.3 KB

Directory structure:
gitextract_rpo721qt/

├── .github/
│   └── workflows/
│       └── hacs.yml
├── .gitignore
├── LICENSE
├── README.md
├── custom_components/
│   └── dash_cast/
│       ├── __init__.py
│       ├── config_flow.py
│       ├── manifest.json
│       ├── services.yaml
│       └── translations/
│           └── en.json
└── hacs.json

================================================
FILE CONTENTS
================================================

================================================
FILE: .github/workflows/hacs.yml
================================================
name: HACS validation

on:
  push:
  pull_request:

jobs:
  hacs:
    runs-on: "ubuntu-latest"
    steps:
      - uses: "actions/checkout@v2"
      - uses: "hacs/action@main"
        with: { category: "integration", ignore: "brands" }
  hassfest:
    runs-on: "ubuntu-latest"
    steps:
      - uses: "actions/checkout@v3"
      - uses: "home-assistant/actions/hassfest@master"


================================================
FILE: .gitignore
================================================
__pycache__/
.idea/
.homeassistant/


================================================
FILE: LICENSE
================================================
MIT License

Copyright (c) 2020 AlexxIT

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


================================================
FILE: README.md
================================================
# DashCast for Home Assistant

[![hacs_badge](https://img.shields.io/badge/HACS-Custom-orange.svg)](https://github.com/custom-components/hacs)

This [Home Assistant](https://www.home-assistant.io/) service allows you to cast a website to a Google [Chromecast](https://en.wikipedia.org/wiki/Chromecast).

**PS.** All thanks to [@stestagg](https://github.com/stestagg), developer of [DashCast](https://stestagg.github.io/dashcast/) app for Google Chromecast.

## Installation

**Method 1.** [HACS](https://hacs.xyz/) custom repo:

> HACS > Integrations > 3 dots (upper top corner) > Custom repositories > URL: `AlexxIT/DashCast`, Category: Integration > Add > wait > DashCast > Install

**Method 2.** Manually copy `dash_cast` folder from [latest release](https://github.com/AlexxIT/DashCast/releases/latest) to `/config/custom_components` folder.

## Configuration

**Method 1.** GUI:

> Configuration > Integrations > Add Integration > **DashCast**

If the integration is not in the list, you need to clear the browser cache.

**Method 2.** YAML:

```yaml
dash_cast:
```

## Usage

New service `dash_cast.load_url`:

```yaml
service: dash_cast.load_url
data:
  entity_id: media_player.hall_tv
  url: https://www.home-assistant.io/
  force: true  # use this option if iframe blocking is enabled on the site
  reload_seconds: 60  # reload page every X seconds
```


================================================
FILE: custom_components/dash_cast/__init__.py
================================================
import voluptuous as vol
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_ENTITY_ID
from homeassistant.core import ServiceCall, HomeAssistant
from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.entity_component import DATA_INSTANCES
from pychromecast import Chromecast
from pychromecast.controllers.dashcast import DashCastController

DOMAIN = "dash_cast"

LOAD_URL_SCHEMA = cv.make_entity_service_schema(
    {
        vol.Required("url"): cv.string,
        vol.Optional("force", default=False): cv.boolean,
        vol.Optional("reload_seconds", default=0): cv.positive_int,
    }
)


async def async_setup(hass: HomeAssistant, config: dict) -> bool:
    dashs = {}

    async def play_media(call: ServiceCall):
        kwargs = dict(call.data)
        entity_ids = kwargs.pop(ATTR_ENTITY_ID)

        for entity in hass.data[DATA_INSTANCES]["media_player"].entities:
            if entity.entity_id not in entity_ids:
                continue

            dash: DashCastController = dashs.get(entity.entity_id)
            if not dash:
                chromecast: Chromecast = getattr(entity, "_chromecast")
                if chromecast:
                    dashs[entity.entity_id] = dash = DashCastController()
                    chromecast.register_handler(dash)
                else:
                    return

            dash.load_url(**kwargs)

    hass.services.async_register(DOMAIN, "load_url", play_media, LOAD_URL_SCHEMA)

    return True


async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> bool:
    return True


================================================
FILE: custom_components/dash_cast/config_flow.py
================================================
from homeassistant.config_entries import ConfigFlow

from . import DOMAIN


class ConfigFlowHandler(ConfigFlow, domain=DOMAIN):
    async def async_step_import(self, user_input=None):
        return await self.async_step_user()

    async def async_step_user(self, user_input=None):
        if self._async_current_entries():
            return self.async_abort(reason="single_instance_allowed")
        return self.async_create_entry(title="DashCast", data={})


================================================
FILE: custom_components/dash_cast/manifest.json
================================================
{
  "domain": "dash_cast",
  "name": "DashCast",
  "codeowners": [
    "@AlexxIT"
  ],
  "config_flow": true,
  "dependencies": [
    "cast"
  ],
  "documentation": "https://github.com/AlexxIT/DashCast",
  "iot_class": "calculated",
  "issue_tracker": "https://github.com/AlexxIT/DashCast/issues",
  "requirements": [],
  "version": "1.1.1"
}


================================================
FILE: custom_components/dash_cast/services.yaml
================================================
load_url:
  fields:
    entity_id:
      required: true
      selector:
        entity:
          integration: cast
          domain: media_player
    url:
      example: https://www.home-assistant.io/
      required: true
      selector:
        text:
    force:
      default: false
      selector:
        boolean:
    reload_seconds:
      default: 0
      selector:
        number:
          min: 0
          max: 10000


================================================
FILE: custom_components/dash_cast/translations/en.json
================================================
{
  "services": {
    "load_url": {
      "name": "DashCast",
      "description": "Send websites to Chromecasts",
      "fields": {
        "entity_id": {
          "name": "Entity",
          "description": "Media player from Google Cast integration"
        },
        "url": {
          "name": "URL",
          "description": "Webpage URL"
        },
        "force": {
          "name": "Force",
          "description": "Use this option if iframe blocking is enabled on the site"
        },
        "reload_seconds": {
          "name": "Reload seconds",
          "description": "Reload page every X seconds"
        }
      }
    }
  }
}

================================================
FILE: hacs.json
================================================
{
    "name": "DashCast",
    "render_readme": true,
    "homeassistant": "2023.2.0"
}
Download .txt
gitextract_rpo721qt/

├── .github/
│   └── workflows/
│       └── hacs.yml
├── .gitignore
├── LICENSE
├── README.md
├── custom_components/
│   └── dash_cast/
│       ├── __init__.py
│       ├── config_flow.py
│       ├── manifest.json
│       ├── services.yaml
│       └── translations/
│           └── en.json
└── hacs.json
Download .txt
SYMBOL INDEX (5 symbols across 2 files)

FILE: custom_components/dash_cast/__init__.py
  function async_setup (line 21) | async def async_setup(hass: HomeAssistant, config: dict) -> bool:
  function async_setup_entry (line 48) | async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEnt...

FILE: custom_components/dash_cast/config_flow.py
  class ConfigFlowHandler (line 6) | class ConfigFlowHandler(ConfigFlow, domain=DOMAIN):
    method async_step_import (line 7) | async def async_step_import(self, user_input=None):
    method async_step_user (line 10) | async def async_step_user(self, user_input=None):
Condensed preview — 10 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (7K chars).
[
  {
    "path": ".github/workflows/hacs.yml",
    "chars": 378,
    "preview": "name: HACS validation\n\non:\n  push:\n  pull_request:\n\njobs:\n  hacs:\n    runs-on: \"ubuntu-latest\"\n    steps:\n      - uses: "
  },
  {
    "path": ".gitignore",
    "chars": 36,
    "preview": "__pycache__/\n.idea/\n.homeassistant/\n"
  },
  {
    "path": "LICENSE",
    "chars": 1064,
    "preview": "MIT License\n\nCopyright (c) 2020 AlexxIT\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
  },
  {
    "path": "README.md",
    "chars": 1362,
    "preview": "# DashCast for Home Assistant\n\n[![hacs_badge](https://img.shields.io/badge/HACS-Custom-orange.svg)](https://github.com/c"
  },
  {
    "path": "custom_components/dash_cast/__init__.py",
    "chars": 1634,
    "preview": "import voluptuous as vol\nfrom homeassistant.config_entries import ConfigEntry\nfrom homeassistant.const import ATTR_ENTIT"
  },
  {
    "path": "custom_components/dash_cast/config_flow.py",
    "chars": 461,
    "preview": "from homeassistant.config_entries import ConfigFlow\n\nfrom . import DOMAIN\n\n\nclass ConfigFlowHandler(ConfigFlow, domain=D"
  },
  {
    "path": "custom_components/dash_cast/manifest.json",
    "chars": 343,
    "preview": "{\n  \"domain\": \"dash_cast\",\n  \"name\": \"DashCast\",\n  \"codeowners\": [\n    \"@AlexxIT\"\n  ],\n  \"config_flow\": true,\n  \"depende"
  },
  {
    "path": "custom_components/dash_cast/services.yaml",
    "chars": 425,
    "preview": "load_url:\n  fields:\n    entity_id:\n      required: true\n      selector:\n        entity:\n          integration: cast\n    "
  },
  {
    "path": "custom_components/dash_cast/translations/en.json",
    "chars": 646,
    "preview": "{\n  \"services\": {\n    \"load_url\": {\n      \"name\": \"DashCast\",\n      \"description\": \"Send websites to Chromecasts\",\n     "
  },
  {
    "path": "hacs.json",
    "chars": 86,
    "preview": "{\n    \"name\": \"DashCast\",\n    \"render_readme\": true,\n    \"homeassistant\": \"2023.2.0\"\n}"
  }
]

About this extraction

This page contains the full source code of the AlexxIT/DashCast GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 10 files (6.3 KB), approximately 1.8k tokens, and a symbol index with 5 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!