Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
amosyuen committed Jan 21, 2023
1 parent a1b6cca commit 27bc778
Show file tree
Hide file tree
Showing 22 changed files with 645 additions and 198 deletions.
5 changes: 3 additions & 2 deletions .devcontainer/configuration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ default_config:
logger:
default: info
logs:
custom_components.ha_extra_api: debug
custom_components.ha_registry: debug

# If you need to debug uncommment the line below (doc: https://www.home-assistant.io/integrations/debugpy/)
# debugpy:
debugpy:
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// See https://aka.ms/vscode-remote/devcontainer.json for format details.
{
"image": "ghcr.io/ludeeus/devcontainer/integration:stable",
"name": "Home Assistant Extra API integration development",
"name": "Home Assistant Registry integration development",
"context": "..",
"appPort": ["9123:8123"],
"postCreateCommand": ".devcontainer/setup.sh",
Expand Down
2 changes: 2 additions & 0 deletions .devcontainer/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ set -e
cd "$(dirname "$0")/.."

pip3 install -r .github/workflows/constraints.txt
pip3 install -r requirements_dev.txt
pip3 install -r requirements_test.txt
pre-commit install

container install
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/issue.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Report an issue with Home Assistant Extra API
description: Report an issue with Home Assistant Extra API
name: Report an issue with Home Assistant Registry
description: Report an issue with Home Assistant Registry
body:
- type: markdown
attributes:
Expand All @@ -23,7 +23,7 @@ body:
validations:
required: true
attributes:
label: Home Assistant Extra API Version
label: Home Assistant Registry Version
placeholder: e.g. v2.2.5
- type: markdown
attributes:
Expand Down
76 changes: 48 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Home Assistant Extra API
# Home Assistant Registry

[![GitHub Release][releases-shield]][releases]
[![GitHub Activity][commits-shield]][commits]
Expand All @@ -13,30 +13,53 @@

[![Community Forum][forum-shield]][forum]

## Functionality
## Description

Supplemental APIs for home assistant to modify HA state programatically.
Adds services for home assistant registry operations.

> **WARNING**: These are low level APIs that only have basic validation. They are intended for power users. Misuse could result in entities getting into strange states.
HA core has decided to not support services for common registry operations mentioned in https://github.com/home-assistant/core/pull/86281#event-8320797538.

### Services

#### Update Entity
#### Remove Entity

Remove all targeted entity registry configs,

Updates all targeted entities to the specified vlaues
`entity_id` is a repeated field that takes comma separated values in a string or a yaml list

```yaml
service: ha_extra_api.update_entity
target:
service: ha_registry.updateremove_entity_entity
data:
entity_id:
- sensor.lux
- binary_sensor.contact
- sensor.bathroom_temperature
- sensor.bedroom_temperature
```
#### Update Entity
Updates all targeted entity registry configs to the specified values.
`entity_id` and `aliases` are repeated fields that take comma separated values in a string or a yaml list

```yaml
service: ha_registry.update_entity
data:
alias:
entity_id: sensor.bathroom_temperature,sensor.bedroom_temperature
aliases:
- Alias1
- Alias2
area_id: 1
area_id: bedroom
device_class: temperature
disabled: true
hidden: true
icon: mdi:home
name: Display Name
status: disabled
name: Bedroom Temperature
new_entity_id: sensor.new_entity_id
options_domain: sensor
options:
unit_of_measurement: °F
```

{% if not installed %}
Expand All @@ -49,38 +72,36 @@ data:
2. Go to HACS "Integrations >" section
3. Click 3 dots in top right
4. Click "Custom repositories"
5. Add repository https://github.com/amosyuen/ha-extra-api with category `Integration`
5. Add repository https://github.com/amosyuen/ha-registry with category `Integration`
6. In the lower right click "+ Explore & Download repositories"
7. Search for "Home Assistant Extra API" and add it
7. Search for "Home Assistant Registry" and add it
- HA Restart is not needed since it is configured in UI config flow
8. In the Home Assistant (HA) UI go to "Configuration"
9. Click "Integrations"
10. Click "+ Add Integration"
11. Search for "Home Assistant Extra API"
11. Search for "Home Assistant Registry"

### Manual

1. Using the tool of choice open the directory (folder) for your [HA configuration](https://www.home-assistant.io/docs/configuration/) (where you find `configuration.yaml`).
2. If you do not have a `custom_components` directory (folder) there, you need to create it.
3. In the `custom_components` directory (folder) create a new folder called `ha_extra_api`.
4. Download _all_ the files from the `custom_components/ha_extra_api/` directory (folder) in this repository.
3. In the `custom_components` directory (folder) create a new folder called `ha_registry`.
4. Download _all_ the files from the `custom_components/ha_registry/` directory (folder) in this repository.
5. Place the files you downloaded in the new directory (folder) you created.
6. Restart Home Assistant
7. In the Home Assistant (HA) UI go to "Configuration"
8. Click "Integrations"
9. Click "+ Add Integration"
10. Search for "Home Assistant Extra API"
10. Search for "Home Assistant Registry"

{% endif %}

## Contributions are welcome!

If you want to contribute to this please read the [Contribution guidelines](https://github.com/amosyuen/ha-extra-api/blob/master/CONTRIBUTING.md)
If you want to contribute to this please read the [Contribution guidelines](https://github.com/amosyuen/ha-registry/blob/master/CONTRIBUTING.md)

## Credits

This project was generated from [@oncleben31](https://github.com/oncleben31)'s [Home Assistant Custom Component Cookiecutter](https://github.com/oncleben31/cookiecutter-homeassistant-custom-component) template.

Code template was mainly taken from [@Ludeeus](https://github.com/ludeeus)'s [integration_blueprint][integration_blueprint] template

---
Expand All @@ -90,17 +111,16 @@ Code template was mainly taken from [@Ludeeus](https://github.com/ludeeus)'s [in
[black-shield]: https://img.shields.io/badge/code%20style-black-000000.svg?style=for-the-badge
[buymecoffee]: https://paypal.me/amosyuen
[buymecoffeebadge]: https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg?style=for-the-badge
[commits-shield]: https://img.shields.io/github/commit-activity/y/amosyuen/ha-extra-api.svg?style=for-the-badge
[commits]: https://github.com/amosyuen/ha-extra-api/commits/main
[commits-shield]: https://img.shields.io/github/commit-activity/y/amosyuen/ha-registry.svg?style=for-the-badge
[commits]: https://github.com/amosyuen/ha-registry/commits/main
[hacs]: https://hacs.xyz
[hacsbadge]: https://img.shields.io/badge/HACS-Default-orange.svg?style=for-the-badge
[exampleimg]: example.png
[forum-shield]: https://img.shields.io/badge/community-forum-brightgreen.svg?style=for-the-badge
[forum]: https://community.home-assistant.io/
[license-shield]: https://img.shields.io/github/license/amosyuen/ha-extra-api.svg?style=for-the-badge
[license-shield]: https://img.shields.io/github/license/amosyuen/ha-registry.svg?style=for-the-badge
[maintenance-shield]: https://img.shields.io/badge/maintainer-%40amosyuen-blue.svg?style=for-the-badge
[pre-commit]: https://github.com/pre-commit/pre-commit
[pre-commit-shield]: https://img.shields.io/badge/pre--commit-enabled-brightgreen?style=for-the-badge
[releases-shield]: https://img.shields.io/github/release/amosyuen/ha-extra-api.svg?style=for-the-badge
[releases]: https://github.com/amosyuen/ha-extra-api/releases
[releases-shield]: https://img.shields.io/github/release/amosyuen/ha-registry.svg?style=for-the-badge
[releases]: https://github.com/amosyuen/ha-registry/releases
[user_profile]: https://github.com/amosyuen
1 change: 1 addition & 0 deletions custom_components/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Custom components module."""
89 changes: 0 additions & 89 deletions custom_components/ha_extra_api/__init__.py

This file was deleted.

12 changes: 0 additions & 12 deletions custom_components/ha_extra_api/const.py

This file was deleted.

11 changes: 0 additions & 11 deletions custom_components/ha_extra_api/manifest.json

This file was deleted.

33 changes: 0 additions & 33 deletions custom_components/ha_extra_api/services.yaml

This file was deleted.

Loading

0 comments on commit 27bc778

Please sign in to comment.