소스 정보
- 저장소
- personamanagmentlayer/pcl
- 최근 소스 활동
- 2026년 1월 19일 22:04
- 감지된 SKILL.md 언어
- 영어
- 스타
- 40
- 포크
- 9
설치 방법
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
소스 파일 검토
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
메뉴
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
직접 명령은 검토 Prompt를 거치지 않습니다. 실행하기 전에 소스를 확인하세요.
npx skills add https://github.com/personamanagmentlayer/pcl --skill iot-expert명령은 한 줄로 유지됩니다. 복사하기 전에 가로로 스크롤해 전체 내용을 확인하세요.
로컬 사본을 원하시나요? SkillsMP에서 현재 제공할 수 있는 파일을 다운로드하세요.
SOC 직업 분류 기준
SKILL.md 표시 중
| name | iot-expert |
| version | 1.0.0 |
| description | Expert-level IoT systems, embedded devices, edge computing, and IoT protocols |
| category | domains |
| tags | ["iot","embedded","edge-computing","mqtt","sensors","firmware"] |
| allowed-tools | ["Read","Write","Edit"] |
Expert guidance for IoT systems, embedded devices, edge computing, sensor networks, and IoT protocols.
import paho.mqtt.client as mqtt
import json
from datetime import datetime
from typing import Callable, Dict
class MQTTClient:
def __init__(self, broker: str, port: int = 1883, client_id: str = "iot_device"):
self.broker = broker
self.port = port
self.client = mqtt.Client(client_id)
self.subscriptions: Dict[str, Callable] = {}
self.client.on_connect = self._on_connect
self.client.on_message = self._on_message
self.client.on_disconnect = self._on_disconnect
def _on_connect(self, client, userdata, flags, rc):
if rc == 0:
print(f"Connected to MQTT broker at {self.broker}:{self.port}")
# Resubscribe to topics on reconnect
for topic in self.subscriptions.keys():
self.client.subscribe(topic)
:
()
():
topic = msg.topic
payload = msg.payload.decode()
topic .subscriptions:
:
data = json.loads(payload)
.subscriptions[topic](data)
json.JSONDecodeError:
.subscriptions[topic](payload)
():
rc != :
()
():
username password:
.client.username_pw_set(username, password)
.client.connect(.broker, .port, )
.client.loop_start()
():
message = json.dumps(payload)
result = .client.publish(topic, message, qos=qos, retain=retain)
result.rc == mqtt.MQTT_ERR_SUCCESS
():
.subscriptions[topic] = callback
.client.subscribe(topic, qos=qos)
():
.client.loop_stop()
.client.disconnect()
:
():
.device_id = device_id
.mqtt = mqtt_client
.topic =
() -> :
random
(random.uniform(, ), )
():
temperature = .read_temperature()
payload = {
: .device_id,
: temperature,
: ,
: datetime.utcnow().isoformat()
}
.mqtt.publish(.topic, payload)
payload
// Arduino/ESP32 Example
#include <WiFi.h>
#include <PubSubClient.h>
#include "DHT.h"
#define DHTPIN 4
#define DHTTYPE DHT22
const char* ssid = "YourWiFiSSID";
const char* password = "YourPassword";
const char* mqtt_server = "broker.example.com";
WiFiClient espClient;
PubSubClient client(espClient);
DHT dht(DHTPIN, DHTTYPE);
void setup_wifi() {
delay(10);
Serial.println("Connecting to WiFi...");
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
}
void callback(char* topic, byte* payload, unsigned int length) {
Serial.print("Message arrived [");
Serial.print(topic);
Serial.print("] ");
for (int i = 0; i < length; i++) {
Serial.print((char)payload[i]);
}
Serial.println();
}
{
(!client.connected()) {
Serial.print();
(client.connect()) {
Serial.println();
client.subscribe();
} {
Serial.print();
Serial.print(client.state());
Serial.println();
delay();
}
}
}
{
Serial.begin();
setup_wifi();
client.setServer(mqtt_server, );
client.setCallback(callback);
dht.begin();
}
{
(!client.connected()) {
reconnect();
}
client.loop();
lastRead = ;
(millis() - lastRead > ) {
humidity = dht.readHumidity();
temperature = dht.readTemperature();
(!isnan(humidity) && !isnan(temperature)) {
msg[];
(msg, (msg),
,
temperature, humidity);
client.publish(, msg);
Serial.println(msg);
}
lastRead = millis();
}
}
import asyncio
from typing import Dict, List
import numpy as np
class EdgeProcessor:
"""Process data at edge before sending to cloud"""
def __init__(self, buffer_size: int = 100):
self.buffer: List[Dict] = []
self.buffer_size = buffer_size
def add_reading(self, reading: Dict):
"""Add sensor reading to buffer"""
self.buffer.append(reading)
if len(self.buffer) >= self.buffer_size:
self.process_buffer()
def process_buffer(self) -> Dict:
"""Process buffered data at edge"""
if not self.buffer:
return {}
# Extract temperature values
temperatures = [r['temperature'] for r in self.buffer]
# Compute statistics at edge
summary = {
"count": len(temperatures),
: np.mean(temperatures),
: np.std(temperatures),
: np.(temperatures),
: np.(temperatures),
: .detect_anomalies(temperatures)
}
.buffer = []
summary
() -> []:
mean = np.mean(values)
std = np.std(values)
threshold =
anomalies = []
i, v (values):
(v - mean) > threshold * std:
anomalies.append(i)
anomalies
:
():
.mqtt = mqtt_client
.edge_processor = EdgeProcessor()
.devices: [, TemperatureSensor] = {}
():
.devices[device.device_id] = device
topic =
.mqtt.subscribe(topic, .handle_device_data)
():
.edge_processor.add_reading(data)
():
:
device .devices.values():
reading = device.publish_reading()
()
asyncio.sleep(interval)
from datetime import datetime
from enum import Enum
class DeviceStatus(Enum):
ONLINE = "online"
OFFLINE = "offline"
MAINTENANCE = "maintenance"
ERROR = "error"
class IoTDevice:
def __init__(self, device_id: str, device_type: str):
self.device_id = device_id
self.device_type = device_type
self.status = DeviceStatus.OFFLINE
self.last_seen = None
self.firmware_version = "1.0.0"
self.metadata = {}
def update_status(self, status: DeviceStatus):
self.status = status
self.last_seen = datetime.utcnow()
def needs_firmware_update(self, latest_version: str) -> bool:
return self.firmware_version < latest_version
class DeviceManager:
def __init__(self):
self.devices: Dict[str, IoTDevice] = {}
():
.devices[device.device_id] = device
():
device_id .devices:
.devices[device_id].update_status(DeviceStatus.ONLINE)
() -> [IoTDevice]:
offline = []
now = datetime.utcnow()
device .devices.values():
device.last_seen:
elapsed = (now - device.last_seen).total_seconds()
elapsed > timeout_seconds:
offline.append(device)
offline
():
device_id .devices:
payload = {
: ,
: new_version,
:
}
payload
❌ No power management strategy ❌ Unencrypted communications ❌ No error handling for network failures ❌ Sending all raw data to cloud ❌ No device authentication ❌ Hard-coded credentials in firmware ❌ No OTA update mechanism