Skip to content

Commit f642ec8

Browse files
committed
Added optional description when presenting sensors.
1 parent 387aaba commit f642ec8

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

libraries/MySensors/MySensor.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -483,8 +483,8 @@ void MySensor::sendBatteryLevel(uint8_t value, bool enableAck) {
483483
sendRoute(build(msg, nc.nodeId, GATEWAY_ADDRESS, NODE_SENSOR_ID, C_INTERNAL, I_BATTERY_LEVEL, enableAck).set(value));
484484
}
485485

486-
void MySensor::present(uint8_t childSensorId, uint8_t sensorType, bool enableAck) {
487-
sendRoute(build(msg, nc.nodeId, GATEWAY_ADDRESS, childSensorId, C_PRESENTATION, sensorType, enableAck).set(LIBRARY_VERSION));
486+
void MySensor::present(uint8_t childSensorId, uint8_t sensorType, bool enableAck, const char*description) {
487+
sendRoute(build(msg, nc.nodeId, GATEWAY_ADDRESS, childSensorId, C_PRESENTATION, sensorType, enableAck).set(description));
488488
}
489489

490490
void MySensor::sendSketchInfo(const char *name, const char *version, bool enableAck) {

libraries/MySensors/MySensor.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,9 @@ class MySensor
178178
* @param sensorId Select a unique sensor id for this sensor. Choose a number between 0-254.
179179
* @param sensorType The sensor type. See sensor typedef in MyMessage.h.
180180
* @param ack Set this to true if you want destination node to send ack back to this node. Default is not to request any ack.
181+
* @param description A textual description of the sensor. Defaults to library version.
181182
*/
182-
void present(uint8_t sensorId, uint8_t sensorType, bool ack=false);
183+
void present(uint8_t sensorId, uint8_t sensorType, bool ack=false, const char *description=LIBRARY_VERSION);
183184

184185
/**
185186
* Sends sketch meta information to the gateway. Not mandatory but a nice thing to do.

0 commit comments

Comments
 (0)