Multi-Protocol Bridge: ปัญหาใหญ่ของ Smart Home ยุคแรก
บ้านอัจฉริยะส่วนใหญ่ใช้อุปกรณ์หลากโปรโตคอล: กล้อง WiFi, สวิตช์ Zigbee, เซ็นเซอร์ Z-Wave, อินเวอร์เตอร์โซลาร์ Modbus และมิเตอร์ไฟ RS-485 แต่ละระบบมี app แยก ทำให้ไม่สามารถ automate ข้าม protocol ได้ Home Assistant ทำหน้าที่เป็น Universal Gateway รวมทุกอย่างใน platform เดียว
Protocol Stack และ Hardware
| Protocol | อุปกรณ์ตัวอย่าง | Adapter ที่ใช้ | |----------|----------------|---------------| | Zigbee | IKEA TRADFRI, Aqara sensors, Sonoff | Sonoff Zigbee 3.0 USB Dongle Plus (~700 บาท) | | Z-Wave | Fibaro motion, Yale door lock | Z-WaveMe RaZberry 7 GPIO hat (~2,500 บาท) | | WiFi | Shelly plugs, Tapo cameras | Native (ESPHome/Matter) | | Modbus RTU | Solaredge inverter, Eastron smart meter | Waveshare RS-485 USB (~400 บาท) | | Modbus TCP | Fronius inverter, ABB meter | Ethernet (native HA integration) |
Zigbee2MQTT Setup
ใช้ Zigbee2MQTT แทน HA Zigbee integration โดยตรง เพราะรองรับอุปกรณ์มากกว่า:
yaml # configuration.yaml (Zigbee2MQTT) serial: port: /dev/ttyUSB0 mqtt: base_topic: zigbee2mqtt server: mqtt://localhost:1883 advanced: network_key: GENERATE channel: 25
Zigbee2MQTT expose ทุก device เป็น MQTT topics → Home Assistant autodiscover ผ่าน MQTT integration
Modbus Solar Integration
อ่านค่าจากอินเวอร์เตอร์โซลาร์ผ่าน Modbus:
yaml modbus: - name: solar_inverter type: rtuovertcp host: 192.168.1.50 port: 502 sensors: - name: Solar Power unit_of_measurement: W slave: 1 address: 40083 input_type: holding scale: 0.01 - name: Grid Export unit_of_measurement: W slave: 1 address: 40085 input_type: holding scale: 0.01
Energy Sankey Diagram บน Lovelace
Home Assistant มี Energy Dashboard built-in แต่ Sankey chart ให้ visual ที่ดีกว่า ใช้ ha-sankey-chart custom card (HACS):
yaml type: custom:sankey-chart title: Energy Flow unit_prefix: k period: today sections: - entities: - entity_id: sensor.solar_power name: Solar color: gold - entities: - entity_id: sensor.grid_import name: Grid color: red - entities: - entity_id: sensor.home_consumption name: Home color: blue - entity_id: sensor.ev_charging name: EV color: green - entity_id: sensor.grid_export name: Export color: lightgreen
Unified Security + Air + Solar ใน Single Dashboard
Lovelace dashboard รวม: - Security status: arm/disarm, door/window states, camera thumbnails - Air quality: PM2.5, CO2, IAQ composite score, purifier status - Energy flow: Sankey + current solar/grid/consumption numbers - Presence: home/away mode, person locations ใช้ Mushroom Cards (HACS) สร้าง chip row ที่ compact:
yaml type: custom:mushroom-chips-card chips: - type: entity entity: alarm_control_panel.home_alarm - type: entity entity: sensor.iaq_composite_score - type: entity entity: sensor.solar_power - type: entity entity: person.tony
ประโยชน์จาก Multi-Protocol Unity
เมื่อรวมทุก protocol ใน platform เดียว automation ที่เป็นไปไม่ได้ก่อนหน้านี้กลายเป็นเรื่องง่าย: - เมื่อ Z-Wave door lock เปิด → เปิดไฟ Zigbee + ปิด security + เช็ค WiFi camera - เมื่อ solar export เป็น 0 (กลางคืน) → ปรับ Modbus inverter mode + shift EV charging - เมื่อ air quality ไม่ดี + มีคนอยู่บ้าน → เปิด Zigbee purifier switch + ปรับ ERV Modbus