Yapay zekâ tarafından English dilinden çevrildi ·
İki yıl önce tam olarak bunu, boya atölyemizin yemekhanesinin üstündeki çatı aydınlatmalarında yaptım. İhtiyacınız olan şey pencere üreticisinin KLF 200 arayüzü (LAN portlu io-homecontrol ağ geçidi). Her pencereyi, yeni bir tuş takımı eşleştirir gibi bu cihaza eşleştirirsiniz; ardından cihaz LAN üzerinde yerel bir API sunar. Pi üzerinde ona bağlanan Python kütüphanesi pyvlx var. Önce KLF 200’ü güncel firmware’e yükseltin, eski sürümde API yok, ayrıca cihazı kendi Wi-Fi’sine değil kabloyla bağlayın.Ardından yağmur mantığını Pi yerelde çalıştırsın; “yağmurda kapat” komutunu buluta göndermezdim, internet kesildiğinde de çalışmalı:
if rain_contact_closed() and any_open():
await pyvlx.nodes[n].close(wait_for_completion=False)
# every 30 s, and after each move:
payload = {f"win{n:02d}.pos": node.position.position_percent for n, node in enumerate(nodes)}
mqtt.publish("v1/telemetry", json.dumps(payload), qos=1)
Pencerelerden konum bilgisi geri geldiği için gerçek geri bildirim alırsınız, 0 = kapalı. Panodaki aç/kapat düğmeleri için, Pi’nin cihaz profiline pencere numarası parametreli win.close gibi komutlar ekleyin, bunları v1/rpc/req/+ üzerinde işleyin ve yanıtı aynı id üzerinden verin. Pano kontrolleri yalnızca profilin kataloğundaki Basic seviye komutları gönderebilir; bu bu iş için yeterli. Bkz. Control cards.KLF 200 aynı anda yalnızca birkaç API bağlantısını kabul eder, bu yüzden betiğinizde uzun ömürlü tek bir bağlantı tutun.
Did exactly this on the roof lights over our paint shop canteen two years ago. What you want is the window maker’s KLF 200 interface (the io-homecontrol gateway with a LAN port). You pair each window into it like you would a new keypad, then it gives you a local API on the LAN. On the Pi there’s a Python library, pyvlx, that talks to it. Update the KLF 200 to the current firmware first, the old one has no API, and connect it by cable, not its own Wi-Fi.
Then the Pi does the rain logic locally, I would not run “close on rain” through the cloud, it has to work when the internet is down:
if rain_contact_closed() and any_open():
await pyvlx.nodes[n].close(wait_for_completion=False)
# every 30 s, and after each move:
payload = {f"win{n:02d}.pos": node.position.position_percent for n, node in enumerate(nodes)}
mqtt.publish("v1/telemetry", json.dumps(payload), qos=1)
Positions come back from the windows so you get real feedback, 0 = closed. For the open/close buttons on the dashboard, add commands like win.close with a window number parameter to the Pi’s device profile, handle them on v1/rpc/req/+ and answer on the same id. Board controls can only send Basic tier commands from the profile’s catalogue, which is fine for this. See Control cards.
The KLF 200 only takes a couple of API connections at a time, so keep one long-lived connection in your script.

