Skip to content

Commit

Permalink
🤖 05-09-24 | ♻️ Updated 4 files ✨ Added 2 files
Browse files Browse the repository at this point in the history
--------
- update: config/README.md
- update: hacs/manifest.json
- update: docs/README.md
- update: simpleicons/manifest.json
- add: mushroom/
- add: dashboard-resources/entity-downloader.js

--------
Automated commit via script
  • Loading branch information
ngocjohn committed Sep 4, 2024
1 parent d015087 commit c595efb
Show file tree
Hide file tree
Showing 9 changed files with 168 additions and 8 deletions.
8 changes: 5 additions & 3 deletions config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Hey there! Welcome to my little corner of the tech world! 👨‍💻

This is where I store all the cool configurations for my Home Assistant system. Well, it's a mix of awesome codes and setups I discovered from the Home Assistant community. Seriously, those folks are wizards! 🧙‍♂️ As a bit of an internet newbie turned tech enthusiast, I stumbled upon the magic of IT, and this repository is my way of sharing the joy and knowledge I've gained along the way. Dive in, explore, and let the tech magic begin! ✨

I frequently refresh my configuration files. My current Home Assistant version is <b>2024.8.3</b>. If you find something you like, don't forget to give my repository a ⭐️!
I frequently refresh my configuration files. My current Home Assistant version is <b>2024.9.0</b>. If you find something you like, don't forget to give my repository a ⭐️!

<video width="100%" controls loop muted>
<source src="https://github-production-user-asset-6210df.s3.amazonaws.com/96962827/297112091-acc1a4db-b92e-4ab1-ac9d-df067d4ba4d1.mp4" type="video/mp4">
Expand All @@ -37,13 +37,13 @@ https://github.com/ngocjohn/hass-config/assets/96962827/acc1a4db-b92e-4ab1-ac9d-
</thead>
<tbody>
<tr>
<td>34,030 </td>
<td>34,088 </td>
<td>31</td>
<td>188</td>
<td>37</td>
<td>52</td>
<td>36</td>
<td>1108</td>
<td>1110</td>
<td>172</td>
<td>38</td>
</tr>
Expand Down Expand Up @@ -163,11 +163,13 @@ https://github.com/ngocjohn/hass-config/assets/96962827/acc1a4db-b92e-4ab1-ac9d-
- [Spotify Lovelace Card](https://github.com/custom-cards/spotify-card)
- [Stack In Card](https://github.com/custom-cards/stack-in-card)
- [State Switch](https://github.com/thomasloven/lovelace-state-switch)
- [Streamline Card](https://github.com/brunosabot/streamline-card)
- [Sun Card](https://github.com/edwardtfn/home-assistant-sun-card)
- [Tabbed Card](https://github.com/kinghat/tabbed-card)
- [Tailwindcss Template Card](https://github.com/usernein/tailwindcss-template-card)
- [Timer Bar Card](https://github.com/rianadon/timer-bar-card)
- [Tv Remote Card (With Touchpad And Haptic Feedback)](https://github.com/usernein/tv-card)
- [Universal Remote Card](https://github.com/Nerwyn/android-tv-card)
- [Upcoming Media Card](https://github.com/xZetsubou/upcoming-media-card)
- [Uptime Card](https://github.com/dylandoamaral/uptime-card)
- [Vehicle Info Card](https://github.com/ngocjohn/vehicle-info-card)
Expand Down
2 changes: 1 addition & 1 deletion config/custom_components/hacs/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
"requirements": [
"aiogithubapi>=22.10.1"
],
"version": "2.0.0"
"version": "2.0.1"
}
2 changes: 1 addition & 1 deletion config/custom_components/simpleicons/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
"requirements": [
"simpleicons==7.14.0"
],
"version": "v2.2.0"
"version": "v2.2.1"
}
11 changes: 11 additions & 0 deletions config/themes/mushroom/mushroom-shadow.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# DO NOT EDIT THIS FILE.
# This file will be reset with updates.
# If you want to customize it, copy the content in another folder and file and change the name.
# https://www.home-assistant.io/integrations/frontend/#defining-themes
Mushroom Shadow:
# Home Assistant override
ha-card-box-shadow: 0px 2px 4px 0px rgba(0,0,0,0.16)
ha-card-border-width: 0
modes:
light: {}
dark: {}
20 changes: 20 additions & 0 deletions config/themes/mushroom/mushroom-square-shadow.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# DO NOT EDIT THIS FILE.
# This file will be reset with updates.
# If you want to customize it, copy the content in another folder and file and change the name.
# https://www.home-assistant.io/integrations/frontend/#defining-themes
Mushroom Square Shadow:
# Home Assistant override
ha-card-box-shadow: 0px 2px 4px 0px rgba(0,0,0,0.16)
ha-card-border-width: 0
ha-card-border-radius: 6px
ha-badge-border-radius: 6px
# Layout
mush-spacing: 8px
# Elements
mush-icon-border-radius: 6px
mush-control-border-radius: 6px
# Chips
mush-chip-border-radius: 6px
modes:
light: {}
dark: {}
18 changes: 18 additions & 0 deletions config/themes/mushroom/mushroom-square.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# DO NOT EDIT THIS FILE.
# This file will be reset with updates.
# If you want to customize it, copy the content in another folder and file and change the name.
# https://www.home-assistant.io/integrations/frontend/#defining-themes
Mushroom Square:
# Home Assistant override
ha-card-border-radius: 6px
ha-badge-border-radius: 6px
# Layout
mush-spacing: 8px
# Elements
mush-icon-border-radius: 6px
mush-control-border-radius: 6px
# Chips
mush-chip-border-radius: 6px
modes:
light: {}
dark: {}
9 changes: 9 additions & 0 deletions config/themes/mushroom/mushroom.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# DO NOT EDIT THIS FILE.
# This file will be reset with updates.
# If you want to customize it, copy the content in another folder and file and change the name.
# https://www.home-assistant.io/integrations/frontend/#defining-themes
Mushroom:
# Nothing here as it's the default HA theme since 2022.11
modes:
light: {}
dark: {}
98 changes: 98 additions & 0 deletions config/www/dashboard-resources/entity-downloader.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
console.info('Platform Entities Extractor 2');

export class HassEntityDownloader {
constructor(hassInstance) {
this._hass = hassInstance;
}

async getEntitiesByPlatform(platformToFind) {
// Fetch all entities from the config entity registry
const allEntities = await this._hass.callWS({
type: 'config/entity_registry/list',
});

// Filter to get all sub-entities for the device
const platformEntities = allEntities.filter((e) => e.platform === platformToFind);

if (!platformEntities || platformEntities.length === 0) {
console.log('Entities not found');
return;
}

console.log('Raw data:', platformEntities);

const entStates = this.extractEntityStates(platformEntities);

if (Object.keys(entStates).length > 0) {
console.log('Entities with state:', entStates);
}
}

extractEntityStates(platformEntities) {
const entStates = {};

for (const entity of platformEntities) {
const entityState = this._hass.states[entity.entity_id];
if (entityState) {
const entState = entityState.state;
const entityId = entity.entity_id;
const originalName = entity.original_name;
const uniqueId = entity.unique_id;
const entAttr = entityState.attributes;
entStates[entityId] = {
original_name: originalName,
unique_id: uniqueId,
state: entState,
attributes: entAttr,
};
} else {
console.log(
`| ${entityState.attributes.friendly_name.padEnd(22)} | ${entity.entity_id.padEnd(24)} | -`.replace(/ /g, ' ')
);
}
}

return entStates;
}

async downloadEntitiesByPlatform(platformToFind) {
// Fetch all entities from the config entity registry
const allEntities = await this._hass.callWS({
type: 'config/entity_registry/list',
});

// Filter to get all sub-entities for the device
const platformEntities = allEntities.filter((e) => e.platform === platformToFind);

if (!platformEntities || platformEntities.length === 0) {
console.log('Entities not found');
return;
}

console.log('Raw data to download:', platformEntities);
this.downloadJSON(platformEntities, `${platformToFind}_entities_raw.json`);
const entStates = this.extractEntityStates(platformEntities);

if (Object.keys(entStates).length > 0) {
console.log('Entities with state to download:', entStates);
this.downloadJSON(entStates, `${platformToFind}_entities.json`);
}
}

downloadJSON(data, filename) {
const jsonStr = JSON.stringify(data, null, 2); // Convert object to JSON string
const blob = new Blob([jsonStr], { type: 'application/json' }); // Create a Blob object
const url = URL.createObjectURL(blob); // Create a URL for the Blob object
const a = document.createElement('a'); // Create a link element
a.href = url; // Set the download URL
a.download = filename; // Set the file name
document.body.appendChild(a); // Append the link to the body
a.click(); // Trigger the download by simulating a click
document.body.removeChild(a); // Remove the link from the body
URL.revokeObjectURL(url); // Revoke the object URL to free up memory
}
}

// Initialize the default instance and attach it to the window object
const hassInstance = document.querySelector('home-assistant').hass;
window.hassEntityDownloader = new HassEntityDownloader(hassInstance);
8 changes: 5 additions & 3 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Hey there! Welcome to my little corner of the tech world! 👨‍💻

This is where I store all the cool configurations for my Home Assistant system. Well, it's a mix of awesome codes and setups I discovered from the Home Assistant community. Seriously, those folks are wizards! 🧙‍♂️ As a bit of an internet newbie turned tech enthusiast, I stumbled upon the magic of IT, and this repository is my way of sharing the joy and knowledge I've gained along the way. Dive in, explore, and let the tech magic begin! ✨

I frequently refresh my configuration files. My current Home Assistant version is <b>2024.8.3</b>. If you find something you like, don't forget to give my repository a ⭐️!
I frequently refresh my configuration files. My current Home Assistant version is <b>2024.9.0</b>. If you find something you like, don't forget to give my repository a ⭐️!

<video width="100%" controls loop muted>
<source src="https://github-production-user-asset-6210df.s3.amazonaws.com/96962827/297112091-acc1a4db-b92e-4ab1-ac9d-df067d4ba4d1.mp4" type="video/mp4">
Expand All @@ -37,13 +37,13 @@ https://github.com/ngocjohn/hass-config/assets/96962827/acc1a4db-b92e-4ab1-ac9d-
</thead>
<tbody>
<tr>
<td>34,030 </td>
<td>34,088 </td>
<td>31</td>
<td>188</td>
<td>37</td>
<td>52</td>
<td>36</td>
<td>1108</td>
<td>1110</td>
<td>172</td>
<td>38</td>
</tr>
Expand Down Expand Up @@ -163,11 +163,13 @@ https://github.com/ngocjohn/hass-config/assets/96962827/acc1a4db-b92e-4ab1-ac9d-
- [Spotify Lovelace Card](https://github.com/custom-cards/spotify-card)
- [Stack In Card](https://github.com/custom-cards/stack-in-card)
- [State Switch](https://github.com/thomasloven/lovelace-state-switch)
- [Streamline Card](https://github.com/brunosabot/streamline-card)
- [Sun Card](https://github.com/edwardtfn/home-assistant-sun-card)
- [Tabbed Card](https://github.com/kinghat/tabbed-card)
- [Tailwindcss Template Card](https://github.com/usernein/tailwindcss-template-card)
- [Timer Bar Card](https://github.com/rianadon/timer-bar-card)
- [Tv Remote Card (With Touchpad And Haptic Feedback)](https://github.com/usernein/tv-card)
- [Universal Remote Card](https://github.com/Nerwyn/android-tv-card)
- [Upcoming Media Card](https://github.com/xZetsubou/upcoming-media-card)
- [Uptime Card](https://github.com/dylandoamaral/uptime-card)
- [Vehicle Info Card](https://github.com/ngocjohn/vehicle-info-card)
Expand Down

0 comments on commit c595efb

Please sign in to comment.