Skip to content

Commit 421de78

Browse files
committed
Fix CC2531 LED setting when running Z-Stack Home 1.2
1 parent ed4de99 commit 421de78

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

zigpy_znp/zigbee/application.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -235,14 +235,6 @@ async def _startup(self, auto_form=False):
235235
c.SYS.SetTxPower.Req(TXPower=dbm), RspStatus=t.Status.SUCCESS
236236
)
237237

238-
if self.znp_config[conf.CONF_LED_MODE] is not None:
239-
led_mode = self.znp_config[conf.CONF_LED_MODE]
240-
241-
await self._znp.request(
242-
c.Util.LEDControl.Req(LED=0xFF, Mode=led_mode),
243-
RspStatus=t.Status.SUCCESS,
244-
)
245-
246238
# Both versions of Z-Stack use this callback
247239
started_as_coordinator = self._znp.wait_for_response(
248240
c.ZDO.StateChangeInd.Callback(State=t.DeviceState.StartedAsCoordinator)
@@ -282,6 +274,16 @@ async def _startup(self, auto_form=False):
282274
async with async_timeout.timeout(STARTUP_TIMEOUT):
283275
await started_as_coordinator
284276

277+
# The CC2531 running Z-Stack Home 1.2 overrides the LED setting if it is changed
278+
# before the coordinator has started.
279+
if self.znp_config[conf.CONF_LED_MODE] is not None:
280+
led_mode = self.znp_config[conf.CONF_LED_MODE]
281+
282+
await self._znp.request(
283+
c.Util.LEDControl.Req(LED=0xFF, Mode=led_mode),
284+
RspStatus=t.Status.SUCCESS,
285+
)
286+
285287
device_info = await self._znp.request(
286288
c.Util.GetDeviceInfo.Req(), RspStatus=t.Status.SUCCESS
287289
)

0 commit comments

Comments
 (0)