#pragma once #include #include #include #define PUBLISH_ENABLE_TOPIC "publish_enable" class DigitalInputIoT : public IoTComponent { public: bool begin(uint8_t card_id, ExpansionCard *card, PubSubClient *mqtt, char *base_topic); void handleMqttMessage(char *topic, char *payload); void publishDigitalInputs(); void publishDigitalInput(uint8_t pin); void setDigitalInputsPublishEnabled(bool enabled); void handleValueChange(uint8_t pin, uint8_t value); void registerChangeCallback(std::function callback); void publishReport(); void subscribe(); uint8_t getType(); private: std::function change_callback; bool digital_inputs_publish_enabled = false; DigitalInputCard *card; };