Skip to content

Commit fb13280

Browse files
committed
feat(rf): add CC1101 transceiver support, merge X10 RF protocol and bump to v1.2.66
- Add support for TI CC1101 SPI sub-GHz transceivers in rf-transceiver and ir-rf-transceiver - Merge X10 RF transceiver into rf-transceiver and deprecate standalone x10-transceiver env - Support dynamic X10 device mappings (x10-devs) with scheduling and event automation - Add ModuleType definitions for Siren, Fan, Shutter, and DoorLock - Add before/after transmit callback hooks to RFTransmitter and X10RFTransmitter - Update LiteScriptHandler to signal FX.Style events on script change - Add deserialization error handling in EventRouter for schedule rules - Update documentation and Web API references for CC1101 and UPnP auto-discovery - Bump version to 1.2.66
1 parent 97541df commit fb13280

25 files changed

Lines changed: 627 additions & 151 deletions

README.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ HomeGenie Mini provides several specialized configurations and ready-to-use firm
7777
- 📷 [**Smart Camera + A.I.**](https://homegenie.it/mini/1.2/smart-camera-ai/): Implements video streaming and object tracking logic using ESP32-CAM models.
7878
- 💡 [**Smart Light / Mood Lamp**](https://homegenie.it/mini/1.2/smart-light/): Controls WS281x RGB LED strips with automated transitions, schedules, and custom animations.
7979
- 🌡️ [**Smart Sensor**](https://homegenie.it/mini/1.2/smart-sensor/): Gathers data from DHT22, LDR, and motion sensors with low overhead.
80-
- 📟 [**Remote Control & Gateway**](https://homegenie.it/mini/1.2/remote-control/): A transceiver gateway to capture and replay IR/RF commands.
80+
- 📟 [**Remote Control & Gateway**](https://homegenie.it/mini/1.2/remote-control/): A multi-protocol transceiver gateway (Firefly Kit) to capture, replay, and bridge IR, generic 433/315 MHz RF (SYN modules or CC1101 SPI), and bidirectional **X10 RF** home automation devices.
8181

8282
---
8383

@@ -103,9 +103,16 @@ Once connected, your device will appear in the HomeGenie Panel dashboard.
103103

104104
### Connecting to HomeGenie Server
105105

106-
HomeGenie Mini devices can communicate with [HomeGenie Server](https://github.com/genielabs/HomeGenie) and other brokers by configuring the MQTT client as shown below:
106+
HomeGenie Mini devices feature zero-configuration network discovery and seamless integration with [HomeGenie Server](https://github.com/genielabs/HomeGenie):
107107

108-
![HomeGenie Server - MQTT configuration](data/images/phone/hg_server_mqtt_config.png)
108+
1. **Automatic Discovery (UPnP/SSDP):**
109+
Once connected to your local Wi-Fi network, your HomeGenie Mini device is automatically detected by HomeGenie Server and appears as a device card in the **UPnP** dashboard group.
110+
111+
2. **One-Click MQTT Connection:**
112+
Click the **`CONNECT`** button on the device card. HomeGenie Server will automatically provision and establish the secure MQTT communication link in the background—no manual broker configuration required.
113+
114+
3. **Browse Modules & Add Dashboard Widgets:**
115+
Once connected, click the **`MODULES`** button to view all hardware endpoints exposed by the device (e.g., *IR Transceiver*, *RC RF*, *Color Light*, *X10 Devices*). From the popup dialog, you can select any module and add its interactive widget directly to your preferred dashboard groups.
109116

110117
---
111118

examples/color-light/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ In addition to default system options the following configuration options are av
1212
| Key | Description | Default |
1313
|------------|-----------------------------|-----------------------------------------|
1414
| `leds-pin` | LED strip GPIO pin number | -1 (-1=not used) |
15-
| `leds-cnt` | Number of LEDs | 1 (1 - 1024) |
15+
| `leds-cnt` | Number of LEDs | 1 (1 - 4096) |
1616
| `leds-rws` | Number of matrix rows | 1 (1 - 64) |
17-
| `leds-vrt` | Matrix vertical wiring | false (false=horizontal, true=vertical) |
1817
| `leds-srp` | Serpentine cabling layout | true (false=progressive, true=serp.) |
18+
| `leds-vrt` | Matrix vertical wiring | false (false=horizontal, true=vertical) |
1919
| `leds-stb` | Start layout at bottom | false (false=start top, true=bottom) |
2020
| `leds-str` | Start layout at right | false (false=start left, true=right) |
2121
| `leds-spd` | Data transfer speed | 0 (0=800kHz, 256=400kHz) |

examples/color-light/api/LiteScriptHandler.cpp

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,27 @@
1-
//
2-
// Created by gene on 06/06/26.
3-
//
1+
/*
2+
* HomeGenie-Mini (c) 2018-2026 G-Labs
3+
*
4+
*
5+
* This file is part of HomeGenie-Mini (HGM).
6+
*
7+
* HomeGenie-Mini is free software: you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License as published by
9+
* the Free Software Foundation, either version 3 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* HomeGenie-Mini is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with HomeGenie-Mini. If not, see <http://www.gnu.org/licenses/>.
19+
*
20+
*
21+
* Authors:
22+
* - Generoso Martello <gene@homegenie.it>
23+
*
24+
*/
425

526
#include "LiteScriptHandler.h"
627

@@ -37,8 +58,7 @@ namespace Service { namespace API {
3758

3859
startTime = millis();
3960
responseCallback->writeAll(ApiHandlerResponseStatus::OK);
40-
41-
currentStyleIndex = 20; // switch to `SCRIPT` fx to show result
61+
switchToScriptFx();
4262

4363
return true;
4464
}
@@ -47,8 +67,7 @@ namespace Service { namespace API {
4767
liteScript.clear();
4868
compiledScript.clear(); // Ensure the binary buffer is also cleared
4969
responseCallback->writeAll(ApiHandlerResponseStatus::OK);
50-
51-
currentStyleIndex = 20; // switch to `SCRIPT` fx to show result
70+
switchToScriptFx();
5271

5372
return true;
5473
}
@@ -63,10 +82,17 @@ namespace Service { namespace API {
6382
}
6483

6584
Module * LiteScriptHandler::getModule(const char *domain, const char *address) {
66-
return nullptr;
85+
return module;
6786
}
6887

6988
LinkedList<Module *> * LiteScriptHandler::getModuleList() {
7089
return &moduleList;
7190
}
91+
92+
void LiteScriptHandler::switchToScriptFx() {
93+
currentStyleIndex = 20; // switch to `SCRIPT` fx to show result
94+
auto msg = std::make_shared<QueuedMessage>(module, "FX.Style", "script");
95+
module->setProperty("FX.Style", "script");
96+
HomeGenie::getInstance()->getEventRouter().signalEvent(msg);
97+
}
7298
}}

examples/color-light/api/LiteScriptHandler.h

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,32 @@
1-
//
2-
// Created by gene on 06/06/26.
3-
//
1+
/*
2+
* HomeGenie-Mini (c) 2018-2026 G-Labs
3+
*
4+
*
5+
* This file is part of HomeGenie-Mini (HGM).
6+
*
7+
* HomeGenie-Mini is free software: you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License as published by
9+
* the Free Software Foundation, either version 3 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* HomeGenie-Mini is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with HomeGenie-Mini. If not, see <http://www.gnu.org/licenses/>.
19+
*
20+
*
21+
* Authors:
22+
* - Generoso Martello <gene@homegenie.it>
23+
*
24+
*/
425

526
#ifndef HOMEGENIE_MINI_LITESCRIPTHANDLER_H
627
#define HOMEGENIE_MINI_LITESCRIPTHANDLER_H
728

29+
#include "HomeGenie.h"
830
#include "service/api/APIHandler.h"
931

1032
#include "../fx/fx_script_utils.h"
@@ -14,7 +36,12 @@ namespace Service { namespace API {
1436
class LiteScriptHandler : public APIHandler {
1537
private:
1638
LinkedList<Module*> moduleList;
39+
void switchToScriptFx();
1740
public:
41+
LiteScriptHandler(Module* module) {
42+
this->module = module;
43+
}
44+
1845
void init() override;
1946
bool canHandleDomain(String* domain) override;
2047
bool handleRequest(APIRequest*, ResponseCallback*) override;
@@ -25,9 +52,10 @@ namespace Service { namespace API {
2552
Module* getModule(const char* domain, const char* address) override;
2653
LinkedList<Module*>* getModuleList() override;
2754

55+
Module* module;
2856
String liteScript;
2957
std::vector<uint8_t> compiledScript;
30-
unsigned long startTime;
58+
unsigned long startTime{};
3159
};
3260

3361
}}

examples/color-light/color-light.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ void setup() {
9898
// Setup example schedules/scenes
9999
setupDefaultSchedules();
100100

101-
scriptHandler = new LiteScriptHandler();
101+
scriptHandler = new LiteScriptHandler(module);
102102
homeGenie->addAPIHandler(scriptHandler);
103103
#endif
104104

examples/ir-rf-transceiver/ir-rf-transceiver.cpp

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* HomeGenie-Mini (c) 2018-2025 G-Labs
2+
* HomeGenie-Mini (c) 2018-2026 G-Labs
33
*
44
*
55
* This file is part of HomeGenie-Mini (HGM).
@@ -34,6 +34,7 @@
3434

3535
#include "../rf-transceiver/io/RFReceiver.h"
3636
#include "../rf-transceiver/io/RFTransmitter.h"
37+
#include "../rf-transceiver/io/CC1101Transceiver.h"
3738
#include "../rf-transceiver/api/RCSwitchHandler.h"
3839

3940
#include "../x10-transceiver/io/X10RFReceiver.h"
@@ -48,6 +49,7 @@ StatusLed statusLed;
4849
using namespace Service;
4950

5051
HomeGenie* homeGenie;
52+
CC1101Transceiver cc1101;
5153

5254
void setup() {
5355
// Default name shown in SNMP/UPnP advertising
@@ -62,28 +64,32 @@ void setup() {
6264
statusLed.setup();
6365
#endif
6466

67+
// Read pin configuration
68+
uint8_t irReceiverPin = Config::getSetting("irrc-pin", CONFIG_IRReceiverPin).toInt();
69+
uint8_t irTransmitterPin = Config::getSetting("irtr-pin", CONFIG_IRTransmitterPin).toInt();
70+
uint8_t rfReceiverPin = Config::getSetting("rfrc-pin", CONFIG_RCSwitchReceiverPin).toInt();
71+
uint8_t rfTransmitterPin = Config::getSetting("rftr-pin", CONFIG_RCSwitchTransmitterPin).toInt();
72+
6573
// IR transceiver
6674

6775
auto irApiHandler = new IRTransceiverHandler();
6876
// IR receiver
69-
uint8_t irReceiverPin = Config::getSetting("irrc-pin", CONFIG_IRReceiverPin).toInt();
7077
if (irReceiverPin > 0) {
7178
auto receiverConfiguration = new IR::IRReceiverConfig(irReceiverPin);
7279
auto receiver = new IR::IRReceiver(receiverConfiguration);
7380
irApiHandler->setReceiver(receiver);
7481
homeGenie->addIOHandler(receiver);
7582
}
7683
// IR transmitter
77-
uint8_t irTransmitterPin = Config::getSetting("irtr-pin", CONFIG_IRTransmitterPin).toInt();
7884
if (irTransmitterPin > 0) {
7985
auto transmitterConfig = new IR::IRTransmitterConfig(irTransmitterPin);
8086
auto transmitter = new IR::IRTransmitter(transmitterConfig);
8187
irApiHandler->setTransmitter(transmitter);
8288
}
8389
homeGenie->addAPIHandler(irApiHandler);
8490

85-
uint8_t rfReceiverPin = Config::getSetting("rfrc-pin", CONFIG_RCSwitchReceiverPin).toInt();
86-
uint8_t rfTransmitterPin = Config::getSetting("rftr-pin", CONFIG_RCSwitchTransmitterPin).toInt();
91+
// CC1101 sub-GHz RF Module auto-detect
92+
cc1101.begin(rfReceiverPin, rfTransmitterPin);
8793

8894
// RC-Switch RF transceiver
8995

@@ -98,6 +104,7 @@ void setup() {
98104
if (rfTransmitterPin > 0) {
99105
auto rcsTransmitterConfig = new RCS::RFTransmitterConfig(rfTransmitterPin);
100106
auto rcsTransmitter = new RCS::RFTransmitter(rcsTransmitterConfig);
107+
cc1101.bindTransmitter(rcsTransmitter);
101108
rcsApiHandler->setTransmitter(rcsTransmitter);
102109
}
103110
// RCSwitch RF Receiver
@@ -107,7 +114,9 @@ void setup() {
107114
homeGenie->addIOHandler(rcsReceiver);
108115
// shared interrupt handler with X10 class
109116
X10RFReceiver::addInterruptHandler([rcsReceiver](){
110-
rcsReceiver->handleInterrupt();
117+
if (!cc1101.isTransmitting()) {
118+
rcsReceiver->handleInterrupt();
119+
}
111120
});
112121
rcsApiHandler->setReceiver(rcsReceiver);
113122
}
@@ -127,6 +136,7 @@ void setup() {
127136
if (rfTransmitterPin > 0) {
128137
auto x10TransmitterConfig = new X10::X10RFTransmitterConfig(rfTransmitterPin);
129138
auto x10Transmitter = new X10::X10RFTransmitter(x10TransmitterConfig);
139+
cc1101.bindTransmitter(x10Transmitter);
130140
x10ApiHandler->setTransmitter(x10Transmitter);
131141
}
132142
// X10 RF RFReceiver
@@ -140,6 +150,8 @@ void setup() {
140150
homeGenie->addAPIHandler(x10ApiHandler);
141151

142152
homeGenie->begin();
153+
154+
cc1101.startListening();
143155
}
144156

145157

examples/ir-transceiver/api/IRTransceiverHandler.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* HomeGenie-Mini (c) 2018-2024 G-Labs
2+
* HomeGenie-Mini (c) 2018-2026 G-Labs
33
*
44
*
55
* This file is part of HomeGenie-Mini (HGM).
@@ -55,9 +55,13 @@ namespace Service { namespace API {
5555

5656
moduleList.add(irModule);
5757

58-
transmitter->begin();
59-
//receiver->begin(); <-- this is already done automatically by "IIOEventSender" parent class
60-
receiver->setModule(irModule);
58+
if (transmitter != nullptr) {
59+
transmitter->begin();
60+
}
61+
if (receiver != nullptr) {
62+
//receiver->begin(); <-- this is already done automatically by "IIOEventSender" parent class
63+
receiver->setModule(irModule);
64+
}
6165
}
6266

6367
bool IRTransceiverHandler::handleRequest(APIRequest *command, ResponseCallback* responseCallback) {

examples/ir-transceiver/api/IRTransceiverHandler.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* HomeGenie-Mini (c) 2018-2024 G-Labs
2+
* HomeGenie-Mini (c) 2018-2026 G-Labs
33
*
44
*
55
* This file is part of HomeGenie-Mini (HGM).
@@ -42,8 +42,8 @@ namespace Service { namespace API {
4242
private:
4343
LinkedList<Module*> moduleList;
4444
ModuleParameter* rawDataParameter{};
45-
IRTransmitter* transmitter = nullptr;
46-
IRReceiver* receiver = nullptr;
45+
IRTransmitter* transmitter{};
46+
IRReceiver* receiver{};
4747
public:
4848
void setReceiver(IRReceiver*);
4949
void setTransmitter(IRTransmitter*);

0 commit comments

Comments
 (0)