Usermod enhancements

- added onStateChange() callback
- added examples & comments to usermod_v2_example.h
- PIR sensor cancels countdown on state change
This commit is contained in:
Blaz Kristan
2023-02-05 12:23:05 +01:00
parent 52c18e77ae
commit c041d39cab
6 changed files with 219 additions and 29 deletions

View File

@@ -129,6 +129,9 @@ void stateUpdated(byte callMode) {
//deactivate nightlight if target brightness is reached
if (bri == nightlightTargetBri && callMode != CALL_MODE_NO_NOTIFY && nightlightMode != NL_MODE_SUN) nightlightActive = false;
// notify usermods of state change
usermods.onStateChange(callMode);
if (fadeTransition) {
//set correct delay if not using notification delay
if (callMode != CALL_MODE_NOTIFICATION && !jsonTransitionOnce) transitionDelayTemp = transitionDelay; // load actual transition duration