The wireless sensor networks (WSNs) based on the IEEE 802.15.4 beacon enabled mode provide a deterministic resource allocation offered by the guaranteed time slot (GTS) mechanism which is ideal for real-time traffic applications that requires high quality of service (QoS). In the beacon enabled mode the active and optional inactive period is governed by superframe order (SO) and beacon order (BO). Adapting the duty cycle using the SO and BO is desirable to accommodate the changing context of the WSNs traffic for network optimisation. However, existing approaches assumed a fixed SO and BO and segregate the evaluation of the contention access period and the contention free period that forms the active segment. To improve the performance of the IEEE 802.15.4 protocol in respect of the trade-off between power consumption and end-to-end delay, within a required QoS, a combination of dynamic priorities for traffic differentiation and dynamic duty cycle adaptation in the GTS allocation process are introduced. This work demonstrates that the proposed solution provides significantly better performance than the standard allocation method by simultaneously satisfying QoS and service differ-B Robert Stewart entiation demands with considerable power savings which is essential for WSNs. The specific novel use of this solution is in an application scenario where the deployed network is situated in an assisted living environment with a rich suite of heterogeneous wireless based communications in place.