By using AWS re:Post, you agree to the Terms of Use
/AWS IoT SiteWise/

Questions tagged with AWS IoT SiteWise

Sort by most recent
  • 1
  • 90 / page

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

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
4
views
asked 2 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
3
views
asked 2 months ago

Collecting data from OPC-UA to SiteWise fails

Hi, I have a Greengrass Core v2 running in a Docker container which is successfully collecting measurements from an OPC-UA server however these measurements are not being forwarded to AWS Sitewise. Investigating the local logs on the core I can see swPublisher.log contains many entries saying "Failed to publish messages because an SDK client error occurred. Retrying. Error details: Unable to load AWS credentials from any provider in the chain". Any suggestions? Log: 2021-09-27T06:20:41.022Z \[INFO] (Copier) aws.iot.SiteWiseEdgePublisher: stdout. \[INFO ] 2021-09-27 06:20:41.022 \[main] Publisher - {"message":"Initialization Completed."}. {scriptName=services.aws.iot.SiteWiseEdgePublisher.lifecycle.Startup.Script, serviceName=aws.iot.SiteWiseEdgePublisher, currentState=RUNNING} 2021-09-27T06:20:44.787Z \[INFO] (Copier) aws.iot.SiteWiseEdgePublisher: stdout. \[WARN ] 2021-09-27 06:20:44.770 \[PublisherThread-0] BatchMessageUploaderTask - {"message":"Failed to publish messages because an SDK client error occurred. Retrying. Error details: Unable to load AWS credentials from any provider in the chain: \[EnvironmentVariableCredentialsProvider: Unable to load AWS credentials from environment variables (AWS_ACCESS_KEY_ID (or AWS_ACCESS_KEY) and AWS_SECRET_KEY (or AWS_SECRET_ACCESS_KEY)), SystemPropertiesCredentialsProvider: Unable to load AWS credentials from Java system properties (aws.accessKeyId and aws.secretKey), WebIdentityTokenCredentialsProvider: You must specify a value for roleArn and roleSessionName, com.amazonaws.auth.profile.ProfileCredentialsProvider@41442f3f: profile file cannot be null, com.amazonaws.auth.EC2ContainerCredentialsProviderWrapper@6833fcdc: Failed to connect to service endpoint: ]"}. {scriptName=services.aws.iot.SiteWiseEdgePublisher.lifecycle.Startup.Script, serviceName=aws.iot.SiteWiseEdgePublisher, currentState=RUNNING} Image version: amazon/aws-iot-greengrass:2.4.0-0 Edited by: johnDa on Sep 26, 2021 11:32 PM
1
answers
0
votes
5
views
asked 8 months ago

How do I know when a new Metric value is available for a SiteWise Asset?

I have a SiteWise Asset with 12 Measurements and 36 Metrics. The Metrics are things like min, max, and average for each Measurement. So a Measurement might be Temperature and the corresponding Metrics would be Temperature_min, Temperature_max, and Temperature_avg. I have notifications enabled for all Measurements and Metrics. I am simulating IoT data being sent to SiteWise by passing a set of property updates for the Measurements via the CLI's batch-put-asset-property-value command. This works well; I can see the data appearing in SiteWise for both Measurements and Metrics. Again, I'm sending data in for the Measurements only whereas the Metrics are calculated by SiteWise from these Measurement values. I want to store all of this data by timestamp somewhere so I setup a IoT Rule that passes PropertyValueUpdate messages to a Lambda that updates a DynamoDB Item per timestamp. This partly works; I see messages going through the IoT Rule and appearing in DynamoDB for the Measurements but not the Metrics. It appears that updating a given property (Measurements or Metrics) triggers a notification but a Metric being calculated by SiteWise does not. Is there a way to trigger a message when a given Metric is calculated in SiteWise or can I be assured that a Metric value is available when the Measurement's PropertyValueUpdate message fires, or is there a better way of doing what I'm attempting? Thanks.
3
answers
0
votes
3
views
asked 2 years ago
  • 1
  • 90 / page