@@ -110,8 +110,6 @@ EmberAfStatus OnOffServer::setOnOffValue(chip::EndpointId endpoint, chip::Comman
110
110
EmberAfStatus status;
111
111
bool currentValue, newValue;
112
112
113
- emberAfOnOffClusterPrintln (" On/Off set value: %x %x" , endpoint, static_cast <uint8_t >(command));
114
-
115
113
// read current on/off value
116
114
status = Attributes::OnOff::Get (endpoint, ¤tValue);
117
115
if (status != EMBER_ZCL_STATUS_SUCCESS)
@@ -123,14 +121,14 @@ EmberAfStatus OnOffServer::setOnOffValue(chip::EndpointId endpoint, chip::Comman
123
121
// if the value is already what we want to set it to then do nothing
124
122
if ((!currentValue && command == Commands::Off::Id) || (currentValue && command == Commands::On::Id))
125
123
{
126
- emberAfOnOffClusterPrintln (" On/off already set to new value" );
124
+ emberAfOnOffClusterPrintln (" Endpoint %x On/off already set to new value" , endpoint );
127
125
return EMBER_ZCL_STATUS_SUCCESS;
128
126
}
129
127
130
128
// we either got a toggle, or an on when off, or an off when on,
131
129
// so we need to swap the value
132
130
newValue = !currentValue;
133
- emberAfOnOffClusterPrintln (" Toggle on/off from %x to %x" , currentValue, newValue);
131
+ emberAfOnOffClusterPrintln (" Toggle ep%x on/off from state %x to %x" , endpoint , currentValue, newValue);
134
132
135
133
// the sequence of updating on/off attribute and kick off level change effect should
136
134
// be depend on whether we are turning on or off. If we are turning on the light, we
@@ -193,12 +191,6 @@ EmberAfStatus OnOffServer::setOnOffValue(chip::EndpointId endpoint, chip::Comman
193
191
}
194
192
else // Set Off
195
193
{
196
- if (SupportsLightingApplications (endpoint))
197
- {
198
- emberAfOnOffClusterPrintln (" Off Command - OnTime : 0" );
199
- Attributes::OnTime::Set (endpoint, 0 ); // Reset onTime
200
- }
201
-
202
194
#ifdef EMBER_AF_PLUGIN_LEVEL_CONTROL
203
195
// If initiatedByLevelChange is false, then we assume that the level change
204
196
// ZCL stuff has not happened and we do it here
@@ -207,18 +199,22 @@ EmberAfStatus OnOffServer::setOnOffValue(chip::EndpointId endpoint, chip::Comman
207
199
emberAfOnOffClusterLevelControlEffectCallback (endpoint, newValue);
208
200
}
209
201
else
210
- {
211
202
#endif
203
+ {
212
204
// write the new on/off value
213
205
status = Attributes::OnOff::Set (endpoint, newValue);
214
206
if (status != EMBER_ZCL_STATUS_SUCCESS)
215
207
{
216
208
emberAfOnOffClusterPrintln (" ERR: writing on/off %x" , status);
217
209
return status;
218
210
}
219
- #ifdef EMBER_AF_PLUGIN_LEVEL_CONTROL
211
+
212
+ if (SupportsLightingApplications (endpoint))
213
+ {
214
+ emberAfOnOffClusterPrintln (" Off completed. reset OnTime to 0" );
215
+ Attributes::OnTime::Set (endpoint, 0 ); // Reset onTime
216
+ }
220
217
}
221
- #endif
222
218
}
223
219
224
220
#ifdef EMBER_AF_PLUGIN_SCENES
@@ -383,7 +379,6 @@ bool OnOffServer::offWithEffectCommand(app::CommandHandler * commandObj, const a
383
379
#endif // EMBER_AF_PLUGIN_SCENES
384
380
385
381
OnOff::Attributes::GlobalSceneControl::Set (endpoint, false );
386
- Attributes::OnTime::Set (endpoint, 0 );
387
382
}
388
383
389
384
// Only apply effect if OnOff is on
0 commit comments