Skip to content

Conversation

@fcv-iteratorIt
Copy link
Contributor

Added job to populate empty fields
Added support for new sorting options

Copy link
Contributor

@augusthjerrild augusthjerrild left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comments

export class LorawanDeviceDatabaseEnrichJob {
constructor(private chirpstackDeviceService: ChirpstackDeviceService, private iotDeviceService: IoTDeviceService) {}

@Cron(CronExpression.EVERY_DAY_AT_5AM) // TODO: Finalize when to run
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is very cool! So we just need to figure out when to make this enrichment? Or is it already decided (should the todo be removed)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be changed to a timeoutJob, this is probably better done it a fresh branch due to incoming changes in the gateway PR #231

// OTAA
loraDevice.lorawanSettings.activationType = ActivationType.OTAA;
loraDevice.lorawanSettings.OTAAapplicationKey = keys.nwkKey;
loraDevice.OTAAapplicationKey = keys.nwkKey;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do this when we have the otaaapplicationkey on the lorawansettings? :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lorawan settings are not set in the database prior to this, and if the device is not otaa it should not be set

const deviceProfile = await this.deviceProfileService.findOneDeviceProfileById(
dto.lorawanSettings.deviceProfileID
);
lorawanDevice.deviceProfileName = deviceProfile.deviceProfile.name;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: Would it be better to include the deviceProfileName in the dto instead of calling chirpstack for getting the name? :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say no personally, this way the name till be updated to the actual time of creation (VERY edge case of profile name being changed while you're creating the device prevented by this)

Base automatically changed from feature/IOT-1403-Column-options-on-application-table to stage December 4, 2023 10:40
@fcv-iteratorIt fcv-iteratorIt merged commit b690c77 into stage Dec 4, 2023
@fcv-iteratorIt fcv-iteratorIt deleted the feature/IOT-1331-Column-options-on-iot-device-table branch December 4, 2023 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants