Skip to content

Commit

Permalink
🔨 setup the project from integration_blueprint template
Browse files Browse the repository at this point in the history
  • Loading branch information
madmatah committed Mar 26, 2024
1 parent eb27496 commit ba29954
Show file tree
Hide file tree
Showing 20 changed files with 74 additions and 204 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ body:
required: true
- label: This issue only contains 1 issue (if you have multiple issues, open one issue for each issue).
required: true
- label: This issue is not a duplicate issue of any [previous issues](https://github.com/ludeeus/integration_blueprint/issues?q=is%3Aissue+label%3A%22Bug%22+)..
- label: This issue is not a duplicate issue of any [previous issues](https://github.com/madmatah/hass-walkingpad/issues?q=is%3Aissue+label%3A%22Bug%22+)..
required: true
- type: textarea
attributes:
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ body:
required: true
- label: This only contains 1 feature request (if you have multiple feature requests, open one feature request for each feature request).
required: true
- label: This issue is not a duplicate feature request of [previous feature requests](https://github.com/ludeeus/integration_blueprint/issues?q=is%3Aissue+label%3A%22Feature+Request%22+).
- label: This issue is not a duplicate feature request of [previous feature requests](https://github.com/madmatah/hass-walkingpad/issues?q=is%3Aissue+label%3A%22Feature+Request%22+).
required: true

- type: textarea
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ jobs:
shell: "bash"
run: |
yq -i -o json '.version="${{ github.event.release.tag_name }}"' \
"${{ github.workspace }}/custom_components/integration_blueprint/manifest.json"
"${{ github.workspace }}/custom_components/king_smith/manifest.json"
- name: "ZIP the integration directory"
shell: "bash"
run: |
cd "${{ github.workspace }}/custom_components/integration_blueprint"
zip integration_blueprint.zip -r ./
cd "${{ github.workspace }}/custom_components/king_smith"
zip king_smith.zip -r ./
- name: "Upload the ZIP file to the release"
uses: softprops/[email protected]
with:
files: ${{ github.workspace }}/custom_components/integration_blueprint/integration_blueprint.zip
files: ${{ github.workspace }}/custom_components/king_smith/king_smith.zip
61 changes: 0 additions & 61 deletions CONTRIBUTING.md

This file was deleted.

85 changes: 38 additions & 47 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,47 +1,38 @@
# Notice

The component and platforms in this repository are not meant to be used by a
user, but as a "blueprint" that custom component developers can build
upon, to make more awesome stuff.

HAVE FUN! 😎

## Why?

This is simple, by having custom_components look (README + structure) the same
it is easier for developers to help each other and for users to start using them.

If you are a developer and you want to add things to this "blueprint" that you think more
developers will have use for, please open a PR to add it :)

## What?

This repository contains multiple files, here is a overview:

File | Purpose | Documentation
-- | -- | --
`.devcontainer.json` | Used for development/testing with Visual Studio Code. | [Documentation](https://code.visualstudio.com/docs/remote/containers)
`.github/ISSUE_TEMPLATE/*.yml` | Templates for the issue tracker | [Documentation](https://help.github.com/en/github/building-a-strong-community/configuring-issue-templates-for-your-repository)
`.vscode/tasks.json` | Tasks for the devcontainer. | [Documentation](https://code.visualstudio.com/docs/editor/tasks)
`custom_components/integration_blueprint/*` | Integration files, this is where everything happens. | [Documentation](https://developers.home-assistant.io/docs/creating_component_index)
`CONTRIBUTING.md` | Guidelines on how to contribute. | [Documentation](https://help.github.com/en/github/building-a-strong-community/setting-guidelines-for-repository-contributors)
`LICENSE` | The license file for the project. | [Documentation](https://help.github.com/en/github/creating-cloning-and-archiving-repositories/licensing-a-repository)
`README.md` | The file you are reading now, should contain info about the integration, installation and configuration instructions. | [Documentation](https://help.github.com/en/github/writing-on-github/basic-writing-and-formatting-syntax)
`requirements.txt` | Python packages used for development/lint/testing this integration. | [Documentation](https://pip.pypa.io/en/stable/user_guide/#requirements-files)

## How?

1. Create a new repository in GitHub, using this repository as a template by clicking the "Use this template" button in the GitHub UI.
1. Open your new repository in Visual Studio Code devcontainer (Preferably with the "`Dev Containers: Clone Repository in Named Container Volume...`" option).
1. Rename all instances of the `integration_blueprint` to `custom_components/<your_integration_domain>` (e.g. `custom_components/awesome_integration`).
1. Rename all instances of the `Integration Blueprint` to `<Your Integration Name>` (e.g. `Awesome Integration`).
1. Run the `scripts/develop` to start HA and test out your new integration.

## Next steps

These are some next steps you may want to look into:
- Add tests to your integration, [`pytest-homeassistant-custom-component`](https://github.com/MatthewFlamm/pytest-homeassistant-custom-component) can help you get started.
- Add brand images (logo/icon) to https://github.com/home-assistant/brands.
- Create your first release.
- Share your integration on the [Home Assistant Forum](https://community.home-assistant.io/).
- Submit your integration to the [HACS](https://hacs.xyz/docs/publish/start).
# Walkingpad - Home Assistant custom integration

[![GitHub Release][releases-shield]][releases]
[![GitHub Activity][commits-shield]][commits]
[![License][license-shield]](LICENSE)


**This integration will set up the following platforms.**

Platform | Description
-- | --
`sensor` | WalkingPad usage metrics.

## Installation

1. Using the tool of choice open the directory (folder) for your HA configuration (where you find `configuration.yaml`).
1. If you do not have a `custom_components` directory (folder) there, you need to create it.
1. In the `custom_components` directory (folder) create a new folder called `king_smith`.
1. Download _all_ the files from the `custom_components/king_smith/` directory (folder) in this repository.
1. Place the files you downloaded in the new directory (folder) you created.
1. Restart Home Assistant
1. In the HA UI go to "Configuration" -> "Integrations" click "+" and search for "WalkingPad"

## Configuration

(TODO)


<!---->


***

[commits-shield]: https://img.shields.io/github/commit-activity/y/madmatah/hass-walkingpad.svg?style=for-the-badge
[commits]: https://github.com/madmatah/hass-walkingpad/commits/main
[license-shield]: https://img.shields.io/github/license/madmatah/hass-walkingpad.svg?style=for-the-badge
[releases-shield]: https://img.shields.io/github/release/madmatah/hass-walkingpad.svg?style=for-the-badge
[releases]: https://github.com/madmatah/hass-walkingpad/releases
56 changes: 0 additions & 56 deletions README_EXAMPLE.md

This file was deleted.

12 changes: 0 additions & 12 deletions custom_components/integration_blueprint/manifest.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
"""Custom integration to integrate integration_blueprint with Home Assistant.
For more details about this integration, please refer to
https://github.com/ludeeus/integration_blueprint
"""
"""Custom integration to integrate king_smith with Home Assistant."""
from __future__ import annotations

from homeassistant.config_entries import ConfigEntry
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Binary sensor platform for integration_blueprint."""
"""Binary sensor platform for king_smith."""
from __future__ import annotations

from homeassistant.components.binary_sensor import (
Expand All @@ -13,7 +13,7 @@

ENTITY_DESCRIPTIONS = (
BinarySensorEntityDescription(
key="integration_blueprint",
key="king_smith",
name="Integration Blueprint Binary Sensor",
device_class=BinarySensorDeviceClass.CONNECTIVITY,
),
Expand All @@ -33,7 +33,7 @@ async def async_setup_entry(hass, entry, async_add_devices):


class IntegrationBlueprintBinarySensor(IntegrationBlueprintEntity, BinarySensorEntity):
"""integration_blueprint binary_sensor class."""
"""king_smith binary_sensor class."""

def __init__(
self,
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"""Constants for integration_blueprint."""
"""Constants for king_smith."""
from logging import Logger, getLogger

LOGGER: Logger = getLogger(__package__)

NAME = "Integration blueprint"
DOMAIN = "integration_blueprint"
NAME = "Kingsmith WalkingPad"
DOMAIN = "king_smith"
VERSION = "0.0.0"
ATTRIBUTION = "Data provided by http://jsonplaceholder.typicode.com/"
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""DataUpdateCoordinator for integration_blueprint."""
"""DataUpdateCoordinator for king_smith."""
from __future__ import annotations

from datetime import timedelta
Expand Down
File renamed without changes.
12 changes: 12 additions & 0 deletions custom_components/king_smith/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"domain": "king_smith",
"name": "Kingsmith WalkingPad",
"codeowners": [
"@ludeeus"
],
"config_flow": true,
"documentation": "https://github.com/madmatah/hass-walkingpad",
"iot_class": "cloud_polling",
"issue_tracker": "https://github.com/madmatah/hass-walkingpad/issues",
"version": "0.0.0"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Sensor platform for integration_blueprint."""
"""Sensor platform for king_smith."""
from __future__ import annotations

from homeassistant.components.sensor import SensorEntity, SensorEntityDescription
Expand All @@ -9,8 +9,8 @@

ENTITY_DESCRIPTIONS = (
SensorEntityDescription(
key="integration_blueprint",
name="Integration Sensor",
key="king_smith",
name="Kingsmith WalkingPad",
icon="mdi:format-quote-close",
),
)
Expand All @@ -29,7 +29,7 @@ async def async_setup_entry(hass, entry, async_add_devices):


class IntegrationBlueprintSensor(IntegrationBlueprintEntity, SensorEntity):
"""integration_blueprint Sensor class."""
"""king_smith Sensor class."""

def __init__(
self,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Switch platform for integration_blueprint."""
"""Switch platform for king_smith."""
from __future__ import annotations

from homeassistant.components.switch import SwitchEntity, SwitchEntityDescription
Expand All @@ -9,7 +9,7 @@

ENTITY_DESCRIPTIONS = (
SwitchEntityDescription(
key="integration_blueprint",
key="king_smith",
name="Integration Switch",
icon="mdi:format-quote-close",
),
Expand All @@ -29,7 +29,7 @@ async def async_setup_entry(hass, entry, async_add_devices):


class IntegrationBlueprintSwitch(IntegrationBlueprintEntity, SwitchEntity):
"""integration_blueprint switch class."""
"""king_smith switch class."""

def __init__(
self,
Expand Down
4 changes: 2 additions & 2 deletions hacs.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Integration blueprint",
"filename": "integration_blueprint.zip",
"name": "Kingsmith WalkingPad",
"filename": "king_smith.zip",
"hide_default_branch": true,
"homeassistant": "2023.8.0",
"render_readme": true,
Expand Down
2 changes: 1 addition & 1 deletion scripts/develop
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ if [[ ! -d "${PWD}/config" ]]; then
fi

# Set the path to custom_components
## This let's us have the structure we want <root>/custom_components/integration_blueprint
## This let's us have the structure we want <root>/custom_components/king_smith
## while at the same time have Home Assistant configuration inside <root>/config
## without resulting to symlinks.
export PYTHONPATH="${PYTHONPATH}:${PWD}/custom_components"
Expand Down

0 comments on commit ba29954

Please sign in to comment.