1 #pragma once 2 3 #include "DomoticzHardware.h" 4 #include "hardwaretypes.h" 5 6 namespace Json 7 { 8 class Value; 9 }; 10 11 class CHoneywell : public CDomoticzHardwareBase 12 { 13 public: 14 CHoneywell(const int ID, const std::string &Username, const std::string &Password, const std::string &Extra); 15 ~CHoneywell(void); 16 bool WriteToHardware(const char *pdata, const unsigned char length) override; 17 private: 18 void SetSetpoint(const int idx, const float temp, const int nodeid); 19 void SetPauseStatus(const int idx, bool bHeating, const int nodeid); 20 void SendSetPointSensor(const unsigned char Idx, const float Temp, const std::string &defaultname); 21 bool refreshToken(); 22 void Init(); 23 bool StartHardware() override; 24 bool StopHardware() override; 25 void Do_Work(); 26 void GetThermostatData(); 27 private: 28 std::string mApiKey; 29 std::string mApiSecret; 30 std::string mAccessToken; 31 std::string mRefreshToken; 32 time_t mTokenExpires = { 0 }; 33 std::string mThermostatID; 34 int mOutsideTemperatureIdx; 35 bool mIsStarted; 36 std::shared_ptr<std::thread> m_thread; 37 std::vector<std::string> mSessionHeaders; 38 std::map<int, Json::Value> mDeviceList; 39 std::map<int, std::string> mLocationList; 40 int mLastMinute; 41 }; 42