Yurik72 / ESPHap

ESP32/ESP8266 Arduino library for native Apple Homekit Accessory Protocol (HAP)
MIT License
265 stars 60 forks source link

Question on notifying HAP #61

Closed eford321 closed 3 years ago

eford321 commented 3 years ago

I see 2 different functions that appear to notify HAP.: (homekit_characteristic_notify & HAP_NOTIFY_CHANGES).

Is there a preferred use for each of these? Thanks.

Yurik72 commented 3 years ago

homekit_characteristic_notify : is a function which allows to notify HAP at any time with any values... HAP_NOTIFY_CHANGES(name,home_characteristic,val,tollerance) : is a macros, which finally calls the same function, but macros is able to check (compare ) new and old value with Tollerance(latest param) and in case of changing will call notify. For instance for the Thermometer (in my opinion ) not neccessary to call every time notification and Tollerance can be for instance 0.5

HAP_NOTIFY_CHANGES_WITHCONSTRAIN : In addition to previous macros allows to check min and max value for charachtertistic and prevents to send value which is out of range

So, any notification can be used, depends on your sketch

eford321 commented 3 years ago

Great. Thanks for the explanation.

Sent from my iPhone

On Feb 27, 2021, at 2:42 AM, Yurik72 notifications@github.com wrote:

 homekit_characteristic_notify : is a function which allows to notify HAP at any time with any values... HAP_NOTIFY_CHANGES(name,home_characteristic,val,tollerance) : is a macros, which finally calls the same function, but macros is able to check (compare ) new and old value with Tollerance(latest param) and in case of changing will call notify. For instance for the Thermometer (in my opinion ) not neccessary to call every time notification and Tollerance can be for instance 0.5

HAP_NOTIFY_CHANGES_WITHCONSTRAIN : In addition to previous macros allows to check min and max value for charachtertistic and prevents to send value which is out of range

So, any notification can be used, depends on your sketch

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.