this post was submitted on 05 Mar 2025
1 points (100.0% liked)

Home Assistant

414 readers
2 users here now

Home Assistant is open source home automation that puts local control and privacy first. Powered by a worldwide community of tinkerers and DIY...

founded 2 years ago
MODERATORS
 
This is an automated archive made by the Lemmit Bot.

The original was posted on /r/homeassistant by /u/maxi1134 on 2025-03-04 21:53:31+00:00.


Since i got complains that the previous list was not detailed enough, I asked Mistral to give a resume of each one by analyzing each YAML script.

It might be a tad wonky, but at a glances, it looks good!

The code is all available here:

1. broadcast_alert_in_the_house
Step 1: Store Chromecasts in variables
Two lists are created:
playing_chromecasts: List of chromecast devices that are currently playing.
non_playing_chromecasts: List of chromecast devices not currently playing.
Step 2: Lights
Retrieve a list of lights from the light group and store their current RGB values in variables.
Change all selected lights to a specific color if specified by color.
After 0.5 seconds, restore the lights to their initial state based on the stored RGB values.
Step 3: Announcements
If a message is provided (message), broadcast it using TTS (text-to-speech) across various media players.
Step 4: Music Assistant Announcements
If broadcast_url is present, play an announcement URL on specified media players using the music assistant service.
Step 5: Notifications
Send notifications to selected phones if phone_data is provided.
Step 6: TVs
If no party mode or kink party mode is active:
Broadcast image or URL to paused chromecast devices.
Pause playing chromecasts.
Description: This script broadcasts important alerts in the house by controlling lights, making announcements, sending notifications, and handling TV displays. It's designed for critical communication within the household.

2. change_received_lights_to_random_colors
Step 1: Identify Lights
Extract light entities from a selected group.
Step 2: Repeat to Change Colors
For each light in the identified list, set it to a random color using an HS (hue-saturation) value.
Description: This script changes all lights within a specific group to randomly generated colors.
3. start_visual_playlist_on_plex
Step 1: Identify Chromecasts
Retrieve all chromecast devices.
Step 2: Repeat for Each Device
If the chromecast is off and not in an occupied area:
Set its state to playing a specified Plex playlist with shuffle enabled.
Mute the device after starting playback.
Description: This script starts visual playlists on all unoccupied chromecasts, ensuring they play music or visuals from a specified library with automatic muting if no one is around.

4. non_important_broadcast_alert_in_the_house
Step 1: Store ON Lights in variables
Collect the current state and RGB values of lights that are currently on.
Step 2: Lights
If a color is specified, change all selected lights to this color temporarily.
Restore the initial states after a short delay.
Step 3: Announcements
Make announcements using TTS if a message is provided.
Step 4: TVs
Broadcast an image or URL to paused TV devices.
Description: This script handles less critical alerts by making announcements, broadcasting images/URLs on TVs, and temporarily changing light colors. It's designed for general communication within the household but not as urgent as broadcast_alert_in_the_house.

5. changes_received_lights_to_random_colors
Step 1: Identify Lights
Extract all lights from a specific group.
Step 2: Repeat to Change Colors
Set each light's color randomly using HS values.
Description: This script changes the colors of selected lights to random hues and saturations, adding visual diversity within the house.

6. start_visual_playlist_on_plex
Step 1: Identify Chromecasts
Retrieve all chromecast devices.
Step 2: Repeat for Each Device
For each device:
Check if it's off and not in an active room.
Play a specified playlist with visual effects from Plex.
Description: This script starts predefined visual playlists on unoccupied chromecasts, enhancing the ambiance of an event or activity.

7. changes_all_on_lights_to_random_colors
Step 1: Identify All On Lights
Gather all lights that are currently turned on.
Step 2: Repeat to Change Colors
Set each light's color randomly using HS values.
Description: This script changes the colors of all active lights in the house to random hues, adding a dynamic visual effect suitable for various scenarios like parties or celebrations.

8. changes_all_on_lights_to_random_pastel_colors
Step 1: Identify All On Inside Lights
Gather all inside lights that are currently turned on.
Step 2: Repeat to Change Colors
Set each light's color randomly using pastel HS values.
Description: This script changes the colors of active interior lights to random pastel hues, creating a softer and more calming visual environment.

9. generate_and_save_localai_image
Step 1: Generate Image with LocalAI
Use the specified prompt to generate an image through REST command.
Step 2: Download Generated Image
Save the generated image locally using a downloader service.
Description: This script generates and saves images according to provided prompts, using LocalAI for rendering. It's useful for creating custom visuals based on descriptions or requests.

10. generate_and_save_sd_image
Step 1: Generate Session ID with Stability AI
Request a session ID from the Stability AI API.
Step 2: Download Generated Image
Use the generated image URL to download and save it locally.
Description: This script generates and saves images using the Stability AI API, allowing for high-quality visual content creation based on prompts or descriptions.

11. changes_all_on_lights_to_warm_colors
Step 1: Identify All On Inside Lights
Gather all inside lights that are currently turned on.
Step 2: Repeat to Set Colors
Set each light's color to a warm hue using HS values.
Description: This script changes the colors of active interior lights to warm hues, creating a cozy and inviting atmosphere suitable for gatherings or relaxation.

12. changes_all_on_lights_to_warm_pale_colors
Step 1: Identify All On Inside Lights
Gather all inside lights that are currently turned on.
Step 2: Repeat to Set Colors
Set each light's color to a warm but paler hue using HS values.
Description: This script changes the colors of active interior lights to warmer, less intense hues, providing a softer and more relaxed ambiance.

13. generate_fake_white_colors
Step 1: Identify Active Lights
Gather all lights that are currently turned on and have defined RGB colors.
Step 2: Repeat to Set Colors
Set each light's color randomly using HS values to simulate white light.
Description: This script changes the colors of active lights to random hues that approximate white, creating a subtle visual effect useful for simulating natural lighting conditions.

14. in_home_defense_script
Step 1: Turn Off Automation
Stop automation scripts related to volume adjustments and speaker management.
Step 2: Activate Hubs
Turn on security horn devices located at the front and back doors.
Step 3: Start Siren
Play a siren sound across various media players in the house.
Step 4: Adjust Volume Levels
Increase volume levels of all relevant speakers to ensure maximum alertness.
Step 5: Notify Users
Send an urgent notification with a detailed security message and actions to take.
Step 6: Wait for Home Occupancy Status Change
Continue the sequence until home occupancy status changes or timeout occurs.
Step 7: Stop Siren When Vacated
Stop playing the siren sound once home is vacated.
Description: This script activates a full-scale security response in case of an intruder alert, ensuring maximum visibility and audibility through lights, sounds, notifications, and active speaker management. It's designed to handle critical security situations effectively.

15. inside_only_home_defense_script
Step 1: Turn Off Automation
Stop automation scripts related to volume adjustments.
Step 2: Start Siren
Play a siren sound across various media players inside the house.
Step 3: Adjust Volume Levels
Increase volume levels of all relevant speakers to ensure maximum alertness.
Step 4: Wait for Home Occupancy Status Change
Continue playing the siren until home occupancy status changes or timeout occurs.
Step 5: Stop Siren When Vacated
Stop playing the siren sound once home is vacated.
Description: This script activates a security response specifically inside the house, ensuring maximum alertness through sounds without affecting external areas. It's designed to handle internal security situations effectively while minimizing disturbance outside the premises.

16. start_plex_media_on_requested_player
Step 1: Identify Chromecasts
Retrieve all chromecast devices.
Step 2: Repeat for Each Device
For each device:
Check if it's off and not in an active room.
Play a specified playlist.
Description: This script starts a requested Plex media playlist on unoccupied chromecasts, ensuring that music or videos play as needed without disrupting occupied rooms. It’s useful for setting the mood with specific content in areas where no one is present.

17. set_whole_house_to_cozy_ambiance
Step 1: Set Fireplace Effect
Turn on fireplace effect for all Hue lights.
Step 2: Candle Lights Effects
Activate candle flame effects on selected wall lights.
Step 3: Patio and Office Decorative Lamp Effects
Create a soft, breathing ambiance with specific kelvin temperatures for patio and office decorative lamps.
Step 4: Start Visual Playlist
Play a visual playlist named "Fireplace Visuals" across all TVs.
Description: This script sets the whole house to a cozy ambiance by activating fireplace and candle effects on lights and playing specific visual content on TVs. It’s designed for cr...
***
Content cut off. Read original on https://old.reddit.com/r/homeassistant/comments/1j3mpca/here_are_35_of_my_ha_scripts_along_their_code/
no comments (yet)
sorted by: hot top controversial new old
there doesn't seem to be anything here