Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add support to receive and monitor itho RF-RFT and RF-RV remotes. feat: Add possibility to join devices (by join command or manually) to the lib and keep track of commands and values (co2, humidity, temp, battery) New lib functions: Manually add devices to the known devices list by ID: bool addRFDevice(uint8_t byte0, uint8_t byte1, uint8_t byte2); bool addRFDevice(uint32_t ID); Manually remove devices to the known devices list by ID: bool removeRFDevice(uint8_t byte0, uint8_t byte1, uint8_t byte2); bool removeRFDevice(uint32_t ID); Check is device is known by ID: bool checkRFDevice(uint8_t byte0, uint8_t byte1, uint8_t byte2); bool checkRFDevice(uint32_t ID); Allow (true/false) if devices are allowed to join (standard value: true): void setBindAllowed(bool input); Get join allowed status: bool getBindAllowed(); Receive and handle all devices (standard value: true, for backwards compatibility) void setAllowAll(bool input); Get allowed all devices status: bool getAllowAll(); Get reference to struct which contains all remotes and last known data (co2, temp etc.) const struct ithoRFDevices &getRFdevices() const; Sample code to walk to data and create a JSON: ``` DynamicJsonDocument doc(2000); JsonObject root = doc.to<JsonObject>(); const ithoRFDevices &rfDevices = rf.getRFdevices(); for (auto& item : rfDevices.device) { if (item.deviceId != 0) { char buf[10]; snprintf(buf, sizeof(buf), "%02X,%02X,%02X", item.deviceId >> 16 & 0xFF, item.deviceId >> 8 & 0xFF, item.deviceId & 0xFF); JsonObject nested = root.createNestedObject(buf); nested["lastcmd"] = item.lastCommand; if (item.co2 != 0xEFFF) { nested["co2"] = item.co2; } if (item.temp != 0xEFFF) { nested["temp"] = item.temp; } if (item.hum != 0xEFFF) { nested["hum"] = item.hum; } if (item.dewpoint != 0xEFFF) { nested["dewpoint"] = item.dewpoint; } if (item.battery != 0xEFFF) { nested["battery"] = item.battery; } } } ``` Example resulting JSON: ``` {"E0,58,45":{"lastcmd":4},"52,4E,9A":{"lastcmd":0},"97,95,A1":{"lastcmd":0,"temp":2079,"hum":52,"dewpoint":1062},"97,28,ED":{"lastcmd":0,"co2":1033}} ```
- Loading branch information