#pragma once #include "Protocol.h" #include "TinyComponent.h" class Protocol_2 : public Protocol { public: Protocol_2() : Protocol(PROTOCOL_2) {} void toJson(unsigned long value, JsonDocument& jsonDoc) override { switch (value) { case 637541753L: case 771759481L: { JsonObject motion = jsonDoc.createNestedObject("motion"); motion["kitchen"] = value == 637541753L ? "on" : "off"; break; } case 1879048230L: case 1879048198L: { JsonObject motion = jsonDoc.createNestedObject("motion"); motion["basement"] = value == 1879048230L ? "on" : "off"; break; } default: StaticJsonDocument<200> jsonSensor; if (buildSensorJson(value, jsonSensor)) { jsonDoc.set(jsonSensor); } else { Protocol::toJson(value, jsonDoc); } break; } } } protocol2;