能源管控程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

45 lines
1.2 KiB

  1. #ifndef MqttHelper_h
  2. #define MqttHelper_h
  3. #include <Arduino.h>
  4. #include <WiFi.h>
  5. #include <PubSubClient.h>
  6. #include <MQTT.h>
  7. class MqttHelper
  8. {
  9. private:
  10. const char *id = "HBL1";
  11. const char *psw = "bpa.1qaz@WSX";
  12. const char *mqttServer = "10.2.1.21";
  13. const int mqttPort = 1883; //服务器TCP协议的端口号
  14. const char *mqttUser = "emqx_u_block"; //登录服务器所需的用户名
  15. const char *mqttPsw = "emqx_p_admin8765490789"; //密码
  16. const char *HeartbeatTopic = "UP/ENERGY_POWER/BUSINESS/0";
  17. // const char *id = "pert";
  18. // const char *psw = "12345678";
  19. // const char *mqttServer = "111.9.47.105";
  20. // const int mqttPort = 18883; //服务器TCP协议的端口号
  21. // const char *mqttUser = "admin"; //登录服务器所需的用户名
  22. // const char *mqttPsw = "admin8765490789"; //密码
  23. // const char *HeartbeatTopic = "UP/ENERGY_POWER/BUSINESS/0";
  24. String clientId;
  25. public:
  26. MqttHelper(/* args */);
  27. ~MqttHelper();
  28. void Init();
  29. void Loop();
  30. void publish(String message);
  31. void ReConnect();
  32. };
  33. extern MqttHelper _mqttHelper;
  34. #endif