Java gRPC device creation missing OTAA

Hello everybody,

I’m working with the chirpstack-api 4.5.1 library for java.

I’m able to create a device, gateway, application, device profile ecc…

I only have an issue when creating a device, the OTAA key is missing after the succesful creation:

public void createDevice(Device device) {
        Device deviceObj = Device.newBuilder()
                .setName("Java-Sensor")
                .setDevEui("0104032b030228b9")
                .setJoinEui("3c530c132b106ab8413917b6c124fe440")
                .setDescription("Description from java!")
                .setApplicationId("2d7f33ea-8b90-4312-b665-23be7716a29d")
                .setDeviceProfileId("9b2ed11e-2376-4ec4-974b-78fe6530b14e")
                .setSkipFcntCheck(false)
                .setIsDisabled(false)
                .build();

        CreateDeviceRequest deviceRequest = CreateDeviceRequest.newBuilder().setDevice(deviceObj).build();

        DeviceServiceGrpc.DeviceServiceBlockingStub stub = DeviceServiceGrpc
                .newBlockingStub(channel)
                .withInterceptors(MetadataUtils.newAttachHeadersInterceptor(metadata));

        stub.create(deviceRequest);
        LOGGER.info("Device created!");

From the chirpstack gRPC documentation, it seems to be set with setJoinEui() method, which i’m using.

Anyone had a similar problem?

Thanks

The JoinEUI is something completely different. Please refer to the LoRaWAN specification. What you are looking for is is the CreateKeys method:

https://www.chirpstack.io/docs/chirpstack/api/api.html#api-DeviceService

This step is optional, as one might use an external join-server.

1 Like

Thanks, it worked! :grinning: :grinning: :grinning:

If I may ask, where did you get the chirpstack-api 4.5.1 library for java from ?
is it in a maven repo somewhere ?

Regards

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.