-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🤖 05-09-24 | ♻️ Updated 4 files ✨ Added 2 files
-------- - 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
Showing
9 changed files
with
168 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,5 +22,5 @@ | |
"requirements": [ | ||
"aiogithubapi>=22.10.1" | ||
], | ||
"version": "2.0.0" | ||
"version": "2.0.1" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,5 +12,5 @@ | |
"requirements": [ | ||
"simpleicons==7.14.0" | ||
], | ||
"version": "v2.2.0" | ||
"version": "v2.2.1" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters