SmartThings Shield data handler (receives command to turn "both" or "off" the Alarm (digital output)
| 120 | |
| 121 | //SmartThings Shield data handler (receives command to turn "both" or "off" the Alarm (digital output) |
| 122 | void EX_Alarm::beSmart(const String &str) |
| 123 | { |
| 124 | String s = str.substring(str.indexOf(' ') + 1); |
| 125 | |
| 126 | if (debug) { |
| 127 | Serial.print(F("EX_Alarm::beSmart s = ")); |
| 128 | Serial.println(s); |
| 129 | } |
| 130 | |
| 131 | //if (m_bUseStrobe) { |
| 132 | if (s == F("both")) { |
| 133 | if (m_bUseStrobe) { |
| 134 | m_nCurrentAlarmState = both; |
| 135 | } |
| 136 | else { |
| 137 | m_nCurrentAlarmState = siren; |
| 138 | if (debug) { |
| 139 | Serial.println(F("EX_Alarm::beSmart - Strobe Pin not defined. Defaulting to Siren!")); |
| 140 | } |
| 141 | |
| 142 | } |
| 143 | } |
| 144 | else if(s == F("siren")) { |
| 145 | m_nCurrentAlarmState = siren; |
| 146 | } |
| 147 | else if(s == F("strobe")) { |
| 148 | if (m_bUseStrobe) { |
| 149 | m_nCurrentAlarmState = strobe; |
| 150 | } |
| 151 | else { |
| 152 | m_nCurrentAlarmState = siren; |
| 153 | if (debug) { |
| 154 | Serial.println(F("EX_Alarm::beSmart - Strobe Pin not defined. Defaulting to Siren!")); |
| 155 | } |
| 156 | |
| 157 | } |
| 158 | } |
| 159 | else if(s == F("off")) { |
| 160 | m_nCurrentAlarmState = off; |
| 161 | } |
| 162 | //} |
| 163 | //else { |
| 164 | // if (s == F("both") { |
| 165 | // m_nCurrentAlarmState = both; |
| 166 | // } |
| 167 | // else if(s == F("siren")) { |
| 168 | // m_nCurrentAlarmState = siren; |
| 169 | // } |
| 170 | // else if(s == F("strobe")) { |
| 171 | // m_nCurrentAlarmState = siren; |
| 172 | // } |
| 173 | // else if(s == F("off")) { |
| 174 | // m_nCurrentAlarmState = off; |
| 175 | // } |
| 176 | //} |
| 177 | |
| 178 | writeStateToPin(); |
| 179 |