Added non-notify option to setVal()
Second optional argument to setVal() determines whether or not HomeSpan sends notification of new value to HomeKit. Default if left blank is "true" for backwards compatibility.
This commit is contained in:
parent
835d49adc5
commit
6f765e8988
|
|
@ -534,7 +534,7 @@ struct SpanCharacteristic{
|
|||
|
||||
} // setString()
|
||||
|
||||
template <typename T> void setVal(T val){
|
||||
template <typename T> void setVal(T val, boolean notify=true){
|
||||
|
||||
if((perms & EV) == 0){
|
||||
Serial.printf("\n*** WARNING: Attempt to update Characteristic::%s with setVal() ignored. No NOTIFICATION permission on this characteristic\n\n",hapName);
|
||||
|
|
@ -551,6 +551,7 @@ struct SpanCharacteristic{
|
|||
|
||||
updateTime=homeSpan.snapTime;
|
||||
|
||||
if(notify){
|
||||
SpanBuf sb; // create SpanBuf object
|
||||
sb.characteristic=this; // set characteristic
|
||||
sb.status=StatusCode::OK; // set status
|
||||
|
|
@ -562,6 +563,7 @@ struct SpanCharacteristic{
|
|||
nvs_set_blob(homeSpan.charNVS,nvsKey,&value,sizeof(UVal)); // store data
|
||||
nvs_commit(homeSpan.charNVS);
|
||||
}
|
||||
}
|
||||
|
||||
} // setVal()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue