mirror of
https://github.com/alexhopeoconnor/arduino-home-assistant.git
synced 2026-10-04 02:48:13 +10:00
update tests, change state_class to stat_cla
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
PubSubClientMock::PubSubClientMock() :
|
||||
_pendingMessage(nullptr),
|
||||
_flushedMessages(nullptr),
|
||||
_keepAlive(15),
|
||||
_flushedMessagesNb(0),
|
||||
_subscriptions(nullptr),
|
||||
_subscriptionsNb(0),
|
||||
@@ -119,7 +120,7 @@ bool PubSubClientMock::beginPublish(
|
||||
}
|
||||
|
||||
_pendingMessage = new MqttMessage();
|
||||
_pendingMessage->retained = retained;
|
||||
_pendingMessage->retained = retained;
|
||||
|
||||
{
|
||||
size_t size = strlen(topic) + 1;
|
||||
|
||||
@@ -127,6 +127,12 @@ public:
|
||||
int endPublish();
|
||||
bool subscribe(const char* topic);
|
||||
|
||||
inline void setKeepAlive(uint16_t keepAlive)
|
||||
{ _keepAlive = keepAlive; }
|
||||
|
||||
inline uint16_t getKeepAlive() const
|
||||
{ return _keepAlive; }
|
||||
|
||||
inline uint8_t getFlushedMessagesNb() const
|
||||
{ return _flushedMessagesNb; }
|
||||
|
||||
@@ -137,7 +143,7 @@ public:
|
||||
{ return _subscriptionsNb; }
|
||||
|
||||
inline MqttSubscription** getSubscriptions() const
|
||||
{ return _subscriptions; }
|
||||
{ return _subscriptions; }
|
||||
|
||||
inline const MqttConnection& getConnection() const
|
||||
{ return _connection; }
|
||||
@@ -154,6 +160,7 @@ public:
|
||||
private:
|
||||
MqttMessage* _pendingMessage;
|
||||
MqttMessage** _flushedMessages;
|
||||
uint16_t _keepAlive;
|
||||
uint8_t _flushedMessagesNb;
|
||||
MqttSubscription** _subscriptions;
|
||||
uint8_t _subscriptionsNb;
|
||||
|
||||
@@ -40,7 +40,7 @@ const char HANameProperty[] PROGMEM = {"name"};
|
||||
const char HAUniqueIdProperty[] PROGMEM = {"uniq_id"};
|
||||
const char HADeviceProperty[] PROGMEM = {"dev"};
|
||||
const char HADeviceClassProperty[] PROGMEM = {"dev_cla"};
|
||||
const char HAStateClassProperty[] PROGMEM = {"state_class"};
|
||||
const char HAStateClassProperty[] PROGMEM = {"stat_cla"};
|
||||
const char HAIconProperty[] PROGMEM = {"ic"};
|
||||
const char HARetainProperty[] PROGMEM = {"ret"};
|
||||
const char HASourceTypeProperty[] PROGMEM = {"src_type"};
|
||||
|
||||
@@ -104,7 +104,7 @@ AHA_TEST(SensorTest, state_class_setter) {
|
||||
(
|
||||
"{"
|
||||
"\"uniq_id\":\"uniqueSensor\","
|
||||
"\"state_class\":\"measurement\","
|
||||
"\"stat_cla\":\"measurement\","
|
||||
"\"dev\":{\"ids\":\"testDevice\"},"
|
||||
"\"stat_t\":\"testData/testDevice/uniqueSensor/stat_t\""
|
||||
"}"
|
||||
|
||||
Reference in New Issue
Block a user