Questions tagged with AWS IoT SiteWise

Content language: English

Sort by most recent

Browse through the questions and answers listed below or filter and sort to narrow down your results.

Automate SiteWise Asset Property Alias

Hi There I'm looking for perhaps the missing link in how to automatically change asset properties within SiteWise? This must be a common Sitewise requirement for the manufacturing industry? Yet the whole CLI workflow requesting asset ID, then parsing properties and then responding seems quite complicated for widespread use. Even if forced to communicate with a server on per device, rather than a global configuration export/import; I'd still expect something as simple as: *"aws iotsitewise {Asset**Name**}.{Property**Name**}.Alias = {GiveAliasString}"* Currently, it seams like I have to do the following: 1. Search for all existing SiteWise Assets 2. Search that JSON response for the human name of the Sitewise asset. 3. Get AssetID that "owns" the assetName found in that JSON response 4. Query server again using AssetID and get another JSON description of that particular Sitewise asset 5. Search JSON response for parameter/metric of interest 6. Get PropertryID from JSON response 7. Finally use property ID to update alias string I'd imagine 90% of SiteWises development is given to automation engineers. Yet based on assumed workflow, the response from 99% of them, myself included response would be to go find someone else... There must be a better way I haven't found? Creating assets is easy enough, single CLI command; but some assets might have 20+ properties, and a normal project probably has 100+ assets. The console isn't practical for real project.
2
answers
0
votes
57
views
asked 5 months ago

Simple IoT Core thing rule and SiteWise property alias ingestion config

Hi, I am seeking some basic plain english assistance please. Any assistance will be great appreciated. I have a temperature sensor Thing receiving MQTT data. * The Things name is: TestThing * The data includes 4 fields: "TS", "datetime", "class", "data" * The published Topic is: TestTopic * The IoT Core MQTT Test Client payload displays as: {"TS": 1656941515, "datetime": 04/07/2022 23:31:55, "class": Temperature, "data": 11} I do not know how to fill out the IoT Core rule correctly, and I am also not sure if the SiteWise Asset propertyAlias is correct. Based on what i have read (see below), the latest failure is: **IoT Core Rule config UI** * SQL Statement: SELECT * FROM 'TestTopic' * Property Alias: TestTopic * Time in seconds: ${TS} * Data type: DOUBLE * Value: ${data} * IAM role: created via the UI - create new role I have used Data type: DOUBLE although i note the incoming data is seen within IoT Analytics as integer. The SiteWise model Measurement definitions is also set to DOUBLE **SiteWise config** * Model Measurement definitions: Temperature * Asset Measurement: Temperature * Asset Measurement - Temperature field (enter a property alias): TestTopic I believe i have created the model and asset correctly. Although, I am not sure if i understand the what exactly is the Property, and thus the propertyAlias. based on the above, I believe i created the propertyAlias for the Temperature field as: TestTopic **Setup and read history** The setup is super simple for testing. A single IoT thing, pulling in MQTT topic data. The Thing was created as a single Thing with certificates. A MODBUS sensor connected to a gateway with MQTT. No OPC server, no Greengrass, no Lora. IoT Analytics and AWS QuickSight services can access the data. I have read: 1) all the AWS suggested questions, 2) the manual - docs pages on SiteWise IoT Core data ingestion, including the tutorial section, 3) the AWS workshop pages, 4) watch every wonderful Youtube on the topic (not many). Key articles read: https://docs.aws.amazon.com/iot-sitewise/latest/userguide/ingest-data-from-iot-things.html https://docs.aws.amazon.com/iot/latest/developerguide/iotsitewise-rule-action.html https://docs.aws.amazon.com/iot-sitewise/latest/userguide/connect-data-streams.html https://docs.aws.amazon.com/iot-sitewise/latest/userguide/iot-rules.html https://iot-sitewise.workshop.aws/en/40_aws-iot-sitewise-data-ingestion.html https://repost.aws/tags/TAGaSyCvg-SI2w6FYqm1H2RQ/aws-io-t-site-wise
2
answers
0
votes
96
views
asked 5 months ago

Measuraments not reported in Iot SiteWise

Hi, I have followed the tutorial [here](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/ingest-data-from-iot-things.html). I can see my data in IoT core, but the measurement are not reported in IoT SiteWise. There seem to be a permission problem. This is the error from the error rule ``` { "ruleName": "SiteWiseTutorialDeviceRule", "topic": "$aws/things/SiteWiseTutorialDevice1/shadow/update/accepted", "cloudwatchTraceId": "e3aec656-d5d7-b500-5558-d51ae7aee895", "clientId": "N/A", "base64OriginalPayload": "eyJzdGF0ZSI6eyJyZXBvcnRlZCI6eyJ0ZW1wZXJhdHVyZSI6MTAuMSwiaHVtaWRpdHkiOjY0LjIsInRpbWVzdGFtcCI6MS42NTU3OTk2MjQ0NTczODFFOX19LCJtZXRhZGF0YSI6eyJyZXBvcnRlZCI6eyJ0ZW1wZXJhdHVyZSI6eyJ0aW1lc3RhbXAiOjE2NTU3OTk2MjR9LCJodW1pZGl0eSI6eyJ0aW1lc3RhbXAiOjE2NTU3OTk2MjR9LCJ0aW1lc3RhbXAiOnsidGltZXN0YW1wIjoxNjU1Nzk5NjI0fX19LCJ2ZXJzaW9uIjo5NjAsInRpbWVzdGFtcCI6MTY1NTc5OTYyNCwiY2xpZW50VG9rZW4iOiIyYzU2Zjg1NC0zM2IzLTQzNmQtYjJjZC1kMzk2ZmZkNTYxMGYifQ==", "failures": [ { "failedAction": "IotSiteWiseAction", "failedResource": "", "errorMessage": "Failed to send message data to IoT SiteWise asset properties. [Code: AccessDeniedException, Message: User: arn:aws:sts::908401988620:assumed-role/SiteWiseTutorialDeviceRuleRole/9SUxG6SG is not authorized to perform: iotsitewise:BatchPutAssetPropertyValue on resource: /tutorial/device/SiteWiseTutorialDevice1/temperature because no identity-based policy allows the iotsitewise:BatchPutAssetPropertyValue action]. Message arrived on: $aws/things/SiteWiseTutorialDevice1/shadow/update/accepted, Action: iotSiteWise" } ] } ``` Any suggestion?
1
answers
0
votes
75
views
asked 5 months ago

How to get string timestamp from IoT Core into SitWise

I'm trying to get some data into SiteWise through IoT Core and I keep getting this result from the rule: > "details": "No requests were sent. PutAssetPropertyValueEntries was empty after performing substitution templates. Message arrived on: , Action: iotSiteWise" I think the reason is because of this: > Note Because an expression in a substitution template is evaluated separately from the SELECT statement, you can't use a substitution template to reference an alias created using an AS clause. You can reference only information present in the original payload, in addition to supported functions and operators. I am ATTEMPTING to do this as the source: ``` SELECT fields.rms0, fields.rms1, fields.rms2, time_to_epoch(timestamp, "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")/1000 as ts ``` but I see from the document that won't work. In the rule, I tried it another way: in the timeStamp mapping (in the UI) I tried to set the time to: ``` ${time_to_epoch(timestamp, "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")/1000} ``` but that doesn't work, either - it gave me an error saying it didn't understand time_to_epoch. Next, I tried going back to this: ``` SELECT * ``` and in the Rule to write to SiteWise I set all the timestamp fields to: ``` ${floor(time_to_epoch(timestamp, "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") / 1E3)} ``` following the manual. ``` "resources": { "FunctionName": "time_to_epoch" }, "details": "Undefined result" ``` ``` "resources": { "FunctionName": "floor" }, "details": "Undefined result" ``` so I am not having much success. Is there any way to make it log what the BatchPutAssetPropertyValue request contains? Extra thought: is this whole problem because my timestamp column is named 'timestamp' ?
1
answers
0
votes
113
views
wz2b
asked 9 months ago

Iot Core -> SiteWise ingestion question

I have some messages that look like this: ``` { "measurement":"observation", "timestamp":"2022-03-08T18:04:48.389Z", "fields": { "rms0": 0.22936178743839264, "max0": 0.22936178743839264, "rms1": 0.2076568752527237, "max1": 0.2076568752527237, "rms2": 0.20974993705749512, "max2": 0.20974993705749512 }, "tags": { "bucket":"powermon", "address":"CA64" } } ``` Using basic ingestion, I'm sending them to this topic: `$aws/rules/PowerMonRule` I added three actions to that rule. One was to write the message to CloudWatch Logs for both the normal and the error condition. The second rule attempts to write that data to SiteWise. This is where I'm having a problem. No data ever actually shows up, and I'm not quite sure how to figure out why. What I'm logging now is what comes out of the rule; is there some way to log what happens when it goes into SiteWise so I can figure out what SiteWise is doing with the data? My timestamp is in an ISO style format so for every property that I write I repeat the conversion. I tested this by writing an IoT Rule that writes to Timestream and that worked correctly, so I think it should work here. For the same reason I think select * then referring to the values as `${fields.rms0}` should work OK. My model has these measurements: ``` { "id": "5fd1be48-f8ab-44a1-9d93-2c8102f80e02", "name": "Irms0", "dataType": "DOUBLE", "unit": "Amp", "type": { "measurement": {} } }, { "id": "085dfa46-3b8a-47a2-b325-1d211b33a6f4", "name": "Irms1", "dataType": "DOUBLE", "unit": "Amp", "type": { "measurement": {} } }, { "id": "1ec8a6c6-a9cc-4bde-9ae5-4394b09914c8", "name": "Irms2", "dataType": "DOUBLE", "unit": "Amp", "type": { "measurement": {} } } ``` so what I did was set up an alarm rule with this action (see below). What it does is to take the message (the rule is just `SELECT *`) and pull out the three fields, which are stored in attributes with IDs matching the above. For now, the rule is set up to write to a specific, hard-coded asset ID, and the property IDs pulled from the model. ``` { "iotSiteWise": { "putAssetPropertyValueEntries": [ { "assetId": "e6739e7d-248e-47cd-ba53-bf369126d482", "propertyId": "5fd1be48-f8ab-44a1-9d93-2c8102f80e02", "propertyValues": [ { "value": { "doubleValue": "${fields.rms0}" }, "timestamp": { "timeInSeconds": "${time_to_epoch(ts,\"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'\")}" } } ] }, { "assetId": "e6739e7d-248e-47cd-ba53-bf369126d482", "propertyId": "085dfa46-3b8a-47a2-b325-1d211b33a6f4", "propertyValues": [ { "value": { "doubleValue": "${fields.rms1}" }, "timestamp": { "timeInSeconds": "${time_to_epoch(ts,\"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'\")}" } } ] }, { "assetId": "e6739e7d-248e-47cd-ba53-bf369126d482", "propertyId": "1ec8a6c6-a9cc-4bde-9ae5-4394b09914c8", "propertyValues": [ { "value": { "doubleValue": "${fields.rms2}" }, "timestamp": { "timeInSeconds": "${time_to_epoch(ts,\"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'\")}" } } ] } ] } } ```
1
answers
0
votes
48
views
wz2b
asked 9 months ago