mcpField
H
Home Assistant Automation

Home Assistant Automation

github.com/claude-office-skills其他5454.9k 次安装39 周前更新
代码仓库

关于 Home Assistant Automation

Home Assistant Automation 是面向 Home Assistant 智能家居配置的技能,用于编排设备控制、自动化和场景。内容还涵盖语音命令、能耗监测与安防示例。

主要功能

  1. 01控制灯光等设备
  2. 02编写基于时间或状态的自动化
  3. 03配置设备场景
  4. 04设置语音命令
  5. 05规划能耗与安防自动化

适用场景

  1. 01按时间或传感器状态触发灯光
  2. 02创建观影灯光场景
  3. 03根据语音意图控制恒温器
  4. 04配置运动检测与能耗监测

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/claude-office-skills/skills --skill home-assistant-automation

安装后在 Claude Code 中输入/home-assistant-automation确认已加载。

详细介绍

Home Assistant 自动化

自动化智能家居设备,并创建智能自动化工作流。

核心功能

设备控制
device_commands:
  lights:
    - turn_on:
        entity_id: light.living_room
        brightness_pct: 80
        color_temp: 350
    - turn_off:
        entity_id: light.all_lights
        
  climate:
    - set_temperature:
        entity_id: climate.main_thermostat
        temperature: 72
        hvac_mode: heat
        
  media:
    - media_play_pause:
        entity_id: media_player.living_room_tv
    - volume_set:
        entity_id: media_player.sonos
        volume_level: 0.5
自动化模板
automations:
  morning_routine:
    trigger:
      - platform: time
        at: "06:30:00"
      - platform: state
        entity_id: binary_sensor.alarm
        to: "off"
    condition:
      - condition: state
        entity_id: person.owner
        state: "home"
    action:
      - service: light.turn_on
        target:
          entity_id: light.bedroom
        data:
          brightness_pct: 30
          transition: 300
      - service: climate.set_temperature
        data:
          temperature: 72
      - delay: "00:05:00"
      - service: media_player.play_media
        data:
          media_content_type: music
          media_content_id: "news_briefing"

  away_mode:
    trigger:
      platform: state
      entity_id: group.family
      to: "not_home"
      for: "00:10:00"
    action:
      - service: climate.set_preset_mode
        data:
          preset_mode: away
      - service: light.turn_off
        target:
          entity_id: all
      - service: lock.lock
        target:
          entity_id: lock.front_door
场景
scenes:
  movie_night:
    entities:
      light.living_room:
        state: on
        brightness: 20
        color_temp: 500
      light.tv_backlight:
        state: on
        rgb_color: [0, 0, 255]
      media_player.soundbar:
        state: on
        source: "TV"
      cover.blinds:
        state: closed
        
  good_night:
    entities:
      light.all_lights:
        state: off
      lock.all_locks:
        state: locked
      alarm_control_panel.home:
        state: armed_night
      climate.thermostat:
        temperature: 68
语音命令
voice_intents:
  - intent: "Turn on the lights"
    action: light.turn_on
    entity: light.all_lights
    
  - intent: "Set temperature to {temp}"
    action: climate.set_temperature
    entity: climate.thermostat
    data:
      temperature: "{{ temp }}"
      
  - intent: "I'm leaving"
    action: script.away_mode

集成示例

能源监控
energy_dashboard:
  sensors:
    - sensor.electricity_usage
    - sensor.solar_production
    - sensor.battery_level
  automations:
    - name: "Off-peak charging"
      trigger:
        platform: time
        at: "00:00:00"
      action:
        service: switch.turn_on
        entity_id: switch.ev_charger
安全系统
security:
  motion_detection:
    trigger:
      platform: state
      entity_id: binary_sensor.motion_front
      to: "on"
    condition:
      - condition: state
        entity_id: alarm_control_panel.home
        state: armed_away
    action:
      - service: camera.snapshot
        entity_id: camera.front_door
      - service: notify.mobile_app
        data:
          message: "Motion detected at front door"
          data:
            image: "/local/snapshots/front_door.jpg"

最佳实践

  1. 实体命名:使用一致的命名规范
  2. 分组:按逻辑组织设备
  3. 条件:始终添加适当的条件
  4. 通知:不要发送过多通知
  5. 测试:彻底测试自动化
  6. 备份:定期备份配置

评论

支持 Markdown