Added check for 'state' attribute

If an AP has been disconnected, the Unifi API will not provide a 'state' attribute. This results in an error when checking if 'state' != 1 as there is no 'state' to check.