From 7dfe523c52caf49fca501ca86d92614619e16b43 Mon Sep 17 00:00:00 2001 From: Matt Way Date: Mon, 11 Dec 2023 07:30:27 +1100 Subject: [PATCH] Enable setting position from MQTT --- src/main.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 8b2bfe4..5587d9e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -20,7 +20,8 @@ RF24 radio(RF_CE_PIN, RF_CS_PIN); static const uint8_t rfID[2] = { 0xC8, 0x2E }; // 0x2EC8 PacketReceiver packetReceiver(&radio); -PacketBuilder remotePacketBuilder(0x369E, 0xAC, 0x82); +PacketBuilder remotePacketBuilder(0x369E, 0xAC, 0x82, 0x06); +PacketBuilder hubPacketBuilder(0x0000, 0x3D, 0x96, 0x05); EspMQTTClient client( SECRET_WIFI_SSID, // Wifi SSID @@ -151,7 +152,10 @@ void onConnectionEstablished() { }); client.subscribe("hotdog/test_mqtt_blind/set_position", [] (const String &payload) { - + uint16_t shadeID = 0x4EF1; + float percentage = payload.toInt() / 100.0f; + hubPacketBuilder.buildPositionPacket(buffer, shadeID, percentage); + sendCommand(buffer); }); client.publish("hotdog/availability", "online", true);