How to see BACnet scrape data on volttron.log - volttron

Can someone give me a tip on how see the BACnet scrape data on the VOLTTRON .log?
Would this have anything to do with the log level? Maybe I just cant see any data because of incorrect log levels? Any tips setting the log level appropriate greatly appreciated.
vctl config get platform.driver devices/201201
returns this:
{
"driver_config": {
"device_address": "12345:2",
"device_id": 201201
},
"driver_type": "bacnet",
"interval": 60,
"registry_config": "config://registry_configs/201201.csv"
}
Running:
vctl config get platform.driver registry_configs/201201.csv
Looks good I can see all of the device points that were discovered:
{
"Reference Point Name": "Oat",
"Volttron Point Name": "Oat",
"Units": "degreesFahrenheit",
"Unit Details": "",
"BACnet Object Type": "analogValue",
"Property": "presentValue",
"Writable": "FALSE",
"Index": "301",
"Write Priority": "",
"Notes": ""
},
{
"Reference Point Name": "RmTmpSpt",
"Volttron Point Name": "RmTmpSpt",
"Units": "degreesFahrenheit",
"Unit Details": "",
"BACnet Object Type": "analogValue",
"Property": "presentValue",
"Writable": "FALSE",
"Index": "302",
"Write Priority": "",
"Notes": ""
},
{
"Reference Point Name": "RmTmp",
"Volttron Point Name": "RmTmp",
"Units": "degreesFahrenheit",
"Unit Details": "",
"BACnet Object Type": "analogValue",
"Property": "presentValue",
"Writable": "FALSE",
"Index": "300",
"Write Priority": "",
"Notes": ""
}
Running a vctl status and even restarting UUID a and 4 doesnt seem to do anything.
UUID AGENT IDENTITY TAG STATUS HEALTH
a bacnet_proxyagent-0.5 platform.bacnet_proxy proxy running [73753] GOOD
4 platform_driveragent-4.0 platform.driver platform_driver running [73754] GOOD
6 simplewebagent-0.1 webagent simpleWebAgent
Also the BACpypes.ini has the proper ID address set for the IP address of the computer running VOLTTRON.
Any tips appreciated.

Generall you won't want all of the data going through the message bus in the log as that will make your log huge and fill up the system.
However, if you install and start a listener agent you will get that behaviour. A listener agent will write to the log everything that goes through the message bus. It is located in the examples/ListenerAgent from the volttron repository.

Related

Coinbase Pro API client_oid always empty

I've run into an issue using the Coinbase Pro sandbox API to test my software.
When placing orders, I POST a client_oid field along with the rest of the body to the REST API, the order gets filled properly but when the received message arrives through the websocket stream, the client_oid is always an empty string.
Anyone knows why is that and how to fix this?
Example data POSTed when placing the order:
{
"type": "market",
"side": "buy",
"product_id": "BTC-EUR",
"funds": "1000",
"client_oid": "dev_node-order-1"
}
And here's the matching websocket message of type received:
{
"type": "received",
"side": "buy",
"product_id": "BTC-EUR",
"time": "2021-08-15T16:57:29.079657Z",
"sequence": 52030416,
"profile_id": "[MY-PROFILE-ID]",
"user_id": "[USER-ID]",
"order_id": "d1f60730-8960-495e-a7eb-cd37baa46768",
"order_type": "market",
"funds": "995.0245866076",
"client_oid": ""
}
As you can see the received client_oid is empty, any idea why?
So the problem was that the client_oid needs to be of the UUID format, for example 9bffcb70-13ea-11ec-abc7-7dfab310af81, if not of this format the field is ignored.

Is there anyway to store folder Content in a .JSON file variable?

i am completely new to JSON and Java in General.
i have a Task with a similar Block of code:
{
"name": "Chew Barka",
"breed": "Bichon",
"age": "2 years",
"weight": 8,
"bio": "The park, The pool or the Playground - I love to go anywhere!",
"filename": ""
},
And i would like to have the Contents of the folder:
"C:/Temp" for example
Stored in "filename"
so that when i call "filename" i get the "C:/Temp" Content

How do I properly extract/convert JSON data into objects?

I have structure below coming via webhook and I'm having trouble understanding if there is built in action in Logic App to get nicely formatted object array of rows which is inside table, where each item will have name and associated value with it.
"SearchResults": {
"tables": [
{
"name": "PrimaryResult",
"columns": [
{
"name": "TimeGenerated",
"type": "datetime"
},
{
"name": "ResourceGroup",
"type": "string"
},
{
"name": "ActivityStatusValue",
"type": "string"
},
{
"name": "d_resource",
"type": "dynamic"
},
{
"name": "c_title",
"type": "dynamic"
},
{
"name": "c_details",
"type": "dynamic"
}
],
"rows": [
[
"2020-06-18T16:30:07.89Z",
"USEASTPROD",
"Updated",
"aueglbwvhypap07",
"Remote disk disconnected",
"We're sorry, your virtual machine is unavailable because of connectivity loss to the remote disk. An unexpected problem is preventing us from automatically recovering your virtual machine."
],
[
"2020-06-18T16:30:07.89Z",
"USEASTPROD",
"Updated1",
"agggggypap07",
"Remote disk disconnected",
"We're sorry, your virtual machine is unavailable because of connectivity loss to the remote disk. An unexpected problem is preventing us from automatically recovering your virtual machine."
]
]
}
]
}
I'd like it to be an array where columns are entity name and each value from rows is it's value like below
"rows": [
[
"timeGenerated" :"2020-06-18T16:30:07.89Z",
"ResourceGroup": "USEASTPROD",
"ActivityStatusValue":"Updated",
"d_resource" : "aueglbwvhypap07",
"c_title" : "Remote disk disconnected",
"c_details": "We're sorry, your virtual machine is unavailable because of connectivity loss to the remote disk. An unexpected problem is preventing us from automatically recovering your virtual machine."
],
[
"timeGenerated" :"2020-06-18T16:30:07.89Z",
"ResourceGroup": "USEASTPROD",
"ActivityStatusValue":"Updated1",
"d_resource" : "agggggypap07",
"c_title" : "Remote disk disconnected",
"c_details": "We're sorry, your virtual machine is unavailable because of connectivity loss to the remote disk. An unexpected problem is preventing us from automatically recovering your virtual machine."
]
]
For this requirement, we can just use liquid with integration account in logic app to implement it. Please refer to the steps below:
1. We need to create an integration account on azure portal first and link it to your logic app. You can refer to this tutorial.
2. In my logic app, I initialize a variable and store your data(add a {} around the data) to simulate your situation.
3. Then use "Parse JSON" action to parse the string above.
4. Create a liquid map in local (I named it as testRow.liquid) with the code below:
{% assign rows = content.SearchResults.tables[0].rows %}
{
"rows": [
{% for item in rows %}
{
"timeGenerated": "{{item[0]}}",
"ResourceGroup": "{{item[1]}}",
"ActivityStatusValue": "{{item[2]}}",
"d_resource": "{{item[3]}}",
"c_title": "{{item[4]}}",
"c_details": "{{item[5]}}"
},
{% endfor %}
]
}
Upload the liquid map(testRow.liquid) to your integration account, for this step you can refer to this tutorial.
5. Then use "Transform JSON to JSON" action", choose the Body from "Parse JSON" action above and use the map which you upload.
6. After running the logic app, we can get the result as below:
The whole result json is:
{
"rows": [
{
"timeGenerated": "6/18/2020 4:30:07 PM",
"ResourceGroup": "USEASTPROD",
"ActivityStatusValue": "Updated",
"d_resource": "aueglbwvhypap07",
"c_title": "Remote disk disconnected",
"c_details": "We're sorry, your virtual machine is unavailable because of connectivity loss to the remote disk. An unexpected problem is preventing us from automatically recovering your virtual machine."
},
{
"timeGenerated": "6/18/2020 4:30:07 PM",
"ResourceGroup": "USEASTPROD",
"ActivityStatusValue": "Updated1",
"d_resource": "agggggypap07",
"c_title": "Remote disk disconnected",
"c_details": "We're sorry, your virtual machine is unavailable because of connectivity loss to the remote disk. An unexpected problem is preventing us from automatically recovering your virtual machine."
}
]
}
By the way:
The format of the sample you provided is invalid in json, we must use {} instead of [] in each of the item.
In liquid map, it will convert your datetime to another format automatically.
Hope it helps~

Visual Studio Code SQL Server connection to encrypted database with Azure Key Vault (Always Encrypted)

I'm trying to get a connection from VSCode on macOS to a SQL Server database that uses always encrypted mechanism to protect some of the columns. The master key is stored in an Azure Key Vault.
Using the always encrypted guide provided by Microsoft is was able to connect successfully to the database.
The same is true for a simple connection using VSCode on my mac without turning on the encryption/decryption. I used the mssql-extension plugin and providing the necessary information within the settings I was able to query the data
Settings
"mssql.connections": [
{
"server": "XXXXXXXX.database.windows.net",
"database": "AlwaysEncrypted",
"authenticationType": "SqlLogin",
"user": "XXXXX",
"password": "",
"emptyPasswordInput": false,
"savePassword": true,
"profileName": "AlwaysEncrypted"
}
]
Query
SELECT * FROM EmployeeDetails
Result
[
{
"EmployeeDetailsId": "1",
"EmployeeNo": "FE00000001",
"FirstName": "0x013EC8AB61767E1C3D934AB061BCA658B6948637812450C8245DCE4C447F59FD1D6252069A36A67E3477E1C5FB24D860E72FBCC65F98C92B92AB873CE55349672A",
"MiddleName": "0x015354526EC17EB1151AE918514E565507EDCB5691B4215C45798CA86EB11C47EECA579242926EDFE9F6543006177CBFC03E0F95CD0D8CAE6C941AE173AAF2B925",
"LastName": "0x0170B3FD2B0416E0607312FB2A67B0F42798EC1871FEAB90AB81235ADACDE1C4F5614099FA3B61E59FEB2D6AD599CB3A9FD031FE56F327F0C80F4BA963EE7E155A",
"DateOfBirth": "1985-08-12 00:00:00.000"
}
]
Following the two guides
https://learn.microsoft.com/en-us/sql/connect/odbc/using-always-encrypted-with-the-odbc-driver?view=sql-server-2017
https://github.com/Microsoft/vscode-mssql/wiki/manage-connection-profiles
I did try to create another connection using the mssql-extension and providing a ODBC Connection String but ultimately failed to get decrypted data when querying (the connection was established just fine). The result was the same as posted above
Settings with Connection String
"mssql.connections": [
{
"server": "XXXXXXXX.database.windows.net",
"database": "AlwaysEncrypted",
"authenticationType": "SqlLogin",
"user": "XXXXX",
"password": "",
"emptyPasswordInput": false,
"savePassword": true,
"profileName": "AlwaysEncrypted_WithKeyVault",
"connectionString": "SERVER=XXXXXX.database.windows.net;Trusted_Connection=Yes;DATABASE=AlwaysEncrypted;ColumnEncryption=Enabled;KeyStoreAuthentication=KeyVaultPassword;KeyStorePrincipalId=USER.NAME#DOMAIN.com;KeyStoreSecret=PASSWORD"
}
]
Can anyone help me to figure out how to setup the connections right, so that the encryption/decryption will he done transparently when using VSCode?
Bit of a stale question, but for anyone who also ends up finding this:
I managed to get a successfully connection on VS Code SQL Server by having the following settings in my settings.json mssql.connections array:
{
"server": "XXXX.serverhost.domain",
"database": "XXXX",
"authenticationType": "SqlLogin",
"user": "XXXX",
"password": "",
"savePassword": true,
"profileName": "XXXX",
// specifically the settings below were the important ones
"encrypt": true,
"trustServerCertificate": true,
"persistSecurityInfo": true
}

Solr gives different querynorm for the same query

I am using Solr for searching institutions... My Solr DB has around 400k documents each of which has multiple fields like ("name","id","city",...)...
A document in my DB looks like this:
"docs":
{
"id": "91348",
"p_code": "71637",
"name": "University of Toronto - Mississauga",
"ext_name": "",
"city": "Mississauga",
"country": "CA",
"state": "ON",
"type": "academic/campus",
"alt_name": "",
"ext_city": "",
"zip": "L5L 1C6",
"alt_ext_city": "",
}
I write a query like {name: (university of toronto)}... Top two matches are:
"docs":
{
"id": "91348",
"p_code": "71637",
"name": "University of Toronto - Mississauga",
"ext_name": "",
"city": "Mississauga",
"country": "CA",
"state": "ON",
"type": "academic/campus",
"alt_name": "",
"ext_city": "",
"zip": "L5L 1C6",
"alt_ext_city": "",
"_version_": 1473710223400108000,
"score": 1.499069
},
{
"id": "10624",
"p_code": "7938",
"name": "University of Toronto",
"ext_name": "",
"city": "Toronto",
"country": "CA",
"state": "ON",
"type": "academic",
"alt_name": "Saint George Downtown Campus",
"ext_city": "",
"zip": "M5S 1A1",
"alt_ext_city": "",
"_version_": 1473710220148473900,
"score": 1.4967358
}
I am really surprised to see that "University of Toronto - Mississauga" returns a higher score than "university of Toronto". Intuitively, the field containing "University of Toronto - Mississauga" should get a lower score since it is longer than the other one.
I was also very surprised to see that Solr gives different values for querynorm as follows:
(0.03198291 = queryNorm) for the top document and (0.03203078 = queryNorm) for the second ranked document. I presumed that the query norm should be exactly the same for the all documents as it is only a function of the query.
I am not sure if I got something wrong about how Solr works or there is something wrong in indexing or configuration? Has anybody faced the same problem?
Make sure that omitNorms is set to false for that field and that your collection is using the latest version of the schema. Then re-index all of your documents for the change to the field to take effect.
I've found that some schema modifications are best treated with a complete wipe of the index prior to indexing in new content. I am not sure, but I believe this may be one of them. For most of the changes you can just re-index all of your content and overwrite the old stuff.

Resources