2347 lines
81 KiB
YAML
2347 lines
81 KiB
YAML
# scripts.yaml - PART 1: Original Scripts
|
|
# Paste this as the beginning of your scripts.yaml file
|
|
|
|
# Original existing scripts
|
|
log_and_complete_chore:
|
|
alias: Log and Complete Chore
|
|
sequence:
|
|
- choose:
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: input_select.person_selection
|
|
state: Lou
|
|
sequence:
|
|
- target:
|
|
entity_id: counter.chores_completed_lou
|
|
action: counter.increment
|
|
data: {}
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: input_select.person_selection
|
|
state: Jess
|
|
sequence:
|
|
- target:
|
|
entity_id: counter.chores_completed_jess
|
|
action: counter.increment
|
|
data: {}
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: input_select.person_selection
|
|
state: William
|
|
sequence:
|
|
- target:
|
|
entity_id: counter.chores_completed_william
|
|
action: counter.increment
|
|
data: {}
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: input_select.person_selection
|
|
state: Xander
|
|
sequence:
|
|
- target:
|
|
entity_id: counter.chores_completed_xander
|
|
action: counter.increment
|
|
data: {}
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: input_select.person_selection
|
|
state: Bella
|
|
sequence:
|
|
- target:
|
|
entity_id: counter.chores_completed_bella
|
|
action: counter.increment
|
|
data: {}
|
|
- action: notify.send_message
|
|
metadata: {}
|
|
data:
|
|
title: Chore
|
|
message: ">- {{ states('input_select.person_selection') }} completed {{ states('input_select.chore_selection') }} on {{ now().strftime('%Y-%m-%d %H:%M:%S') }}"
|
|
target:
|
|
entity_id: notify.chore_log_bog
|
|
- action: notify.persistent_notification
|
|
data:
|
|
title: Chores
|
|
message: "{{ states('input_select.person_selection') }} completed {{ states('input_select.chore_selection') }} on {{ now().strftime('%Y-%m-%d %H:%M:%S') }}"
|
|
enabled: false
|
|
- data:
|
|
entity_id: input_select.person_selection
|
|
option: Select Person
|
|
action: input_select.select_option
|
|
- data:
|
|
entity_id: input_select.chore_selection
|
|
option: Select Chore
|
|
action: input_select.select_option
|
|
- action: python_script.parse_chore_log
|
|
metadata: {}
|
|
data: {}
|
|
enabled: false
|
|
|
|
testcast2:
|
|
alias: TestCast2
|
|
sequence:
|
|
- action: dash_cast.load_url
|
|
metadata: {}
|
|
data:
|
|
reload_seconds: 300
|
|
entity_id: media_player.nesthub51f9
|
|
url: https://www.ebay.com.au/
|
|
force: false
|
|
description: ""
|
|
|
|
chorereset:
|
|
alias: ChoreReset
|
|
sequence:
|
|
- data:
|
|
entity_id: input_select.chore_selection
|
|
option: Select Chore
|
|
action: input_select.select_option
|
|
description: ""
|
|
|
|
weekly_chore_summary:
|
|
alias: New Chore Summary
|
|
sequence:
|
|
- action: conversation.process
|
|
metadata: {}
|
|
data:
|
|
prompt: |2-
|
|
Summarize the chores done in the sensor.chore_log_bog between {{ now().strftime('%Y-%m-%d') }} and {{ (now() - timedelta(days=7)).strftime('%Y-%m-%d') }}. Group chores by person and provide a concise summary for each individual.
|
|
chore_log_data: "{{ chore_log_entries }}"
|
|
response_variable: generated_chore_content
|
|
- service: input_text.set_value
|
|
data:
|
|
entity_id: input_text.chore_summary
|
|
value: "{{ generated_chore_content }}"
|
|
|
|
encouraging_prompt:
|
|
alias: Encouraging Prompt
|
|
sequence:
|
|
- service: google_cloud_platform.generate_text
|
|
data:
|
|
model: text-davinci-003
|
|
project_id: your_gcp_project_id
|
|
api_key: !secret google_cloud_platform_api_key
|
|
temperature: 0.5
|
|
max_tokens: 50
|
|
prompt: "Generate a short encouraging message for someone who is doing chores. The message should be positive and uplifting."
|
|
- service: notify.your_notification_method
|
|
data:
|
|
message: "{{ result.text }}"
|
|
|
|
log_task_completion:
|
|
alias: "Log Task Completion"
|
|
fields:
|
|
task:
|
|
description: "The task that was completed"
|
|
example: "Dishwasher Unload"
|
|
person:
|
|
description: "The person who completed the task"
|
|
example: "Jess"
|
|
sequence:
|
|
- action: notify.chore_log_bog
|
|
data:
|
|
message: ">- {{ person }} completed {{ task }} on {{ now().strftime('%Y-%m-%d %H:%M:%S') }}"
|
|
|
|
# scripts.yaml - PART 3 FIXED: Main Task System with correct notification service
|
|
# Replace Part 3 with this corrected version
|
|
|
|
## NEW COMPLETE TASK SCRIPT - RELIABLE RECORDING SYSTEM
|
|
# Replace your entire complete_task script with this version
|
|
|
|
complete_task:
|
|
alias: Complete Task
|
|
description: Mark a task as complete and log who did it with reliable recording
|
|
fields:
|
|
task_type:
|
|
description: The type of task being completed
|
|
example: "Dishwasher Unload"
|
|
family_member:
|
|
description: Who completed the task
|
|
example: "Jess"
|
|
sequence:
|
|
# Step 1: Record the chore completion in multiple ways for reliability
|
|
- action: input_text.set_value
|
|
target:
|
|
entity_id: input_text.master_chore_log
|
|
data:
|
|
value: "{{ now().strftime('%Y-%m-%d %H:%M:%S') }} - {{ family_member }} completed {{ task_type }}"
|
|
|
|
# Step 2: Update individual person's last chore
|
|
- action: input_text.set_value
|
|
target:
|
|
entity_id: >
|
|
{% if family_member == 'Lou' %}input_text.last_chore_lou
|
|
{% elif family_member == 'Jess' %}input_text.last_chore_jess
|
|
{% elif family_member == 'William' %}input_text.last_chore_william
|
|
{% elif family_member == 'Xander' %}input_text.last_chore_xander
|
|
{% elif family_member == 'Bella' %}input_text.last_chore_bella
|
|
{% endif %}
|
|
data:
|
|
value: "{{ task_type }}"
|
|
|
|
# Step 3: Update timestamp for individual person
|
|
- action: input_text.set_value
|
|
target:
|
|
entity_id: >
|
|
{% if family_member == 'Lou' %}input_text.last_chore_lou_timestamp
|
|
{% elif family_member == 'Jess' %}input_text.last_chore_jess_timestamp
|
|
{% elif family_member == 'William' %}input_text.last_chore_william_timestamp
|
|
{% elif family_member == 'Xander' %}input_text.last_chore_xander_timestamp
|
|
{% elif family_member == 'Bella' %}input_text.last_chore_bella_timestamp
|
|
{% endif %}
|
|
data:
|
|
value: "{{ now().strftime('%Y-%m-%d %H:%M:%S') }}"
|
|
|
|
# Step 4: Increment weekly counter
|
|
- action: counter.increment
|
|
target:
|
|
entity_id: >
|
|
{% if family_member == 'Lou' %}counter.chores_completed_lou
|
|
{% elif family_member == 'Jess' %}counter.chores_completed_jess
|
|
{% elif family_member == 'William' %}counter.chores_completed_william
|
|
{% elif family_member == 'Xander' %}counter.chores_completed_xander
|
|
{% elif family_member == 'Bella' %}counter.chores_completed_bella
|
|
{% endif %}
|
|
|
|
# Step 5: Handle task-specific logic
|
|
- choose:
|
|
# Dishwasher Unload
|
|
- conditions:
|
|
- condition: template
|
|
value_template: "{{ task_type == 'Dishwasher Unload' }}"
|
|
sequence:
|
|
- action: input_boolean.turn_off
|
|
target:
|
|
entity_id: input_boolean.task_dishwasher_unload_pending
|
|
|
|
# Washing Machine Unload
|
|
- conditions:
|
|
- condition: template
|
|
value_template: "{{ task_type == 'Washing Machine Unload' }}"
|
|
sequence:
|
|
- action: input_boolean.turn_off
|
|
target:
|
|
entity_id: input_boolean.task_washing_machine_unload_pending
|
|
|
|
# Dryer Unload
|
|
- conditions:
|
|
- condition: template
|
|
value_template: "{{ task_type == 'Dryer Unload' }}"
|
|
sequence:
|
|
- action: input_boolean.turn_off
|
|
target:
|
|
entity_id: input_boolean.task_dryer_unload_pending
|
|
|
|
# Bins Out
|
|
- conditions:
|
|
- condition: template
|
|
value_template: "{{ task_type == 'Bins Out' }}"
|
|
sequence:
|
|
- action: input_boolean.turn_off
|
|
target:
|
|
entity_id: input_boolean.task_bins_out_pending
|
|
|
|
# Bins In
|
|
- conditions:
|
|
- condition: template
|
|
value_template: "{{ task_type == 'Bins In' }}"
|
|
sequence:
|
|
- action: input_boolean.turn_off
|
|
target:
|
|
entity_id: input_boolean.task_bins_in_pending
|
|
|
|
# Kitty Litter Clean
|
|
- conditions:
|
|
- condition: template
|
|
value_template: "{{ task_type == 'Kitty Litter Clean' }}"
|
|
sequence:
|
|
- action: input_boolean.turn_off
|
|
target:
|
|
entity_id: input_boolean.task_kitty_litter_clean_pending
|
|
- action: input_boolean.turn_on
|
|
target:
|
|
entity_id: input_boolean.task_kitty_litter_clean_done_today
|
|
|
|
# Kitty Litter Change
|
|
- conditions:
|
|
- condition: template
|
|
value_template: "{{ task_type == 'Kitty Litter Change' }}"
|
|
sequence:
|
|
- action: input_boolean.turn_off
|
|
target:
|
|
entity_id: input_boolean.task_kitty_litter_change_pending
|
|
- action: input_boolean.turn_on
|
|
target:
|
|
entity_id: input_boolean.task_kitty_litter_change_done_fortnight
|
|
|
|
# Personal Clothes Tasks
|
|
- conditions:
|
|
- condition: template
|
|
value_template: "{{ task_type == 'Bella - Clothes to Laundry' }}"
|
|
sequence:
|
|
- action: input_boolean.turn_off
|
|
target:
|
|
entity_id: input_boolean.task_bella_clothes_to_laundry_pending
|
|
- action: input_boolean.turn_on
|
|
target:
|
|
entity_id: input_boolean.task_bella_clothes_done_today
|
|
|
|
- conditions:
|
|
- condition: template
|
|
value_template: "{{ task_type == 'Xander - Clothes to Laundry' }}"
|
|
sequence:
|
|
- action: input_boolean.turn_off
|
|
target:
|
|
entity_id: input_boolean.task_xander_clothes_to_laundry_pending
|
|
- action: input_boolean.turn_on
|
|
target:
|
|
entity_id: input_boolean.task_xander_clothes_done_today
|
|
|
|
- conditions:
|
|
- condition: template
|
|
value_template: "{{ task_type == 'William - Clothes to Laundry' }}"
|
|
sequence:
|
|
- action: input_boolean.turn_off
|
|
target:
|
|
entity_id: input_boolean.task_william_clothes_to_laundry_pending
|
|
- action: input_boolean.turn_on
|
|
target:
|
|
entity_id: input_boolean.task_william_clothes_done_today
|
|
|
|
# School Preparation Tasks
|
|
- conditions:
|
|
- condition: template
|
|
value_template: "{{ task_type == 'William - School Ready' }}"
|
|
sequence:
|
|
- action: input_boolean.turn_off
|
|
target:
|
|
entity_id: input_boolean.task_william_school_ready_pending
|
|
|
|
- conditions:
|
|
- condition: template
|
|
value_template: "{{ task_type == 'Xander - School Ready' }}"
|
|
sequence:
|
|
- action: input_boolean.turn_off
|
|
target:
|
|
entity_id: input_boolean.task_xander_school_ready_pending
|
|
|
|
- conditions:
|
|
- condition: template
|
|
value_template: "{{ task_type == 'Bella - School Ready' }}"
|
|
sequence:
|
|
- action: input_boolean.turn_off
|
|
target:
|
|
entity_id: input_boolean.task_bella_school_ready_pending
|
|
|
|
# Pet Care Tasks
|
|
- conditions:
|
|
- condition: template
|
|
value_template: "{{ task_type == 'Feed Chips' }}"
|
|
sequence:
|
|
- action: input_boolean.turn_off
|
|
target:
|
|
entity_id: input_boolean.task_feed_chips_pending
|
|
- action: input_boolean.turn_on
|
|
target:
|
|
entity_id: input_boolean.task_feed_chips_done_today
|
|
|
|
- conditions:
|
|
- condition: template
|
|
value_template: "{{ task_type == 'Feed Harper' }}"
|
|
sequence:
|
|
- action: input_boolean.turn_off
|
|
target:
|
|
entity_id: input_boolean.task_feed_harper_pending
|
|
- action: input_boolean.turn_on
|
|
target:
|
|
entity_id: input_boolean.task_feed_harper_done_today
|
|
|
|
- conditions:
|
|
- condition: template
|
|
value_template: "{{ task_type == 'Water Chips' }}"
|
|
sequence:
|
|
- action: input_boolean.turn_off
|
|
target:
|
|
entity_id: input_boolean.task_water_chips_pending
|
|
- action: input_boolean.turn_on
|
|
target:
|
|
entity_id: input_boolean.task_water_chips_done_today
|
|
|
|
- conditions:
|
|
- condition: template
|
|
value_template: "{{ task_type == 'Water Harper' }}"
|
|
sequence:
|
|
- action: input_boolean.turn_off
|
|
target:
|
|
entity_id: input_boolean.task_water_harper_pending
|
|
- action: input_boolean.turn_on
|
|
target:
|
|
entity_id: input_boolean.task_water_harper_done_today
|
|
|
|
# Daily Cleaning Tasks
|
|
- conditions:
|
|
- condition: template
|
|
value_template: "{{ task_type == 'Handwash Dishes' }}"
|
|
sequence:
|
|
- action: input_boolean.turn_off
|
|
target:
|
|
entity_id: input_boolean.task_handwash_dishes_pending
|
|
- action: input_boolean.turn_on
|
|
target:
|
|
entity_id: input_boolean.task_handwash_dishes_done_today
|
|
|
|
- conditions:
|
|
- condition: template
|
|
value_template: "{{ task_type == 'Tidy Kitchen' }}"
|
|
sequence:
|
|
- action: input_boolean.turn_off
|
|
target:
|
|
entity_id: input_boolean.task_tidy_kitchen_pending
|
|
- action: input_boolean.turn_on
|
|
target:
|
|
entity_id: input_boolean.task_tidy_kitchen_done_today
|
|
|
|
# Karate Preparation Tasks
|
|
- conditions:
|
|
- condition: template
|
|
value_template: "{{ task_type == 'Xander - Karate Ready' }}"
|
|
sequence:
|
|
- action: input_boolean.turn_off
|
|
target:
|
|
entity_id: input_boolean.task_xander_karate_ready_pending
|
|
|
|
- conditions:
|
|
- condition: template
|
|
value_template: "{{ task_type == 'Bella - Karate Ready' }}"
|
|
sequence:
|
|
- action: input_boolean.turn_off
|
|
target:
|
|
entity_id: input_boolean.task_bella_karate_ready_pending
|
|
|
|
# Step 6: Send notifications
|
|
- action: notify.homeassistantcomms
|
|
data:
|
|
message: "✅ {{ family_member }} completed: {{ task_type }}"
|
|
target: '696581219445637171'
|
|
|
|
- action: notify.mobile_app_jess_iphone
|
|
data:
|
|
message: "✅ {{ family_member }} completed {{ task_type }}"
|
|
title: "Task Completed"
|
|
mode: single
|
|
|
|
# scripts.yaml - PART 4: Basic Completion Scripts
|
|
# Paste this after Part 3
|
|
|
|
# SIMPLE TASK COMPLETION SCRIPTS
|
|
# Replace all your individual completion scripts with these clean, simple versions
|
|
|
|
# Appliance Tasks
|
|
complete_bins_out:
|
|
alias: Complete Bins Out
|
|
sequence:
|
|
- action: script.complete_task
|
|
data:
|
|
task_type: "Bins Out"
|
|
family_member: "{{ states('input_select.family_member_selection') }}"
|
|
|
|
complete_bins_in:
|
|
alias: Complete Bins In
|
|
sequence:
|
|
- action: script.complete_task
|
|
data:
|
|
task_type: "Bins In"
|
|
family_member: "{{ states('input_select.family_member_selection') }}"
|
|
|
|
# Kitty Litter Tasks
|
|
complete_kitty_litter_clean:
|
|
alias: Complete Kitty Litter Clean
|
|
sequence:
|
|
- action: script.complete_task
|
|
data:
|
|
task_type: "Kitty Litter Clean"
|
|
family_member: "{{ states('input_select.family_member_selection') }}"
|
|
|
|
complete_kitty_litter_change:
|
|
alias: Complete Kitty Litter Change
|
|
sequence:
|
|
- action: script.complete_task
|
|
data:
|
|
task_type: "Kitty Litter Change"
|
|
family_member: "{{ states('input_select.family_member_selection') }}"
|
|
|
|
# Personal Clothes Tasks
|
|
complete_bella_clothes:
|
|
alias: Complete Bella Clothes
|
|
sequence:
|
|
- action: script.complete_task
|
|
data:
|
|
task_type: "Bella - Clothes to Laundry"
|
|
family_member: "Bella"
|
|
|
|
complete_xander_clothes:
|
|
alias: Complete Xander Clothes
|
|
sequence:
|
|
- action: script.complete_task
|
|
data:
|
|
task_type: "Xander - Clothes to Laundry"
|
|
family_member: "Xander"
|
|
|
|
complete_william_clothes:
|
|
alias: Complete William Clothes
|
|
sequence:
|
|
- action: script.complete_task
|
|
data:
|
|
task_type: "William - Clothes to Laundry"
|
|
family_member: "William"
|
|
|
|
# School Tasks
|
|
complete_william_school_ready:
|
|
alias: Complete William School Ready
|
|
sequence:
|
|
- action: script.complete_task
|
|
data:
|
|
task_type: "William - School Ready"
|
|
family_member: "William"
|
|
|
|
complete_xander_school_ready:
|
|
alias: Complete Xander School Ready
|
|
sequence:
|
|
- action: script.complete_task
|
|
data:
|
|
task_type: "Xander - School Ready"
|
|
family_member: "Xander"
|
|
|
|
complete_bella_school_ready:
|
|
alias: Complete Bella School Ready
|
|
sequence:
|
|
- action: script.complete_task
|
|
data:
|
|
task_type: "Bella - School Ready"
|
|
family_member: "Bella"
|
|
|
|
# Pet Care Tasks
|
|
complete_feed_chips:
|
|
alias: Complete Feed Chips
|
|
sequence:
|
|
- action: script.complete_task
|
|
data:
|
|
task_type: "Feed Chips"
|
|
family_member: "{{ states('input_select.family_member_selection') }}"
|
|
|
|
complete_feed_harper:
|
|
alias: Complete Feed Harper
|
|
sequence:
|
|
- action: script.complete_task
|
|
data:
|
|
task_type: "Feed Harper"
|
|
family_member: "{{ states('input_select.family_member_selection') }}"
|
|
|
|
complete_water_chips:
|
|
alias: Complete Water Chips
|
|
sequence:
|
|
- action: script.complete_task
|
|
data:
|
|
task_type: "Water Chips"
|
|
family_member: "{{ states('input_select.family_member_selection') }}"
|
|
|
|
complete_water_harper:
|
|
alias: Complete Water Harper
|
|
sequence:
|
|
- action: script.complete_task
|
|
data:
|
|
task_type: "Water Harper"
|
|
family_member: "{{ states('input_select.family_member_selection') }}"
|
|
|
|
# Daily Cleaning Tasks
|
|
complete_handwash_dishes:
|
|
alias: Complete Handwash Dishes
|
|
sequence:
|
|
- action: script.complete_task
|
|
data:
|
|
task_type: "Handwash Dishes"
|
|
family_member: "{{ states('input_select.family_member_selection') }}"
|
|
|
|
complete_tidy_kitchen:
|
|
alias: Complete Tidy Kitchen
|
|
sequence:
|
|
- action: script.complete_task
|
|
data:
|
|
task_type: "Tidy Kitchen"
|
|
family_member: "{{ states('input_select.family_member_selection') }}"
|
|
|
|
# Karate Tasks
|
|
complete_xander_karate_ready:
|
|
alias: Complete Xander Karate Ready
|
|
sequence:
|
|
- action: script.complete_task
|
|
data:
|
|
task_type: "Xander - Karate Ready"
|
|
family_member: "Xander"
|
|
|
|
complete_bella_karate_ready:
|
|
alias: Complete Bella Karate Ready
|
|
sequence:
|
|
- action: script.complete_task
|
|
data:
|
|
task_type: "Bella - Karate Ready"
|
|
family_member: "Bella"
|
|
|
|
# scripts.yaml - PART 5 CORRECTED: Individual Task Scripts
|
|
# Add this to your scripts.yaml file after the complete_task script
|
|
|
|
complete_clean_dining_table:
|
|
alias: Complete Clean Dining Table
|
|
sequence:
|
|
- action: script.complete_task
|
|
data:
|
|
task_type: "Clean Dining Table"
|
|
family_member: "{{ states('input_select.family_member_selection') }}"
|
|
|
|
# Shared Task Scripts
|
|
# Updated task completion scripts with "Select Person" prevention
|
|
# Replace your existing scripts with these versions
|
|
|
|
complete_dishwasher_unload:
|
|
alias: Complete Dishwasher Unload
|
|
sequence:
|
|
# Check if a valid person is selected
|
|
- condition: not
|
|
conditions:
|
|
- condition: state
|
|
entity_id: input_select.family_member_selection
|
|
state: 'Select Person'
|
|
- action: input_boolean.turn_off
|
|
entity_id: input_boolean.task_dishwasher_unload_pending
|
|
- choose:
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: input_select.family_member_selection
|
|
state: Lou
|
|
sequence:
|
|
- action: counter.increment
|
|
entity_id: counter.chores_completed_lou
|
|
- action: input_text.set_value
|
|
entity_id: input_text.last_chore_lou
|
|
data:
|
|
value: "Dishwasher Unload - {{ now().strftime('%H:%M') }}"
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: input_select.family_member_selection
|
|
state: Jess
|
|
sequence:
|
|
- action: counter.increment
|
|
entity_id: counter.chores_completed_jess
|
|
- action: input_text.set_value
|
|
entity_id: input_text.last_chore_jess
|
|
data:
|
|
value: "Dishwasher Unload - {{ now().strftime('%H:%M') }}"
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: input_select.family_member_selection
|
|
state: William
|
|
sequence:
|
|
- action: counter.increment
|
|
entity_id: counter.chores_completed_william
|
|
- action: input_text.set_value
|
|
entity_id: input_text.last_chore_william
|
|
data:
|
|
value: "Dishwasher Unload - {{ now().strftime('%H:%M') }}"
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: input_select.family_member_selection
|
|
state: Xander
|
|
sequence:
|
|
- action: counter.increment
|
|
entity_id: counter.chores_completed_xander
|
|
- action: input_text.set_value
|
|
entity_id: input_text.last_chore_xander
|
|
data:
|
|
value: "Dishwasher Unload - {{ now().strftime('%H:%M') }}"
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: input_select.family_member_selection
|
|
state: Bella
|
|
sequence:
|
|
- action: counter.increment
|
|
entity_id: counter.chores_completed_bella
|
|
- action: input_text.set_value
|
|
entity_id: input_text.last_chore_bella
|
|
data:
|
|
value: "Dishwasher Unload - {{ now().strftime('%H:%M') }}"
|
|
- action: notify.homeassistantcomms
|
|
data:
|
|
message: "✅ {{ states('input_select.family_member_selection') }} unloaded the dishwasher!"
|
|
target: '267249171017367552'
|
|
- action: input_text.set_value
|
|
entity_id: input_text.master_chore_log
|
|
data:
|
|
value: "{{ now().strftime('%Y-%m-%d %H:%M:%S') }} - {{ states('input_select.family_member_selection') }} completed Dishwasher Unload"
|
|
- action: notify.chorelog
|
|
data:
|
|
message: "{{ now().strftime('%Y-%m-%d %H:%M:%S') }},{{ states('input_select.family_member_selection') }},Dishwasher Unload"
|
|
mode: single
|
|
|
|
complete_washing_machine_unload:
|
|
alias: Complete Washing Machine Unload
|
|
sequence:
|
|
- condition: not
|
|
conditions:
|
|
- condition: state
|
|
entity_id: input_select.family_member_selection
|
|
state: 'Select Person'
|
|
- action: input_boolean.turn_off
|
|
entity_id: input_boolean.task_washing_machine_unload_pending
|
|
- choose:
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: input_select.family_member_selection
|
|
state: Lou
|
|
sequence:
|
|
- action: counter.increment
|
|
entity_id: counter.chores_completed_lou
|
|
- action: input_text.set_value
|
|
entity_id: input_text.last_chore_lou
|
|
data:
|
|
value: "Washing Machine Unload - {{ now().strftime('%H:%M') }}"
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: input_select.family_member_selection
|
|
state: Jess
|
|
sequence:
|
|
- action: counter.increment
|
|
entity_id: counter.chores_completed_jess
|
|
- action: input_text.set_value
|
|
entity_id: input_text.last_chore_jess
|
|
data:
|
|
value: "Washing Machine Unload - {{ now().strftime('%H:%M') }}"
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: input_select.family_member_selection
|
|
state: William
|
|
sequence:
|
|
- action: counter.increment
|
|
entity_id: counter.chores_completed_william
|
|
- action: input_text.set_value
|
|
entity_id: input_text.last_chore_william
|
|
data:
|
|
value: "Washing Machine Unload - {{ now().strftime('%H:%M') }}"
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: input_select.family_member_selection
|
|
state: Xander
|
|
sequence:
|
|
- action: counter.increment
|
|
entity_id: counter.chores_completed_xander
|
|
- action: input_text.set_value
|
|
entity_id: input_text.last_chore_xander
|
|
data:
|
|
value: "Washing Machine Unload - {{ now().strftime('%H:%M') }}"
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: input_select.family_member_selection
|
|
state: Bella
|
|
sequence:
|
|
- action: counter.increment
|
|
entity_id: counter.chores_completed_bella
|
|
- action: input_text.set_value
|
|
entity_id: input_text.last_chore_bella
|
|
data:
|
|
value: "Washing Machine Unload - {{ now().strftime('%H:%M') }}"
|
|
- action: notify.homeassistantcomms
|
|
data:
|
|
message: "✅ {{ states('input_select.family_member_selection') }} unloaded the washing machine!"
|
|
target: '267249171017367552'
|
|
- action: input_text.set_value
|
|
entity_id: input_text.master_chore_log
|
|
data:
|
|
value: "{{ now().strftime('%Y-%m-%d %H:%M:%S') }} - {{ states('input_select.family_member_selection') }} completed Washing Machine Unload"
|
|
- action: notify.chorelog
|
|
data:
|
|
message: "{{ now().strftime('%Y-%m-%d %H:%M:%S') }},{{ states('input_select.family_member_selection') }},Washing Machine Unload"
|
|
mode: single
|
|
|
|
complete_dryer_unload:
|
|
alias: Complete Dryer Unload
|
|
sequence:
|
|
- condition: not
|
|
conditions:
|
|
- condition: state
|
|
entity_id: input_select.family_member_selection
|
|
state: 'Select Person'
|
|
- action: input_boolean.turn_off
|
|
entity_id: input_boolean.task_dryer_unload_pending
|
|
- choose:
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: input_select.family_member_selection
|
|
state: Lou
|
|
sequence:
|
|
- action: counter.increment
|
|
entity_id: counter.chores_completed_lou
|
|
- action: input_text.set_value
|
|
entity_id: input_text.last_chore_lou
|
|
data:
|
|
value: "Dryer Unload - {{ now().strftime('%H:%M') }}"
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: input_select.family_member_selection
|
|
state: Jess
|
|
sequence:
|
|
- action: counter.increment
|
|
entity_id: counter.chores_completed_jess
|
|
- action: input_text.set_value
|
|
entity_id: input_text.last_chore_jess
|
|
data:
|
|
value: "Dryer Unload - {{ now().strftime('%H:%M') }}"
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: input_select.family_member_selection
|
|
state: William
|
|
sequence:
|
|
- action: counter.increment
|
|
entity_id: counter.chores_completed_william
|
|
- action: input_text.set_value
|
|
entity_id: input_text.last_chore_william
|
|
data:
|
|
value: "Dryer Unload - {{ now().strftime('%H:%M') }}"
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: input_select.family_member_selection
|
|
state: Xander
|
|
sequence:
|
|
- action: counter.increment
|
|
entity_id: counter.chores_completed_xander
|
|
- action: input_text.set_value
|
|
entity_id: input_text.last_chore_xander
|
|
data:
|
|
value: "Dryer Unload - {{ now().strftime('%H:%M') }}"
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: input_select.family_member_selection
|
|
state: Bella
|
|
sequence:
|
|
- action: counter.increment
|
|
entity_id: counter.chores_completed_bella
|
|
- action: input_text.set_value
|
|
entity_id: input_text.last_chore_bella
|
|
data:
|
|
value: "Dryer Unload - {{ now().strftime('%H:%M') }}"
|
|
- action: notify.homeassistantcomms
|
|
data:
|
|
message: "✅ {{ states('input_select.family_member_selection') }} unloaded the dryer!"
|
|
target: '267249171017367552'
|
|
- action: input_text.set_value
|
|
entity_id: input_text.master_chore_log
|
|
data:
|
|
value: "{{ now().strftime('%Y-%m-%d %H:%M:%S') }} - {{ states('input_select.family_member_selection') }} completed Dryer Unload"
|
|
- action: notify.chorelog
|
|
data:
|
|
message: "{{ now().strftime('%Y-%m-%d %H:%M:%S') }},{{ states('input_select.family_member_selection') }},Dryer Unload"
|
|
mode: single
|
|
|
|
# Add these scripts to your scripts.yaml file
|
|
|
|
complete_dishwasher_load:
|
|
alias: Complete Dishwasher Load
|
|
sequence:
|
|
- action: input_boolean.turn_off
|
|
entity_id: input_boolean.task_dishwasher_load_pending
|
|
- choose:
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: input_select.family_member_selection
|
|
state: Lou
|
|
sequence:
|
|
- action: counter.increment
|
|
entity_id: counter.chores_completed_lou
|
|
- action: input_text.set_value
|
|
entity_id: input_text.last_chore_lou
|
|
data:
|
|
value: "Load Dishwasher - {{ now().strftime('%H:%M') }}"
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: input_select.family_member_selection
|
|
state: Jess
|
|
sequence:
|
|
- action: counter.increment
|
|
entity_id: counter.chores_completed_jess
|
|
- action: input_text.set_value
|
|
entity_id: input_text.last_chore_jess
|
|
data:
|
|
value: "Load Dishwasher - {{ now().strftime('%H:%M') }}"
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: input_select.family_member_selection
|
|
state: William
|
|
sequence:
|
|
- action: counter.increment
|
|
entity_id: counter.chores_completed_william
|
|
- action: input_text.set_value
|
|
entity_id: input_text.last_chore_william
|
|
data:
|
|
value: "Load Dishwasher - {{ now().strftime('%H:%M') }}"
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: input_select.family_member_selection
|
|
state: Xander
|
|
sequence:
|
|
- action: counter.increment
|
|
entity_id: counter.chores_completed_xander
|
|
- action: input_text.set_value
|
|
entity_id: input_text.last_chore_xander
|
|
data:
|
|
value: "Load Dishwasher - {{ now().strftime('%H:%M') }}"
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: input_select.family_member_selection
|
|
state: Bella
|
|
sequence:
|
|
- action: counter.increment
|
|
entity_id: counter.chores_completed_bella
|
|
- action: input_text.set_value
|
|
entity_id: input_text.last_chore_bella
|
|
data:
|
|
value: "Load Dishwasher - {{ now().strftime('%H:%M') }}"
|
|
- action: notify.homeassistantcomms
|
|
data:
|
|
message: "✅ {{ states('input_select.family_member_selection') }} loaded the dishwasher!"
|
|
target: '267249171017367552'
|
|
- action: input_text.set_value
|
|
entity_id: input_text.master_chore_log
|
|
data:
|
|
value: "{{ now().strftime('%Y-%m-%d %H:%M:%S') }} - {{ states('input_select.family_member_selection') }} completed Load Dishwasher"
|
|
mode: single
|
|
|
|
complete_dryer_load:
|
|
alias: Complete Dryer Load
|
|
sequence:
|
|
# Prevent "Select Person" from logging
|
|
- condition: not
|
|
conditions:
|
|
- condition: state
|
|
entity_id: input_select.family_member_selection
|
|
state: 'Select Person'
|
|
- action: input_boolean.turn_off
|
|
entity_id: input_boolean.task_dryer_load_pending
|
|
- choose:
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: input_select.family_member_selection
|
|
state: Lou
|
|
sequence:
|
|
- action: counter.increment
|
|
entity_id: counter.chores_completed_lou
|
|
- action: input_text.set_value
|
|
entity_id: input_text.last_chore_lou
|
|
data:
|
|
value: "Move to Dryer/Line - {{ now().strftime('%H:%M') }}"
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: input_select.family_member_selection
|
|
state: Jess
|
|
sequence:
|
|
- action: counter.increment
|
|
entity_id: counter.chores_completed_jess
|
|
- action: input_text.set_value
|
|
entity_id: input_text.last_chore_jess
|
|
data:
|
|
value: "Move to Dryer/Line - {{ now().strftime('%H:%M') }}"
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: input_select.family_member_selection
|
|
state: William
|
|
sequence:
|
|
- action: counter.increment
|
|
entity_id: counter.chores_completed_william
|
|
- action: input_text.set_value
|
|
entity_id: input_text.last_chore_william
|
|
data:
|
|
value: "Move to Dryer/Line - {{ now().strftime('%H:%M') }}"
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: input_select.family_member_selection
|
|
state: Xander
|
|
sequence:
|
|
- action: counter.increment
|
|
entity_id: counter.chores_completed_xander
|
|
- action: input_text.set_value
|
|
entity_id: input_text.last_chore_xander
|
|
data:
|
|
value: "Move to Dryer/Line - {{ now().strftime('%H:%M') }}"
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: input_select.family_member_selection
|
|
state: Bella
|
|
sequence:
|
|
- action: counter.increment
|
|
entity_id: counter.chores_completed_bella
|
|
- action: input_text.set_value
|
|
entity_id: input_text.last_chore_bella
|
|
data:
|
|
value: "Move to Dryer/Line - {{ now().strftime('%H:%M') }}"
|
|
- action: notify.homeassistantcomms
|
|
data:
|
|
message: "✅ {{ states('input_select.family_member_selection') }} moved clothes to dryer/clothesline!"
|
|
target: '267249171017367552'
|
|
- action: input_text.set_value
|
|
entity_id: input_text.master_chore_log
|
|
data:
|
|
value: "{{ now().strftime('%Y-%m-%d %H:%M:%S') }} - {{ states('input_select.family_member_selection') }} completed Move to Dryer/Line"
|
|
mode: single
|
|
|
|
complete_washing_load:
|
|
alias: Complete Washing Load
|
|
sequence:
|
|
# Prevent "Select Person" from logging
|
|
- condition: not
|
|
conditions:
|
|
- condition: state
|
|
entity_id: input_select.family_member_selection
|
|
state: 'Select Person'
|
|
- action: input_boolean.turn_off
|
|
entity_id: input_boolean.task_washing_load_pending
|
|
- choose:
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: input_select.family_member_selection
|
|
state: Lou
|
|
sequence:
|
|
- action: counter.increment
|
|
entity_id: counter.chores_completed_lou
|
|
- action: input_text.set_value
|
|
entity_id: input_text.last_chore_lou
|
|
data:
|
|
value: "Load Washing Machine - {{ now().strftime('%H:%M') }}"
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: input_select.family_member_selection
|
|
state: Jess
|
|
sequence:
|
|
- action: counter.increment
|
|
entity_id: counter.chores_completed_jess
|
|
- action: input_text.set_value
|
|
entity_id: input_text.last_chore_jess
|
|
data:
|
|
value: "Load Washing Machine - {{ now().strftime('%H:%M') }}"
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: input_select.family_member_selection
|
|
state: William
|
|
sequence:
|
|
- action: counter.increment
|
|
entity_id: counter.chores_completed_william
|
|
- action: input_text.set_value
|
|
entity_id: input_text.last_chore_william
|
|
data:
|
|
value: "Load Washing Machine - {{ now().strftime('%H:%M') }}"
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: input_select.family_member_selection
|
|
state: Xander
|
|
sequence:
|
|
- action: counter.increment
|
|
entity_id: counter.chores_completed_xander
|
|
- action: input_text.set_value
|
|
entity_id: input_text.last_chore_xander
|
|
data:
|
|
value: "Load Washing Machine - {{ now().strftime('%H:%M') }}"
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: input_select.family_member_selection
|
|
state: Bella
|
|
sequence:
|
|
- action: counter.increment
|
|
entity_id: counter.chores_completed_bella
|
|
- action: input_text.set_value
|
|
entity_id: input_text.last_chore_bella
|
|
data:
|
|
value: "Load Washing Machine - {{ now().strftime('%H:%M') }}"
|
|
- action: notify.homeassistantcomms
|
|
data:
|
|
message: "✅ {{ states('input_select.family_member_selection') }} loaded the washing machine!"
|
|
target: '267249171017367552'
|
|
- action: input_text.set_value
|
|
entity_id: input_text.master_chore_log
|
|
data:
|
|
value: "{{ now().strftime('%Y-%m-%d %H:%M:%S') }} - {{ states('input_select.family_member_selection') }} completed Load Washing Machine"
|
|
mode: single
|
|
|
|
# scripts.yaml - All required scripts for device management and parental controls
|
|
|
|
# Router authentication and token management for TP-Link Archer AX72 Pro
|
|
unblock_all_devices:
|
|
alias: "Unblock All Devices"
|
|
description: "Emergency unblock for all family devices using TP-Link API"
|
|
icon: mdi:check-circle
|
|
mode: single
|
|
sequence:
|
|
- service: input_boolean.turn_off
|
|
target:
|
|
entity_id:
|
|
- input_boolean.mobile_devices_blocked
|
|
- input_boolean.desktop_devices_blocked
|
|
- input_boolean.bella_homework_mode
|
|
- input_boolean.william_study_mode
|
|
|
|
- variables:
|
|
all_devices:
|
|
# All 22 device MAC addresses
|
|
- "{{ states('input_text.jess_laptop_1_testing_mac') }}"
|
|
- "{{ states('input_text.bella_desktop_wired_mac') }}"
|
|
- "{{ states('input_text.bella_desktop_wireless_mac') }}"
|
|
- "{{ states('input_text.bella_laptop_wired_mac') }}"
|
|
- "{{ states('input_text.bella_laptop_wireless_mac') }}"
|
|
- "{{ states('input_text.bella_iphone_mac') }}"
|
|
- "{{ states('input_text.bella_ipad_mac') }}"
|
|
- "{{ states('input_text.bella_switch_mac') }}"
|
|
- "{{ states('input_text.xander_desktop_wired_mac') }}"
|
|
- "{{ states('input_text.xander_desktop_wireless_mac') }}"
|
|
- "{{ states('input_text.xander_laptop_wired_mac') }}"
|
|
- "{{ states('input_text.xander_laptop_wireless_mac') }}"
|
|
- "{{ states('input_text.xander_iphone_mac') }}"
|
|
- "{{ states('input_text.xander_ipad_mac') }}"
|
|
- "{{ states('input_text.xander_switch_mac') }}"
|
|
- "{{ states('input_text.william_desktop_wired_mac') }}"
|
|
- "{{ states('input_text.william_desktop_wireless_mac') }}"
|
|
- "{{ states('input_text.william_laptop_wired_mac') }}"
|
|
- "{{ states('input_text.william_laptop_wireless_mac') }}"
|
|
- "{{ states('input_text.william_iphone_mac') }}"
|
|
- "{{ states('input_text.william_ipad_mac') }}"
|
|
- "{{ states('input_text.william_switch_mac') }}"
|
|
|
|
- repeat:
|
|
for_each: "{{ all_devices }}"
|
|
sequence:
|
|
- condition: template
|
|
value_template: "{{ repeat.item != '' and repeat.item != 'unknown' }}"
|
|
- service: rest_command.unblock_device_by_mac
|
|
data:
|
|
mac_address: "{{ repeat.item }}"
|
|
continue_on_error: true
|
|
- delay:
|
|
milliseconds: 300
|
|
|
|
- service: notify.notify
|
|
data:
|
|
title: "✅ All Devices Unblocked"
|
|
message: "Emergency unblock completed - all restrictions removed"
|
|
|
|
# Network monitoring and maintenance for TP-Link Archer AX72 Pro
|
|
network_health_check:
|
|
alias: "Network Health Check"
|
|
description: "Check router connectivity and refresh authentication if needed"
|
|
icon: mdi:network-check
|
|
mode: single
|
|
sequence:
|
|
- action: script.turn_on
|
|
target:
|
|
entity_id: script.router_login
|
|
continue_on_error: true
|
|
- delay:
|
|
seconds: 5
|
|
- action: homeassistant.update_entity
|
|
target:
|
|
entity_id: binary_sensor.10_0_0_254
|
|
continue_on_error: true
|
|
- condition: state
|
|
entity_id: binary_sensor.10_0_0_254
|
|
state: 'off'
|
|
- action: notify.mobile_app_jess_iphone
|
|
data:
|
|
title: "⚠️ Network Issue"
|
|
message: "TP-Link router ping failed - check connectivity to 10.0.0.254"
|
|
|
|
# Utility scripts for system management
|
|
validate_configuration:
|
|
alias: "Validate Home Assistant Configuration"
|
|
description: "Check configuration validity before restart"
|
|
mode: single
|
|
sequence:
|
|
- service: homeassistant.check_config
|
|
- delay:
|
|
seconds: 5
|
|
- service: system_log.write
|
|
data:
|
|
message: "Configuration validation completed"
|
|
level: info
|
|
|
|
backup_configuration:
|
|
alias: "Create Configuration Backup"
|
|
description: "Create backup before making changes"
|
|
mode: single
|
|
sequence:
|
|
- service: hassio.backup_full
|
|
data:
|
|
name: "Auto backup {{ now().strftime('%Y-%m-%d_%H-%M') }}"
|
|
compressed: true
|
|
- service: persistent_notification.create
|
|
data:
|
|
title: "Backup Created"
|
|
message: "Configuration backup completed successfully"
|
|
|
|
# ========== MISSING SCRIPTS - ADD TO scripts.yaml ==========
|
|
# These scripts were referenced but not defined, causing Spook warnings
|
|
|
|
# ========== ROUTER TOKEN MANAGEMENT ==========
|
|
refresh_router_token:
|
|
alias: "Refresh Router Access Token"
|
|
description: "Manually refresh router authentication token"
|
|
mode: single
|
|
sequence:
|
|
- service: rest_command.router_login
|
|
- delay:
|
|
seconds: 3
|
|
- service: input_text.set_value
|
|
target:
|
|
entity_id: input_text.last_router_login
|
|
data:
|
|
value: "{{ now().strftime('%Y-%m-%d %H:%M:%S') }}"
|
|
- service: input_text.set_value
|
|
target:
|
|
entity_id: input_text.system_status
|
|
data:
|
|
value: "Token refreshed at {{ now().strftime('%H:%M:%S') }}"
|
|
|
|
# ========== MAC ADDRESS MANAGEMENT ==========
|
|
update_device_mac:
|
|
alias: "Update Device MAC Address"
|
|
description: "Update MAC address for device tracking"
|
|
fields:
|
|
device_name:
|
|
description: "Device name (e.g., bella_iphone)"
|
|
example: "bella_iphone"
|
|
selector:
|
|
text:
|
|
new_mac:
|
|
description: "New MAC address"
|
|
example: "AA:BB:CC:DD:EE:FF"
|
|
selector:
|
|
text:
|
|
old_mac:
|
|
description: "Old MAC address (optional)"
|
|
example: "11:22:33:44:55:66"
|
|
selector:
|
|
text:
|
|
mode: single
|
|
sequence:
|
|
- service: system_log.write
|
|
data:
|
|
message: >
|
|
MAC Update: {{ device_name }} changed from {{ old_mac | default('unknown') }}
|
|
to {{ new_mac }} at {{ now().strftime('%Y-%m-%d %H:%M:%S') }}
|
|
level: info
|
|
- service: input_text.set_value
|
|
target:
|
|
entity_id: "input_text.{{ device_name }}_mac"
|
|
data:
|
|
value: "{{ new_mac }}"
|
|
- service: input_text.set_value
|
|
target:
|
|
entity_id: "input_text.{{ device_name }}_mac_backup"
|
|
data:
|
|
value: "{{ new_mac }}"
|
|
- service: input_boolean.turn_off
|
|
target:
|
|
entity_id: "input_boolean.{{ device_name }}_mac_changed"
|
|
continue_on_error: true
|
|
|
|
bella_homework_mode:
|
|
alias: "Bella's Homework Mode"
|
|
icon: mdi:book-open-page-variant
|
|
mode: restart
|
|
sequence:
|
|
- service: system_log.write
|
|
data:
|
|
message: "Bella's homework mode activated"
|
|
level: info
|
|
# Block gaming and distracting devices
|
|
- service: input_boolean.turn_on
|
|
target:
|
|
entity_id:
|
|
- input_boolean.bella_iphone_blocked
|
|
- input_boolean.bella_ipad_blocked
|
|
- input_boolean.bella_switch_blocked
|
|
- input_boolean.bella_desktop_wireless_blocked
|
|
continue_on_error: true
|
|
# Keep laptop available for homework
|
|
- service: input_boolean.turn_off
|
|
target:
|
|
entity_id:
|
|
- input_boolean.bella_laptop_wireless_blocked
|
|
- input_boolean.bella_laptop_wired_blocked
|
|
continue_on_error: true
|
|
- service: notify.family
|
|
data:
|
|
title: "📚 Bella's Homework Mode"
|
|
message: "Homework mode enabled. Gaming devices blocked, laptop available."
|
|
continue_on_error: true
|
|
|
|
xander_gaming_mode:
|
|
alias: "Xander's Gaming Mode"
|
|
icon: mdi:gamepad-variant
|
|
mode: restart
|
|
sequence:
|
|
- service: system_log.write
|
|
data:
|
|
message: "Xander's gaming mode activated"
|
|
level: info
|
|
- service: input_boolean.turn_off
|
|
target:
|
|
entity_id:
|
|
- input_boolean.xander_desktop_wired_blocked
|
|
- input_boolean.xander_desktop_wireless_blocked
|
|
- input_boolean.xander_switch_blocked
|
|
continue_on_error: true
|
|
- service: notify.family
|
|
data:
|
|
title: "🎮 Xander's Gaming Mode"
|
|
message: "Gaming session started - devices unblocked"
|
|
continue_on_error: true
|
|
|
|
william_study_mode:
|
|
alias: "William's Study Mode"
|
|
icon: mdi:school
|
|
mode: restart
|
|
sequence:
|
|
- service: system_log.write
|
|
data:
|
|
message: "William's study mode activated"
|
|
level: info
|
|
# Block gaming devices
|
|
- service: input_boolean.turn_on
|
|
target:
|
|
entity_id:
|
|
- input_boolean.william_desktop_wireless_blocked
|
|
- input_boolean.william_switch_blocked
|
|
continue_on_error: true
|
|
# Keep laptop available
|
|
- service: input_boolean.turn_off
|
|
target:
|
|
entity_id:
|
|
- input_boolean.william_laptop_wireless_blocked
|
|
- input_boolean.william_laptop_wired_blocked
|
|
- input_boolean.william_desktop_wired_blocked
|
|
continue_on_error: true
|
|
- service: notify.family
|
|
data:
|
|
title: "📖 William's Study Mode"
|
|
message: "Study mode active - gaming blocked, work devices available"
|
|
continue_on_error: true
|
|
|
|
# ========== BULK DEVICE CONTROL SCRIPTS ==========
|
|
block_all_mobile_devices:
|
|
alias: "Block All Mobile Devices"
|
|
icon: mdi:cellphone-off
|
|
mode: single
|
|
sequence:
|
|
- service: input_boolean.turn_on
|
|
target:
|
|
entity_id:
|
|
- input_boolean.bella_iphone_blocked
|
|
- input_boolean.bella_ipad_blocked
|
|
- input_boolean.xander_iphone_blocked
|
|
- input_boolean.xander_ipad_blocked
|
|
- input_boolean.william_iphone_blocked
|
|
- input_boolean.william_ipad_blocked
|
|
- service: input_text.set_value
|
|
target:
|
|
entity_id: input_text.last_block_action
|
|
data:
|
|
value: "Blocked all mobile devices at {{ now().strftime('%H:%M:%S') }}"
|
|
- service: notify.family
|
|
data:
|
|
title: "🚫 Mobile Devices Blocked"
|
|
message: "All iPhones and iPads blocked"
|
|
|
|
block_all_desktop_devices:
|
|
alias: "Block All Desktop Devices"
|
|
icon: mdi:desktop-classic-off
|
|
mode: single
|
|
sequence:
|
|
- service: input_boolean.turn_on
|
|
target:
|
|
entity_id:
|
|
- input_boolean.bella_desktop_wired_blocked
|
|
- input_boolean.bella_desktop_wireless_blocked
|
|
- input_boolean.xander_desktop_wired_blocked
|
|
- input_boolean.xander_desktop_wireless_blocked
|
|
- input_boolean.william_desktop_wired_blocked
|
|
- input_boolean.william_desktop_wireless_blocked
|
|
- service: input_text.set_value
|
|
target:
|
|
entity_id: input_text.last_block_action
|
|
data:
|
|
value: "Blocked all desktops at {{ now().strftime('%H:%M:%S') }}"
|
|
- service: notify.family
|
|
data:
|
|
title: "🚫 Desktop Devices Blocked"
|
|
message: "All desktop computers blocked"
|
|
|
|
block_all_laptop_devices:
|
|
alias: "Block All Laptop Devices"
|
|
icon: mdi:laptop-off
|
|
mode: single
|
|
sequence:
|
|
- service: input_boolean.turn_on
|
|
target:
|
|
entity_id:
|
|
- input_boolean.jess_laptop_1_testing_blocked
|
|
- input_boolean.bella_laptop_wired_blocked
|
|
- input_boolean.bella_laptop_wireless_blocked
|
|
- input_boolean.xander_laptop_wired_blocked
|
|
- input_boolean.xander_laptop_wireless_blocked
|
|
- input_boolean.william_laptop_wired_blocked
|
|
- input_boolean.william_laptop_wireless_blocked
|
|
- service: input_text.set_value
|
|
target:
|
|
entity_id: input_text.last_block_action
|
|
data:
|
|
value: "Blocked all laptops at {{ now().strftime('%H:%M:%S') }}"
|
|
- service: notify.family
|
|
data:
|
|
title: "🚫 Laptop Devices Blocked"
|
|
message: "All laptop computers blocked"
|
|
|
|
# ========== INDIVIDUAL CHILD CONTROL SCRIPTS ==========
|
|
block_all_bella_devices:
|
|
alias: "Block All Bella's Devices"
|
|
icon: mdi:account-cancel
|
|
mode: single
|
|
sequence:
|
|
- service: input_boolean.turn_on
|
|
target:
|
|
entity_id:
|
|
- input_boolean.bella_desktop_wired_blocked
|
|
- input_boolean.bella_desktop_wireless_blocked
|
|
- input_boolean.bella_laptop_wired_blocked
|
|
- input_boolean.bella_laptop_wireless_blocked
|
|
- input_boolean.bella_iphone_blocked
|
|
- input_boolean.bella_ipad_blocked
|
|
- input_boolean.bella_switch_blocked
|
|
- service: input_text.set_value
|
|
target:
|
|
entity_id: input_text.last_block_action
|
|
data:
|
|
value: "Blocked all Bella's devices at {{ now().strftime('%H:%M:%S') }}"
|
|
- service: notify.family
|
|
data:
|
|
title: "🚫 Bella's Devices Blocked"
|
|
message: "All 7 of Bella's devices have been blocked"
|
|
|
|
unblock_all_bella_devices:
|
|
alias: "Unblock All Bella's Devices"
|
|
icon: mdi:account-check
|
|
mode: single
|
|
sequence:
|
|
- service: input_boolean.turn_off
|
|
target:
|
|
entity_id:
|
|
- input_boolean.bella_desktop_wired_blocked
|
|
- input_boolean.bella_desktop_wireless_blocked
|
|
- input_boolean.bella_laptop_wired_blocked
|
|
- input_boolean.bella_laptop_wireless_blocked
|
|
- input_boolean.bella_iphone_blocked
|
|
- input_boolean.bella_ipad_blocked
|
|
- input_boolean.bella_switch_blocked
|
|
- service: input_text.set_value
|
|
target:
|
|
entity_id: input_text.last_block_action
|
|
data:
|
|
value: "Unblocked all Bella's devices at {{ now().strftime('%H:%M:%S') }}"
|
|
- service: notify.family
|
|
data:
|
|
title: "✅ Bella's Devices Unblocked"
|
|
message: "All of Bella's devices have been restored"
|
|
|
|
block_all_xander_devices:
|
|
alias: "Block All Xander's Devices"
|
|
icon: mdi:account-cancel
|
|
mode: single
|
|
sequence:
|
|
- service: input_boolean.turn_on
|
|
target:
|
|
entity_id:
|
|
- input_boolean.xander_desktop_wired_blocked
|
|
- input_boolean.xander_desktop_wireless_blocked
|
|
- input_boolean.xander_laptop_wired_blocked
|
|
- input_boolean.xander_laptop_wireless_blocked
|
|
- input_boolean.xander_iphone_blocked
|
|
- input_boolean.xander_ipad_blocked
|
|
- input_boolean.xander_switch_blocked
|
|
- service: input_text.set_value
|
|
target:
|
|
entity_id: input_text.last_block_action
|
|
data:
|
|
value: "Blocked all Xander's devices at {{ now().strftime('%H:%M:%S') }}"
|
|
- service: notify.family
|
|
data:
|
|
title: "🚫 Xander's Devices Blocked"
|
|
message: "All 7 of Xander's devices have been blocked"
|
|
|
|
unblock_all_xander_devices:
|
|
alias: "Unblock All Xander's Devices"
|
|
icon: mdi:account-check
|
|
mode: single
|
|
sequence:
|
|
- service: input_boolean.turn_off
|
|
target:
|
|
entity_id:
|
|
- input_boolean.xander_desktop_wired_blocked
|
|
- input_boolean.xander_desktop_wireless_blocked
|
|
- input_boolean.xander_laptop_wired_blocked
|
|
- input_boolean.xander_laptop_wireless_blocked
|
|
- input_boolean.xander_iphone_blocked
|
|
- input_boolean.xander_ipad_blocked
|
|
- input_boolean.xander_switch_blocked
|
|
- service: input_text.set_value
|
|
target:
|
|
entity_id: input_text.last_block_action
|
|
data:
|
|
value: "Unblocked all Xander's devices at {{ now().strftime('%H:%M:%S') }}"
|
|
- service: notify.family
|
|
data:
|
|
title: "✅ Xander's Devices Unblocked"
|
|
message: "All of Xander's devices have been restored"
|
|
|
|
block_all_william_devices:
|
|
alias: "Block All William's Devices"
|
|
icon: mdi:account-cancel
|
|
mode: single
|
|
sequence:
|
|
- service: input_boolean.turn_on
|
|
target:
|
|
entity_id:
|
|
- input_boolean.william_desktop_wired_blocked
|
|
- input_boolean.william_desktop_wireless_blocked
|
|
- input_boolean.william_laptop_wired_blocked
|
|
- input_boolean.william_laptop_wireless_blocked
|
|
- input_boolean.william_iphone_blocked
|
|
- input_boolean.william_ipad_blocked
|
|
- input_boolean.william_switch_blocked
|
|
- service: input_text.set_value
|
|
target:
|
|
entity_id: input_text.last_block_action
|
|
data:
|
|
value: "Blocked all William's devices at {{ now().strftime('%H:%M:%S') }}"
|
|
- service: notify.family
|
|
data:
|
|
title: "🚫 William's Devices Blocked"
|
|
message: "All 7 of William's devices have been blocked"
|
|
|
|
unblock_all_william_devices:
|
|
alias: "Unblock All William's Devices"
|
|
icon: mdi:account-check
|
|
mode: single
|
|
sequence:
|
|
- service: input_boolean.turn_off
|
|
target:
|
|
entity_id:
|
|
- input_boolean.william_desktop_wired_blocked
|
|
- input_boolean.william_desktop_wireless_blocked
|
|
- input_boolean.william_laptop_wired_blocked
|
|
- input_boolean.william_laptop_wireless_blocked
|
|
- input_boolean.william_iphone_blocked
|
|
- input_boolean.william_ipad_blocked
|
|
- input_boolean.william_switch_blocked
|
|
- service: input_text.set_value
|
|
target:
|
|
entity_id: input_text.last_block_action
|
|
data:
|
|
value: "Unblocked all William's devices at {{ now().strftime('%H:%M:%S') }}"
|
|
- service: notify.family
|
|
data:
|
|
title: "✅ William's Devices Unblocked"
|
|
message: "All of William's devices have been restored"
|
|
|
|
# ========== TESTING SCRIPT ==========
|
|
test_jess_device_connection:
|
|
alias: "Test Jess Device Connection"
|
|
description: "Test connection to Jess's testing laptop"
|
|
mode: single
|
|
sequence:
|
|
- service: rest_command.router_login
|
|
continue_on_error: true
|
|
- delay:
|
|
seconds: 2
|
|
- service: rest_command.get_connected_devices
|
|
continue_on_error: true
|
|
- service: input_text.set_value
|
|
target:
|
|
entity_id: input_text.system_status
|
|
data:
|
|
value: "Jess device test completed at {{ now().strftime('%H:%M:%S') }}"
|
|
- service: notify.family
|
|
data:
|
|
title: "Device Connection Test"
|
|
message: "Test completed for Jess's laptop. Check system logs for details."
|
|
continue_on_error: true
|
|
|
|
|
|
block_all_children_devices:
|
|
alias: "Block All Children's Devices"
|
|
icon: mdi:account-cancel
|
|
mode: single
|
|
sequence:
|
|
- service: script.block_all_bella_devices
|
|
- service: script.block_all_xander_devices
|
|
- service: script.block_all_william_devices
|
|
- service: input_text.set_value
|
|
target:
|
|
entity_id: input_text.last_block_action
|
|
data:
|
|
value: "Blocked all children at {{ now().strftime('%H:%M:%S') }}"
|
|
|
|
unblock_all_children_devices:
|
|
alias: "Unblock All Children's Devices"
|
|
icon: mdi:account-check
|
|
mode: single
|
|
sequence:
|
|
- service: script.unblock_all_bella_devices
|
|
- service: script.unblock_all_xander_devices
|
|
- service: script.unblock_all_william_devices
|
|
- service: input_text.set_value
|
|
target:
|
|
entity_id: input_text.last_block_action
|
|
data:
|
|
value: "Unblocked all children at {{ now().strftime('%H:%M:%S') }}"
|
|
|
|
system_health_check:
|
|
alias: "System Health Check"
|
|
description: "Run comprehensive system health check"
|
|
mode: single
|
|
sequence:
|
|
- service: script.refresh_router_token
|
|
continue_on_error: true
|
|
- delay:
|
|
seconds: 3
|
|
- service: homeassistant.update_entity
|
|
target:
|
|
entity_id: binary_sensor.10_0_0_254
|
|
continue_on_error: true
|
|
- service: input_text.set_value
|
|
target:
|
|
entity_id: input_text.system_status
|
|
data:
|
|
value: "Health check completed at {{ now().strftime('%H:%M:%S') }}"
|
|
|
|
backup_current_configuration:
|
|
alias: "Backup Current Configuration"
|
|
description: "Create backup of current settings"
|
|
mode: single
|
|
sequence:
|
|
- service: input_text.set_value
|
|
target:
|
|
entity_id: input_text.system_status
|
|
data:
|
|
value: "Backup created at {{ now().strftime('%Y-%m-%d %H:%M:%S') }}"
|
|
- service: persistent_notification.create
|
|
data:
|
|
title: "Backup Created"
|
|
message: "Configuration backup completed successfully"
|
|
|
|
|
|
|
|
# ========== ROUTER LOGIN SCRIPT (was missing!) ==========
|
|
router_login:
|
|
alias: "Router Login and Token Refresh"
|
|
icon: mdi:router-wireless
|
|
mode: single
|
|
sequence:
|
|
- action: rest_command.router_login
|
|
- delay:
|
|
seconds: 3
|
|
- action: system_log.write
|
|
data:
|
|
message: "Router login attempted at {{ now().strftime('%Y-%m-%d %H:%M:%S') }}"
|
|
level: info
|
|
- action: persistent_notification.create
|
|
data:
|
|
message: "Router authentication refreshed"
|
|
title: "TP-Link Router"
|
|
notification_id: "router_auth"
|
|
|
|
# ========== CLEAR MAC CHANGE ALERTS (was missing!) ==========
|
|
clear_mac_change_alerts:
|
|
alias: "Clear MAC Change Alerts"
|
|
description: "Clear alerts for MAC address changes"
|
|
icon: mdi:bell-off
|
|
fields:
|
|
device_name:
|
|
description: "Device name to clear alerts for"
|
|
example: "bella_iphone"
|
|
selector:
|
|
text:
|
|
mode: single
|
|
sequence:
|
|
- action: persistent_notification.dismiss
|
|
data:
|
|
notification_id: "mac_change_{{ device_name }}"
|
|
- action: system_log.write
|
|
data:
|
|
message: "MAC change alerts cleared for {{ device_name }}"
|
|
level: info
|
|
|
|
# ========== TOGGLE SCRIPTS FOR DESKTOP/LAPTOP DEVICES ==========
|
|
# Add these to your scripts.yaml file
|
|
|
|
# These scripts toggle BOTH wired and wireless connections together
|
|
# They check the current combined state and toggle accordingly
|
|
|
|
# ========== BELLA'S DEVICE TOGGLES ==========
|
|
toggle_bella_desktop:
|
|
alias: "Toggle Bella's Desktop (Wired & Wireless)"
|
|
icon: mdi:desktop-classic
|
|
mode: single
|
|
sequence:
|
|
# Check if EITHER is currently blocked
|
|
- choose:
|
|
# If ANY are blocked, unblock BOTH
|
|
- conditions:
|
|
- condition: or
|
|
conditions:
|
|
- condition: state
|
|
entity_id: input_boolean.bella_desktop_wired_blocked
|
|
state: 'on'
|
|
- condition: state
|
|
entity_id: input_boolean.bella_desktop_wireless_blocked
|
|
state: 'on'
|
|
sequence:
|
|
- service: input_boolean.turn_off
|
|
target:
|
|
entity_id:
|
|
- input_boolean.bella_desktop_wired_blocked
|
|
- input_boolean.bella_desktop_wireless_blocked
|
|
- service: input_text.set_value
|
|
target:
|
|
entity_id: input_text.last_block_action
|
|
data:
|
|
value: "Unblocked Bella Desktop at {{ now().strftime('%H:%M:%S') }}"
|
|
# If BOTH are unblocked, block BOTH
|
|
default:
|
|
- service: input_boolean.turn_on
|
|
target:
|
|
entity_id:
|
|
- input_boolean.bella_desktop_wired_blocked
|
|
- input_boolean.bella_desktop_wireless_blocked
|
|
- service: input_text.set_value
|
|
target:
|
|
entity_id: input_text.last_block_action
|
|
data:
|
|
value: "Blocked Bella Desktop at {{ now().strftime('%H:%M:%S') }}"
|
|
|
|
toggle_bella_laptop:
|
|
alias: "Toggle Bella's Laptop (Wired & Wireless)"
|
|
icon: mdi:laptop
|
|
mode: single
|
|
sequence:
|
|
- choose:
|
|
- conditions:
|
|
- condition: or
|
|
conditions:
|
|
- condition: state
|
|
entity_id: input_boolean.bella_laptop_wired_blocked
|
|
state: 'on'
|
|
- condition: state
|
|
entity_id: input_boolean.bella_laptop_wireless_blocked
|
|
state: 'on'
|
|
sequence:
|
|
- service: input_boolean.turn_off
|
|
target:
|
|
entity_id:
|
|
- input_boolean.bella_laptop_wired_blocked
|
|
- input_boolean.bella_laptop_wireless_blocked
|
|
- service: input_text.set_value
|
|
target:
|
|
entity_id: input_text.last_block_action
|
|
data:
|
|
value: "Unblocked Bella Laptop at {{ now().strftime('%H:%M:%S') }}"
|
|
default:
|
|
- service: input_boolean.turn_on
|
|
target:
|
|
entity_id:
|
|
- input_boolean.bella_laptop_wired_blocked
|
|
- input_boolean.bella_laptop_wireless_blocked
|
|
- service: input_text.set_value
|
|
target:
|
|
entity_id: input_text.last_block_action
|
|
data:
|
|
value: "Blocked Bella Laptop at {{ now().strftime('%H:%M:%S') }}"
|
|
|
|
# ========== XANDER'S DEVICE TOGGLES ==========
|
|
toggle_xander_desktop:
|
|
alias: "Toggle Xander's Desktop (Wired & Wireless)"
|
|
icon: mdi:desktop-classic
|
|
mode: single
|
|
sequence:
|
|
- choose:
|
|
- conditions:
|
|
- condition: or
|
|
conditions:
|
|
- condition: state
|
|
entity_id: input_boolean.xander_desktop_wired_blocked
|
|
state: 'on'
|
|
- condition: state
|
|
entity_id: input_boolean.xander_desktop_wireless_blocked
|
|
state: 'on'
|
|
sequence:
|
|
- service: input_boolean.turn_off
|
|
target:
|
|
entity_id:
|
|
- input_boolean.xander_desktop_wired_blocked
|
|
- input_boolean.xander_desktop_wireless_blocked
|
|
- service: input_text.set_value
|
|
target:
|
|
entity_id: input_text.last_block_action
|
|
data:
|
|
value: "Unblocked Xander Desktop at {{ now().strftime('%H:%M:%S') }}"
|
|
default:
|
|
- service: input_boolean.turn_on
|
|
target:
|
|
entity_id:
|
|
- input_boolean.xander_desktop_wired_blocked
|
|
- input_boolean.xander_desktop_wireless_blocked
|
|
- service: input_text.set_value
|
|
target:
|
|
entity_id: input_text.last_block_action
|
|
data:
|
|
value: "Blocked Xander Desktop at {{ now().strftime('%H:%M:%S') }}"
|
|
|
|
toggle_xander_laptop:
|
|
alias: "Toggle Xander's Laptop (Wired & Wireless)"
|
|
icon: mdi:laptop
|
|
mode: single
|
|
sequence:
|
|
- choose:
|
|
- conditions:
|
|
- condition: or
|
|
conditions:
|
|
- condition: state
|
|
entity_id: input_boolean.xander_laptop_wired_blocked
|
|
state: 'on'
|
|
- condition: state
|
|
entity_id: input_boolean.xander_laptop_wireless_blocked
|
|
state: 'on'
|
|
sequence:
|
|
- service: input_boolean.turn_off
|
|
target:
|
|
entity_id:
|
|
- input_boolean.xander_laptop_wired_blocked
|
|
- input_boolean.xander_laptop_wireless_blocked
|
|
- service: input_text.set_value
|
|
target:
|
|
entity_id: input_text.last_block_action
|
|
data:
|
|
value: "Unblocked Xander Laptop at {{ now().strftime('%H:%M:%S') }}"
|
|
default:
|
|
- service: input_boolean.turn_on
|
|
target:
|
|
entity_id:
|
|
- input_boolean.xander_laptop_wired_blocked
|
|
- input_boolean.xander_laptop_wireless_blocked
|
|
- service: input_text.set_value
|
|
target:
|
|
entity_id: input_text.last_block_action
|
|
data:
|
|
value: "Blocked Xander Laptop at {{ now().strftime('%H:%M:%S') }}"
|
|
|
|
# ========== WILLIAM'S DEVICE TOGGLES ==========
|
|
toggle_william_desktop:
|
|
alias: "Toggle William's Desktop (Wired & Wireless)"
|
|
icon: mdi:desktop-classic
|
|
mode: single
|
|
sequence:
|
|
- choose:
|
|
- conditions:
|
|
- condition: or
|
|
conditions:
|
|
- condition: state
|
|
entity_id: input_boolean.william_desktop_wired_blocked
|
|
state: 'on'
|
|
- condition: state
|
|
entity_id: input_boolean.william_desktop_wireless_blocked
|
|
state: 'on'
|
|
sequence:
|
|
- service: input_boolean.turn_off
|
|
target:
|
|
entity_id:
|
|
- input_boolean.william_desktop_wired_blocked
|
|
- input_boolean.william_desktop_wireless_blocked
|
|
- service: input_text.set_value
|
|
target:
|
|
entity_id: input_text.last_block_action
|
|
data:
|
|
value: "Unblocked William Desktop at {{ now().strftime('%H:%M:%S') }}"
|
|
default:
|
|
- service: input_boolean.turn_on
|
|
target:
|
|
entity_id:
|
|
- input_boolean.william_desktop_wired_blocked
|
|
- input_boolean.william_desktop_wireless_blocked
|
|
- service: input_text.set_value
|
|
target:
|
|
entity_id: input_text.last_block_action
|
|
data:
|
|
value: "Blocked William Desktop at {{ now().strftime('%H:%M:%S') }}"
|
|
|
|
toggle_william_laptop:
|
|
alias: "Toggle William's Laptop (Wired & Wireless)"
|
|
icon: mdi:laptop
|
|
mode: single
|
|
sequence:
|
|
- choose:
|
|
- conditions:
|
|
- condition: or
|
|
conditions:
|
|
- condition: state
|
|
entity_id: input_boolean.william_laptop_wired_blocked
|
|
state: 'on'
|
|
- condition: state
|
|
entity_id: input_boolean.william_laptop_wireless_blocked
|
|
state: 'on'
|
|
sequence:
|
|
- service: input_boolean.turn_off
|
|
target:
|
|
entity_id:
|
|
- input_boolean.william_laptop_wired_blocked
|
|
- input_boolean.william_laptop_wireless_blocked
|
|
- service: input_text.set_value
|
|
target:
|
|
entity_id: input_text.last_block_action
|
|
data:
|
|
value: "Unblocked William Laptop at {{ now().strftime('%H:%M:%S') }}"
|
|
default:
|
|
- service: input_boolean.turn_on
|
|
target:
|
|
entity_id:
|
|
- input_boolean.william_laptop_wired_blocked
|
|
- input_boolean.william_laptop_wireless_blocked
|
|
- service: input_text.set_value
|
|
target:
|
|
entity_id: input_text.last_block_action
|
|
data:
|
|
value: "Blocked William Laptop at {{ now().strftime('%H:%M:%S') }}"
|
|
|
|
# ========== ADD THESE SCRIPTS TO scripts.yaml ==========
|
|
# Add these at the end of your scripts.yaml file
|
|
|
|
# Enhanced router login using Python script
|
|
router_login_python:
|
|
alias: "Router Login (Python Enhanced)"
|
|
description: "Login to router using Python script with better error handling"
|
|
mode: single
|
|
sequence:
|
|
- service: python_script.tplink_router_control
|
|
data:
|
|
action: login
|
|
- delay:
|
|
seconds: 2
|
|
- service: persistent_notification.create
|
|
data:
|
|
title: "Router Login"
|
|
message: "{{ states('input_text.system_status') }}"
|
|
notification_id: router_login_status
|
|
|
|
# Enhanced block device using Python script
|
|
block_device_python:
|
|
alias: "Block Device (Python Enhanced)"
|
|
description: "Block device using Python script"
|
|
fields:
|
|
mac_address:
|
|
description: "MAC address to block"
|
|
example: "AA:BB:CC:DD:EE:FF"
|
|
device_name:
|
|
description: "Device name for logging"
|
|
example: "Bella-iPhone"
|
|
mode: single
|
|
sequence:
|
|
- service: python_script.tplink_router_control
|
|
data:
|
|
action: block
|
|
mac_address: "{{ mac_address }}"
|
|
device_name: "{{ device_name }}"
|
|
- delay:
|
|
seconds: 2
|
|
- service: persistent_notification.create
|
|
data:
|
|
title: "Device Block"
|
|
message: "{{ states('input_text.system_status') }}"
|
|
notification_id: device_block_status
|
|
|
|
# Enhanced unblock device using Python script
|
|
unblock_device_python:
|
|
alias: "Unblock Device (Python Enhanced)"
|
|
description: "Unblock device using Python script"
|
|
fields:
|
|
mac_address:
|
|
description: "MAC address to unblock"
|
|
example: "AA:BB:CC:DD:EE:FF"
|
|
mode: single
|
|
sequence:
|
|
- service: python_script.tplink_router_control
|
|
data:
|
|
action: unblock
|
|
mac_address: "{{ mac_address }}"
|
|
- delay:
|
|
seconds: 2
|
|
- service: persistent_notification.create
|
|
data:
|
|
title: "Device Unblock"
|
|
message: "{{ states('input_text.system_status') }}"
|
|
notification_id: device_unblock_status
|
|
|
|
# Comprehensive router test - tests BOTH REST and Python methods
|
|
test_router_comprehensive:
|
|
alias: "Comprehensive Router Test"
|
|
description: "Tests both REST and Python methods to find which works"
|
|
mode: single
|
|
sequence:
|
|
- service: input_text.set_value
|
|
target:
|
|
entity_id: input_text.system_status
|
|
data:
|
|
value: "Starting comprehensive router test..."
|
|
|
|
# TEST 1: REST Command Login
|
|
- service: persistent_notification.create
|
|
data:
|
|
title: "Router Test"
|
|
message: "Test 1: Trying REST command login..."
|
|
notification_id: router_test
|
|
- service: rest_command.router_login
|
|
continue_on_error: true
|
|
- delay:
|
|
seconds: 3
|
|
- service: input_text.set_value
|
|
target:
|
|
entity_id: input_text.system_status
|
|
data:
|
|
value: "REST login completed. Token: {{ states('input_text.router_token')[:10] if states('input_text.router_token') not in ['unknown', '', 'unavailable'] else 'FAILED' }}"
|
|
|
|
# TEST 2: Python Script Login
|
|
- delay:
|
|
seconds: 2
|
|
- service: persistent_notification.create
|
|
data:
|
|
title: "Router Test"
|
|
message: "Test 2: Trying Python script login..."
|
|
notification_id: router_test
|
|
- service: python_script.tplink_router_control
|
|
data:
|
|
action: login
|
|
continue_on_error: true
|
|
- delay:
|
|
seconds: 3
|
|
|
|
# TEST 3: Block test device (if we have a token)
|
|
- condition: template
|
|
value_template: "{{ states('input_text.router_token') not in ['unknown', '', 'unavailable'] }}"
|
|
- service: persistent_notification.create
|
|
data:
|
|
title: "Router Test"
|
|
message: "Test 3: Trying to block test device..."
|
|
notification_id: router_test
|
|
- service: rest_command.block_device_by_mac
|
|
data:
|
|
mac_address: "{{ states('input_text.jess_laptop_1_testing_mac') }}"
|
|
device_name: "Test-Block"
|
|
continue_on_error: true
|
|
- delay:
|
|
seconds: 5
|
|
|
|
# TEST 4: Unblock test device
|
|
- service: persistent_notification.create
|
|
data:
|
|
title: "Router Test"
|
|
message: "Test 4: Trying to unblock test device..."
|
|
notification_id: router_test
|
|
- service: rest_command.unblock_device_by_mac
|
|
data:
|
|
mac_address: "{{ states('input_text.jess_laptop_1_testing_mac') }}"
|
|
continue_on_error: true
|
|
- delay:
|
|
seconds: 3
|
|
|
|
# Final Report
|
|
- service: persistent_notification.create
|
|
data:
|
|
title: "✅ Router Test Complete"
|
|
message: |
|
|
**Test Results:**
|
|
|
|
Router Token: {{ 'VALID ✅' if states('input_text.router_token') not in ['unknown', '', 'unavailable'] else 'INVALID ❌' }}
|
|
|
|
Status: {{ states('input_text.system_status') }}
|
|
|
|
Last Action: {{ states('input_text.last_block_action') }}
|
|
|
|
**Next Steps:**
|
|
- Check Settings → System → Logs for detailed errors
|
|
- Look for ✅ or ❌ messages in system_status
|
|
- If REST works, use existing scripts
|
|
- If Python works, use _python versions of scripts
|
|
notification_id: router_test_final
|
|
|
|
# Quick test - just login
|
|
test_router_login_quick:
|
|
alias: "Quick Router Login Test"
|
|
description: "Quick test of just the login function"
|
|
mode: single
|
|
sequence:
|
|
- service: rest_command.router_login
|
|
- delay:
|
|
seconds: 3
|
|
- service: persistent_notification.create
|
|
data:
|
|
title: "Quick Login Test"
|
|
message: |
|
|
Token: {{ states('input_text.router_token')[:20] if states('input_text.router_token') not in ['unknown', '', 'unavailable'] else 'FAILED' }}
|
|
|
|
Status: {{ states('input_text.system_status') }}
|
|
|
|
Check Settings → System → Logs for details
|
|
notification_id: quick_login_test
|
|
|
|
# Router connection health check
|
|
router_health_check:
|
|
alias: "Router Health Check"
|
|
description: "Check router connectivity and authentication status"
|
|
mode: single
|
|
sequence:
|
|
- service: homeassistant.update_entity
|
|
target:
|
|
entity_id: binary_sensor.10_0_0_254
|
|
continue_on_error: true
|
|
- delay:
|
|
seconds: 2
|
|
- service: persistent_notification.create
|
|
data:
|
|
title: "Router Health Check"
|
|
message: |
|
|
**Router Status:**
|
|
|
|
Ping: {{ '🟢 Online' if is_state('binary_sensor.10_0_0_254', 'on') else '🔴 Offline' }}
|
|
|
|
Token: {{ '🟢 Valid' if states('input_text.router_token') not in ['unknown', '', 'unavailable'] else '🔴 Invalid' }}
|
|
|
|
Last Login: {{ states('input_text.last_router_login') }}
|
|
|
|
System Status: {{ states('input_text.system_status') }}
|
|
|
|
**Recommendation:**
|
|
{% if is_state('binary_sensor.10_0_0_254', 'off') %}
|
|
⚠️ Router is offline! Check network connection.
|
|
{% elif states('input_text.router_token') in ['unknown', '', 'unavailable'] %}
|
|
⚠️ No valid token. Run "Test Router Login Quick" script.
|
|
{% else %}
|
|
✅ Everything looks good!
|
|
{% endif %}
|
|
notification_id: router_health
|
|
|
|
# ========== UPDATED TEST SCRIPTS - ADD TO scripts.yaml ==========
|
|
# These scripts pass credentials directly for testing
|
|
|
|
# Test with Python script using direct credentials
|
|
test_router_login_python_direct:
|
|
alias: "Test Router Login (Python with Direct Credentials)"
|
|
description: "Test Python login with credentials passed directly"
|
|
mode: single
|
|
sequence:
|
|
- service: python_script.tplink_router_control
|
|
data:
|
|
action: login
|
|
username: "admin"
|
|
password: "23Pinkpr!ncesses"
|
|
- delay:
|
|
seconds: 3
|
|
- service: persistent_notification.create
|
|
data:
|
|
title: "Python Login Test (Direct Creds)"
|
|
message: |
|
|
**Result:**
|
|
Status: {{ states('input_text.system_status') }}
|
|
|
|
Token: {{ states('input_text.router_token')[:30] if states('input_text.router_token') not in ['unknown', '', 'unavailable'] else 'NOT FOUND' }}
|
|
|
|
Check Settings → System → Logs for detailed output
|
|
notification_id: python_login_direct
|
|
|
|
# Test REST command with updated config
|
|
test_router_login_rest_updated:
|
|
alias: "Test Router Login (REST Updated)"
|
|
description: "Test REST command with updated credentials"
|
|
mode: single
|
|
sequence:
|
|
- service: rest_command.router_login
|
|
- delay:
|
|
seconds: 3
|
|
- service: persistent_notification.create
|
|
data:
|
|
title: "REST Login Test (Updated)"
|
|
message: |
|
|
**Result:**
|
|
Token: {{ states('input_text.router_token')[:30] if states('input_text.router_token') not in ['unknown', '', 'unavailable'] else 'NOT FOUND' }}
|
|
|
|
Status: {{ states('input_text.system_status') }}
|
|
|
|
{% if states('input_text.router_token') not in ['unknown', '', 'unavailable'] %}
|
|
✅ **SUCCESS!** REST commands are working.
|
|
{% else %}
|
|
❌ **FAILED** - Try the Python method or check logs
|
|
{% endif %}
|
|
notification_id: rest_login_updated
|
|
|
|
# Try alternative REST login
|
|
test_router_login_rest_alt:
|
|
alias: "Test Router Login (REST Alternative)"
|
|
description: "Test alternative REST command format"
|
|
mode: single
|
|
sequence:
|
|
- service: rest_command.router_login_alt
|
|
- delay:
|
|
seconds: 3
|
|
- service: persistent_notification.create
|
|
data:
|
|
title: "REST Login Test (Alternative)"
|
|
message: |
|
|
**Result:**
|
|
Token: {{ states('input_text.router_token')[:30] if states('input_text.router_token') not in ['unknown', '', 'unavailable'] else 'NOT FOUND' }}
|
|
|
|
{% if states('input_text.router_token') not in ['unknown', '', 'unavailable'] %}
|
|
✅ **SUCCESS!** Alternative REST format works.
|
|
{% else %}
|
|
❌ **FAILED** - Alternative format didn't work either
|
|
{% endif %}
|
|
notification_id: rest_login_alt
|
|
|
|
# Comprehensive test - tries everything
|
|
test_router_all_methods:
|
|
alias: "Test All Router Login Methods"
|
|
description: "Try all login methods and report which works"
|
|
mode: single
|
|
sequence:
|
|
# Clear token first
|
|
- service: input_text.set_value
|
|
target:
|
|
entity_id: input_text.router_token
|
|
data:
|
|
value: ""
|
|
- service: input_text.set_value
|
|
target:
|
|
entity_id: input_text.system_status
|
|
data:
|
|
value: "Testing all methods..."
|
|
|
|
# METHOD 1: Standard REST
|
|
- service: persistent_notification.create
|
|
data:
|
|
title: "Router Test Progress"
|
|
message: "Method 1/3: Testing standard REST command..."
|
|
notification_id: router_test_progress
|
|
- service: rest_command.router_login
|
|
continue_on_error: true
|
|
- delay:
|
|
seconds: 3
|
|
- service: input_text.set_value
|
|
target:
|
|
entity_id: input_text.router_token
|
|
data:
|
|
value: "" # Clear for next test
|
|
|
|
# METHOD 2: Alternative REST
|
|
- service: persistent_notification.create
|
|
data:
|
|
title: "Router Test Progress"
|
|
message: "Method 2/3: Testing alternative REST format..."
|
|
notification_id: router_test_progress
|
|
- service: rest_command.router_login_alt
|
|
continue_on_error: true
|
|
- delay:
|
|
seconds: 3
|
|
- service: input_text.set_value
|
|
target:
|
|
entity_id: input_text.router_token
|
|
data:
|
|
value: "" # Clear for next test
|
|
|
|
# METHOD 3: Python Script
|
|
- service: persistent_notification.create
|
|
data:
|
|
title: "Router Test Progress"
|
|
message: "Method 3/3: Testing Python script..."
|
|
notification_id: router_test_progress
|
|
- service: python_script.tplink_router_control
|
|
data:
|
|
action: login
|
|
username: ""
|
|
password: "23Pinkpr!ncesses"
|
|
continue_on_error: true
|
|
- delay:
|
|
seconds: 5
|
|
|
|
# Final Report
|
|
- service: persistent_notification.create
|
|
data:
|
|
title: "🔍 Router Test Complete"
|
|
message: |
|
|
**FINAL RESULTS:**
|
|
|
|
Token Status: {{ '✅ FOUND' if states('input_text.router_token') not in ['unknown', '', 'unavailable'] else '❌ NOT FOUND' }}
|
|
|
|
Token Value: {{ states('input_text.router_token')[:40] if states('input_text.router_token') not in ['unknown', '', 'unavailable'] else 'NONE' }}
|
|
|
|
System Status: {{ states('input_text.system_status') }}
|
|
|
|
Last Login: {{ states('input_text.last_router_login') }}
|
|
|
|
---
|
|
|
|
**RECOMMENDATION:**
|
|
{% if states('input_text.router_token') not in ['unknown', '', 'unavailable'] %}
|
|
✅ **SUCCESS!** At least one method worked.
|
|
Check which method was last in the logs.
|
|
Use that method for your scripts.
|
|
{% else %}
|
|
❌ **ALL METHODS FAILED**
|
|
|
|
Possible issues:
|
|
1. Router not reachable at 10.0.0.254
|
|
2. Wrong password
|
|
3. Firmware changed authentication
|
|
4. Router security blocking automation
|
|
|
|
Check Settings → System → Logs for details
|
|
{% endif %}
|
|
notification_id: router_test_final
|
|
|
|
# Debug script - shows current status
|
|
show_router_status:
|
|
alias: "Show Current Router Status"
|
|
description: "Display all router-related status info"
|
|
mode: single
|
|
sequence:
|
|
- service: persistent_notification.create
|
|
data:
|
|
title: "📊 Router Status"
|
|
message: |
|
|
**Current Status:**
|
|
|
|
**Connectivity:**
|
|
Router Ping: {{ states('binary_sensor.10_0_0_254') }}
|
|
|
|
**Authentication:**
|
|
Token: {{ states('input_text.router_token')[:40] if states('input_text.router_token') not in ['unknown', '', 'unavailable'] else 'NONE' }}
|
|
Username: {{ states('input_text.router_username') }}
|
|
Password Set: {{ 'YES' if states('input_text.router_password') not in ['unknown', '', 'unavailable'] else 'NO' }}
|
|
|
|
**Recent Activity:**
|
|
Last Login: {{ states('input_text.last_router_login') }}
|
|
Last Block Action: {{ states('input_text.last_block_action') }}
|
|
System Status: {{ states('input_text.system_status') }}
|
|
|
|
**Blocked Devices:**
|
|
Currently Blocked: {{ states('sensor.devices_currently_blocked') }} devices
|
|
notification_id: router_status
|
|
|
|
#New Chorew system
|
|
|
|
|