SmartThings Shield data handler (receives configuration data from ST - polling interval, and adjusts on the fly)
| 120 | |
| 121 | //SmartThings Shield data handler (receives configuration data from ST - polling interval, and adjusts on the fly) |
| 122 | void PS_PulseCounter::beSmart(const String &str) |
| 123 | { |
| 124 | String s = str.substring(str.indexOf(' ') + 1); |
| 125 | |
| 126 | if (s.toInt() != 0) { |
| 127 | st::PollingSensor::setInterval(s.toInt() * 1000); |
| 128 | if (st::PollingSensor::debug) { |
| 129 | Serial.print(F("PS_PulseCounter::beSmart set polling interval to ")); |
| 130 | Serial.println(s.toInt()); |
| 131 | } |
| 132 | } |
| 133 | else { |
| 134 | if (st::PollingSensor::debug) |
| 135 | { |
| 136 | Serial.print(F("PS_PulseCounter::beSmart cannot convert ")); |
| 137 | Serial.print(s); |
| 138 | Serial.println(F(" to an Integer.")); |
| 139 | } |
| 140 | } |
| 141 | } |
| 142 | |
| 143 | //function to get data from sensor and queue results for transfer to ST Cloud |
| 144 | void PS_PulseCounter::getData() |