Questions tagged with AWS IoT SiteWise
Content language: English
Sort by most recent
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.
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
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?
I have an OPC server that has nodes with arrays as values. For example I have a node called "Temperatures" which has values [33, 29, 30, 19] in the array.
**Is it possible to set single items of this array as properties into SiteWise assets with aliases** like */Temperatures/1*, */Temperatures/2*, */Temperatures/3*, etc.?
I understand from [this document](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/file-path-and-schema.html#metrics-file-path-and-schema) all about how files in the cold tier are stored as S3 objects. What I think is missing is the actual avro schema file needed to load these files into something like a local Jupyter notebook. This schema file should look like this:
```
{
"type" : "record",
"namespace" : "Tutorialspoint",
"name" : "Employee",
"fields" : [
{ "name" : "Name" , "type" : "string" },
{ "name" : "Age" , "type" : "int" }
]
}
```
Is this schema the same for every SiteWise installation or does it depend on my model? Is there a way to export it from my model or asset? I just want to be able to peek through these files with my own software.
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' ?
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'\")}"
}
}
]
}
]
}
}
```
I have some devices that are three channel power monitors. I created a model that has separate measurements for rms0, rms1, and rms2. When I send them in, the format is JSON more or less like this:
`{
measurement: "power_meter",
timestamp: 1634185751589,
fields: {
rms0: 0.024,
rms1: 0.025,
rms2: 0.037
},
tags: {
mac: "0102030405060708"
}`
I decided to push them in via IOT Core mostly because of the elasticity.
I am creating a rule to push these streams in, but I'm not clear on something. All three streams - rms0, rms1, rms2 - are part of a single Model. In the IoT rule configuration it says
> Select a property ID from an asset model in AWS IoT SiteWise
so my rule writes three different properties. All three have timestamp `${ts}` and they each write a separate property with a value like `${fields.rms0}`. I think (please correct me if I'm wrong) this means three separate API calls to IoT SiteWise meaning three times the cost (true?)
If all that is correct, then my question is this: within the action you can add "entries" (which I think really means "properties") and within each "entry" you can add "rows."
Why would I add multiple "rows" to the same property? Is this for a case where the incoming message has multiple samples with multiple timestamps in it, rather than one "row" at a time?
I was able to add new users to AWS SiteWise for a long time, then suddenly the 'create user' button disappeared. I still have the same Portal Administrator access that I've always had. Any idea how to get that button back??
I'm looking for an AWS solution as close as possible as PI AF by Osisoft.
The solutions needs to:
* Allow old data ingestion (could be of few years old);
* Allow aggregation on data (could be summing two timeseries sensor values);
* Allow aggregation on old data and on the upcoming one.
I've already done some research and I came out with a couple of solutions, but they still don't satisfy me completly.
AWS IoT SiteWise has assets concept and it could possibly be the best choice, but we have found that we couldn't ingest data that is older than 7 days, and it's unacceptable since we'd like to upload all the old data.
Amazon Timestream with some SQL queries could do all the aggregation we needed but just to sum two series it's needed a pretty long query, and in case of dozens of series it would require a very long, not much manteinable and hard to write query.
Thanks in advance.
Hi,
In my current project I have the problem that no values are written to the assets. The data stream is first shown as dissociated, but after linking to the asset no value is written. The namespace is Ns= 4 s = ""
where Ns 4 is ="CODESYSSPV3/3S/IecVarAccess".
The target device is a WAGO PLC. the data type is a boolean.
The correct data stream is listed under Alias in the asset. Now i have no idea, how to fix it
thank you for your help
Hi, in the last days I started to work with aws SiteWise. First, I deployed a gateway with 4 OPC UA sources. But now i have the problem, that my assets do not find their values.
My Question is now, how I can check my incoming data from the gateway, to find out the alias for the measurement.
When i look at: AWS IoT SiteWise >Data streams, i see nothing.
Another problem is: At aws the browse path is separated by a forward slash. But the structure for my NoteId look like that:
ns=4;s=|var|WAGO 750-8207 PFC200 CS 2ETH RS 3G.Hochregllager.GVL_H.MANUELL
Here a Screenshot from the Server-Tree
[Server-Tree](https://ibb.co/ngtVBsm)
Did anyone know what the different between dot and forward slash mean ?
Some additional information
Sorry for the easy question, but I am truly a beginner in aws...