Add IoT asset detail and sensor lookup tools#450
Merged
Conversation
Signed-off-by: Shuxin Lin <linshuhsin@gmail.com>
Signed-off-by: Shuxin Lin <linshuhsin@gmail.com>
Signed-off-by: Shuxin Lin <linshuhsin@gmail.com>
Signed-off-by: Shuxin Lin <linshuhsin@gmail.com>
Signed-off-by: Shuxin Lin <linshuhsin@gmail.com>
Signed-off-by: Shuxin Lin <linshuhsin@gmail.com>
Signed-off-by: Shuxin Lin <linshuhsin@gmail.com>
DhavalRepo18
approved these changes
Jul 14, 2026
DhavalRepo18
left a comment
Collaborator
There was a problem hiding this comment.
As said, once all code is in place i will make a fine pass on consistency check.
Signed-off-by: Shuxin Lin <linshuhsin@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
get_asset_detail(site_name, asset_id)toasset_detail(site_name, asset_id)find_assets_by_sensors(site_name, sensors, match="all", substring=false, source="measured")to find site-registered assets by installed registry sensors or measured telemetry fieldsFindAssetsResult/AssetSensorMatchresponses with the deduplicated query sensors and concrete matched sensor names per assetasset_detail,assets, andinstalled_sensorsread fromasset_db;measured_sensorsandfind_assets_by_sensors(source="measured")read telemetry fields fromiot_dbmatch="all"evaluation while preserving first occurrence orderfind_assets_by_sensorsbehaviorasset_detail, installed/measured sensor source behavior, substring matching, and duplicate query sensor handlingTool Surface
sites()->{"sites": [...]}asset_ids(site_name)-> bare asset id list for the siteasset_detail(site_name, asset_id)-> asset registry details:site_name,asset_id,description,assettype,status,location,installdate,vintage,n_installed_sensors,messageassets(site_name, assettype?)-> asset metadata rows:asset_id,description,assettype,vintage,n_sensorsinstalled_sensors(site_name, asset_id)-> registry sensor inventory for an asset fromasset_dbmeasured_sensors(site_name, asset_id)-> observed telemetry field names for an asset fromiot_dbfind_assets_by_sensors(site_name, sensors, match?, substring?, source?)-> assets whose installed or measured sensors match the queryfind_assets_by_sensorsBehaviorsource="installed"searches each asset record's registrysensorsinventorysource="measured"searches telemetry field names discovered from IoT recordsmatch="all"requires every deduplicated query sensor to matchmatch="any"requires at least one deduplicated query sensor to matchsubstring=trueperforms case-insensitive substring matchingquery_sensorsand do not cause false negatives formatch="all"Tests
uv run --frozen pytest src/servers/iot/tests/test_tools.py(31 passed)/tmp/aob_find_assets_by_sensors_smoke.pyreal-db smoke viaPYTHONPATH=src uv run --frozen python /tmp/aob_find_assets_by_sensors_smoke.pyquery_sensorsmatch, invalidsource, empty sensors, and no-match cases returned expected responses