Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom asset type creation support #21

Merged
merged 5 commits into from
Feb 8, 2024
Merged

Custom asset type creation support #21

merged 5 commits into from
Feb 8, 2024

Conversation

pankalog
Copy link
Member

@pankalog pankalog commented Feb 8, 2024

This PR introduces the ability to create a custom asset type for the fleet management implementation. Specifically, by extending on the VehicleAsset, users can specify their own, custom AttributeDescriptors, for usage in both the normal OpenRemote UI for categorization, etc. But also allow the Teltonika Telematics integration to force the usage of the predefined AttributeDescriptor for creating an attribute. Specifically, If the name of the AttributeDescriptor is any of the AVL parameter IDs, it will use that attribute descriptor to create that attribute, overriding the dynamic attribute descriptor creation. This is already being used in CarAsset, where some parameters (Ignition Source, Movement Source) are being parsed as boolean values.

To select a custom asset type to be used for the integration, modify the class reference in the TeltonikaMQTTHandler:

TELTONIKA_DEVICE_ASSET_CLASS.

Everything else automatically uses that reference to adjust everything.

Developers can now define their own asset types by extending on VehicleAsset. In TeltonikaMQTTHandler, it is as easy as changing the reference of `TELTONIKA_DEVICE_ASSET_CLASS` to your own custom type that extends the VehicleAsset. In this way, developers can create their own asset types with their own specific ways of parsing the parameters of the payload, without tweaking the code.

Due to a change in the Asset Type, current installations will have to move to this to use the new asset types.
Add a new test case to go through every single payload in the list, and check that the correct amount of parameters are being updated.

Future support should make a way to check each created attribute that checks if the correct value was parsed and the correct type was created.
@pankalog pankalog changed the title Feature/custom types Custom asset type creation support Feb 8, 2024
@pankalog pankalog merged commit 82d547c into main Feb 8, 2024
1 check passed
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.

1 participant