FAQ
How can I change the device status?
All the sample device types provided in WSO2 IoT Server are configured so that the device status is demarked as active as soon as you download the agent. That is because the device is considered to be registered with WSO2 IoT Server when the agent is downloaded. Having the status as active when you download a device is not mandatory and you can change it when writing the device plugin or APIs for your device.
For example, in RaspberryPi the device status is configured when writing the APIs in the
RaspberryPiServiceImpl.java
file by defining ACTIVE
as the value for enrolmentInfo.setStatus
:
private boolean register(String deviceId, String name) { try { DeviceIdentifier deviceIdentifier = new DeviceIdentifier(); deviceIdentifier.setId(deviceId); deviceIdentifier.setType(RaspberrypiConstants.DEVICE_TYPE); if (APIUtil.getDeviceManagementService().isEnrolled(deviceIdentifier)) { return false; } Device device = new Device(); device.setDeviceIdentifier(deviceId); EnrolmentInfo enrolmentInfo = new EnrolmentInfo(); enrolmentInfo.setDateOfEnrolment(new Date().getTime()); enrolmentInfo.setDateOfLastUpdate(new Date().getTime()); enrolmentInfo.setStatus(EnrolmentInfo.Status.ACTIVE); enrolmentInfo.setOwnership(EnrolmentInfo.OwnerShip.BYOD); device.setName(name); device.setType(RaspberrypiConstants.DEVICE_TYPE); enrolmentInfo.setOwner(APIUtil.getAuthenticatedUser()); device.setEnrolmentInfo(enrolmentInfo); return APIUtil.getDeviceManagementService().enrollDevice(device); } catch (DeviceManagementException e) { return false; } }
What are the available device statuses?
WSO2 IoT Server supports device statuses so that you are able to manage the device lifecycle anyway you prefer using the following statuses.
CREATED | The device status once a device instance is created. Example: Downloading the virtual fire alarm device agent. |
---|---|
ACTIVE | The device status once the agent starts to communicate with the device. Example: When the virtual fire alarm is connected to WSO2 IoT Server for the first time, you can configure the plugin so that the device status changes from |
INACTIVE | A device that is in the ACTIVE state but there is no communication with the server. |
UNREACHABLE | IoTS is unable to reach the server therefore, the device status can be configured to be in the UNREACHABLE state. |
UNCLAIMED | A device that does not have an owner assigned to it. |
SUSPENDED | A device that does not abide by a policy that was enforced on it can be suspended and hence be in the SUSPENDED state. |
BLOCKED | If you want to stop the device from communicating with the server, the device status can be configured to be BLOCKED . |
DISENROLLMENT_REQUESTED | The status of the device once it sends a request to be disenrolled from WSO2 IoT Server. |
REMOVED | The status of the status once the device is disenrolled from WSO2 IoT Server. |
How can I disable authentication for MQTT clients?
You will want to reduce the number of steps for testing purposes and see if the communication works accordingly, in such cases or for any other use case you can disable authentication for MQTT clients by following the simple steps given below:
- Open the
broker.xml
file that is in the<IoT_HOME>/broker/repository/conf
directory. - Configure the following fields:
- Define the
<authentication>
tag asOPTIONAL
. - Define the
<authorization>
tag asNOT_REQUIRED
.
<authentication>OPTIONAL</authentication> <authorization>NOT_REQUIRED</authorization>
- Define the
Why do I need to use the iOS Agent?
The iOS Agent is required to perform the following operations. Therefore, if you need to use any of the following operations with WSO2 IoT Server, you need to build the iOS Agent.
- Report location details to the server.
- Perform the ring operation.
Perform notification operations by sending messages to the device.
Why do I get the APIMClientOAuthException error?
Are you getting the APIMClientOAuthException
error after using the change-ip script or after manually configuring the IP or hostname of WSO2 IoT Server? Let's look at why it happens and how you can overcome it.
Check if the IP you defined is referring to another hostname in the etc/hosts file. If yes, make sure to comment it out or remove it from the file. Now start the server again and you won't get the error. Sometimes, the VMs will have a server name or machine name, therefore, a host name entry for that server or machine name must be in the /etc/hosts file in order to start the server. In that case, make sure that you do not use the defined IP to resolve the machine host name.
Please note that the IP you defined cannot point to any hostname. If it is, then hostname verification failures will cause the above issue.