I've trying to setup ThingsBoard for a few days and up to now it's going well. I'm stuck on how to push attributes (sometimes in an aggregate mode - avg, sum, etc) and telemetry data from a Device to its related asset.
Any simple way to do it? I didn't find any API for such.
Thanks
The following is the API for pushing telemetry data for asset, but you also need to be atleast a customer user to use the api i.e need to set authorization token in header as x-authoization: Bearer {JWTtoken}
API: /api/plugins/telemetry/ASSET/{assetId}/timeseries/SERVER_SCOPE/
method : POST
request(example):
{
"ts": 1563456910227,
"values": {
"longitude": "78.381984",
"latitude": "17.448645",
"fuel": "30",
"speed": "42",
"vehicleType": "bus",
"status": "On route"
}
}
Thingsboard supports MQTT, CoAP and HTTP. See https://thingsboard.io/docs/user-guide/telemetry/#device-telemetry-upload-api for details.
I had a similar problem and was able to fix it by:
(1) in GUI adding a relation from the DEVICE to an associated ENTITY (in my case it was CUSTOMER entity Type)
N.B. here is a related question with a possible solution for creating the relation in code.
then
(2) updating the root rule chain in thingsboard (also via the GUI). Step by step instructions and a picture of my working rule chain canvas can be found in here.
After taking these steps I was not only able to see latest device telemetry show up on latest telemetry for the related customer in the GUI, but also was able to get back the device id in api response to my request for latest telemetry from all devices belonging to a customer.
In rule chain you can do it easily,
first filter the message to make sure you are selecting the right one, then use " Enrichment node" called (duplicate to related) then use save telemetry like attached.
enter image description here
Push Data from Device to Asset - Basic Example
You can leverage Rule Engine to do that in real time.
First of all you have to establish a relation between a device and an asset which can be done via the Web UI or REST APIs. Below a screenshot for asset Building A that contains the device Thermostat A:
To push Thermostat A data to the related asset Building A, use a Rule Chain where key steps are changing the message originator from device to related asset, and then saving timeseries (or attributes) for the asset. You can decide whether to perform a double saving (first on device and then on asset, as I've done in the rule chain below) or to store data only at asset level. I consider good practice to store raw data as soon as they're uploaded, and to do additional persistence after further computations if needed.
Push data from Device to Asset - Advanced Example
An advanced version of the above example is described here and it shows the calculation of delta temperature between outdoor and indoor thermostats (the devices) installed into a warehouse (the asset).
Professional Edition Rule Nodes
There are some rule nodes suitable for your purposes, such as Duplicate To Related or Aggregate Stream, but they are available only on the Thingsboard PE edition.
Related
Good afternoon. I am using Agora - UE4 Bluprint version.
I can not find a way to access the frame of the new connected user. This is provided that more than two people are connected. The first connected each tick causes "OnLocalFrameReceivedDelegate"
all subsequent connected call "OnRemoteFrameReceivedDelegate". In total, it turns out that you can broadcast the image from the camera of the first connected or the second. And how to take the camera of all subsequent connected?
In our blueprint example, we have two images that receive Agora video frames:
CameraFrame - the Local user
InterlocutorFrame - the Remote user
If you call into the blueprint example with 3 or more people, you will see that you can switch between UIDs in the dropdown menu.
Switching UIDs changes the InterlocutorFrame video feed to the remote user whose UID matches the one you specify, like so:
To display multiple users, you need to place multiple UI Images on the screen, and SetBrushFromTexture with the appropriate UID.
I would suggest using the OnUserJoined callback to create a new image actor, and store the new incoming UID inside that actor. You could also store all the current UIDs in one place, or use another solution that you think is best :)
just started using Keen.IO…very nice product. I have a question please on data modeling:
I am tracking mobile app registration events that have the following attributes:
Device Id,
Platform,
Manufacturer,
Marketing Version,
Language and
Latitude and Longitude
The problem is that the mobile app sends this registration every time the device changes location. In a way, it is to maintain the device latest location and keep track of historic changes. I created a new collection for devices and it seems to be OK as I am able to select_unique the keen.location.coordinates to draw the devices on a map.
The question though is how would I know the latest location update? So now I have several events in the collection for the same device (uniquely identified by a device id) but no way of finding the latest!
Thank you for any pointer.
Regards,
Khaled
It is technically possible to use existing Keen query types to retrieve the latest position of a device as you require, the problem is doing so is inefficient and doesn't scale well (mainly because Keen is designed to store/query event data, not entity data). You'd have to plug the Device Id you retrieve from the select_unique into individual queries for each device to find the latest location. Doing so would bump you up against concurrency and/or rate limiting fairly quickly.
That being said, that leaves you with a few options:
Use Keen's S3 integration. This feature writes all of your raw events to S3 for consumption however you see fit. You could use this data to create a pipeline to a separate entity database which would allow you to retrieve the device's latest location. Note: there is an extra charge for this feature.
Post device/location data to a separate entity database at the same time you're sending the event to Keen, and use that database as the source of the device's latest location.
Either of these options will work, it just depends on how you'd like to implement/manage data collection in your application.
I think you can achieve this by combining a select_unique query with a group_by clause and looking at the last item in the result.
Though, as terrhorn noted – it's not a scalable solution. I wouldn't use it for anything other than dashboarding.
Here's a quick example:
var query = new Keen.Query("select_unique", {
eventCollection: "devices",
targetProperty: "location",
group_by: "device_id"
});
The result will look something like this:
{
"result": [
{
"device_id": "4252f729-7bdc-a487-be15-984999a96683",
"result": [
"location_1",
"location_2"
]
}
]
}
NOTE: This is theoretical – I'm not sure if Keen sorts the result of the group_by by the order in which the events came in or not – but it's a good assumption to test. I don't see why they wouldn't.
QuickBooks Online (QBO) uses a URL format like qbo.intuit.com/app/timeactivity?txnId=123 to point to, in this example, a TimeActivity.
However, in the API, resources are referenced by entityId (returned as just Id when querying via the TimeActivity API), which is different from txnId.
In my time tracking web app, I have a feature that exports time to QBO as TimeActivities. I'd like to provide users with direct links from the time entered in my app to the corresponding TimeActivity in QBO—is there any way to do so?
The answer to this is that it's not currently possible because there's multiple base URLs (I think they call them "realms") in use for QuickBooks Online (qbo.intuit.com is only one of them). Because you do not receive this information as part of linking to QBO via OAuth, there's unfortunately no way to construct proper links.
Yes, when creating a successful TimeActivity you will receive back an Id, which I assume you are persisting.
That Id can be used to query QBO in a simple GET request.
<baseURL>/company/{companyID}/timeactivity/{timeactivityId}
Context
I am in the process of providing some consultancy on doing a HTTP GET using YouTube Data API V3; in order to develop a Windows based application to GET a list of results from Youtube, for say a specific CATEGORY, or a specific TAG.
We are open to using any programming language(I'm from a C++ background and am hoping You tube will support direct HTTP connections without using Google client SDK and so on) to connect to YouTube and (HTTP) GET data.(Once a month or so, so YouTube API quotas should not be problem).
The Issue
We are being told by some of my client's web developers that YouTube API v3 will only return a maximum of 500 records/results, for say a query that returns JUST the Total viewers, the Video's link, and basic meta data such as that.
S, say I wish to find 5,000 results for category "House music" or "basketball" - and I have the Developer Key etc are all set up, would that be possible?
If so, what GET fields would I need to populate(such as "max_results_per_page")?
Thank you.
The API won't provide more than ~500 search results for any arbitrary query. It's by design. Technically, it means that the nextPageToken field won't be returned once you hit ~500 results. No additional parameter can change that.
If you want more than ~500 results for a query, you have to split it into more specific sub-queries. I'd suggest using the publishedAfter and publishedBefore parameters to achieve that, but feel free to experiment with the other ones here.
This only holds for the search-Query. Other queries like "PlaylisItem:list" deliver more results. I have tested with 100.000 items to get the videos of a playlist.
I am new to Clickbank.
I want to try out the API for the same.
But I am stuck in between.
Can anyone guide me through the steps to successfully create a product.
I am getting some errors
You must make a test purchase before submiting this request.
A footer disclaimer is required for all Pitch and Thank You pages.
Also wanted to know, like how can I setup the sandbox account?
Please help me out.
Thanks in advance.
This question was asked a very long time ago but I just happened across it and know the answers.
First, however I think anyone starting on ClickBank, technical or otherwise, will benefit from the following: https://www.clickbank.com/launch-checklist/
Now, to answer the question(s):
Test Purchase:
• Can't do this without creating a product first
• To create a product you do the following:
Login to the account
Click: Vendor Settings -> My Products
On this page locate the list of ADD NEW buttons & Click Product
The product editor pretty well walks you through the process
AND now for the test purchase.
That process is described here: https://support.clickbank.com/hc/en-us/articles/360036958431-How-do-I-test-a-payment-link-
Footer/disclaimer:
This is what is known as the ClickBank Trust Badge currently, (not sure about 9years ago).
It's a little element that you copy and paste into your webpage, after configuring what you want it to look like & where you want it to be, from the available options.
To find and set it up:
Login to the account
Click Vendor Settings -> My Site
Scroll down to the section with the title "ClickBank Trust Badge - Injection Code"
If you like the default setup you can copy what's in the Javascript Snippet field
If you want to change where it's located and colors click the Configure Settings button (not going to describe everything here as it's pretty straight forward as well)
ClickBank APIs
Last, you mentioned wanting to use the ClickBank API, which I happen to know very well. However, the documentation for it is also actually pretty good so let me start off with that:
General ClickBank API documentation
Additionally each APIs primary endpoint is self documenting. Additionally this documentation tends to be the most relevant for a programmer
Example of self documenting endpoint: https://api.clickbank.com/rest/1.3/orders2
So, it's worth noting the following that are required to use the API:
You must have an HTTP header of "Authorization" and it must be set to both of the API keys for an account.
Both keys refers to the API- "Clerk Key" as well as the DEV- "Developer Key"
Enter them both, separated by a colon ":" as the value of the Authorization key with the DEV- key first (DEV-A23478C...:API-IA23456...)
You must also use the correct HTTP request type for the query you are wanting to make (the only two that are utilized are GET and POST)
Examples:(NOTE: ACCOUNT_NAME_HERE is the ClickBank "nickname" or account name)
Single transaction: https://api.clickbank.com/rest/1.3/orders2/RECEIPT_NUMBER_HERE
List transactions by date range and specific account: https://api.clickbank.com/rest/1.3/orders2/list?vendor=ACCOUNTNAME_HERE&startDate=2021-12-11&endDate=2021-12-14
Count of transactions by date range: https://api.clickbank.com/rest/1.3/orders2/count/?vendor=ACCOUNT_NAME_HERE&startDate=2022-01-01&endDate=2022-01-01
Monetary value of transactions by date range: https://api.clickbank.com/rest/1.3/quickstats/count/?account=ACCOUNT_NAME_HERE&startDate=2022-02-01&endDate=2022-02-10
Sending shipping data for physical products (POST): https://api.clickbank.com/rest/1.3/shipping2/shipnotice/4NVXUFNW?item=2&date=2018-08-14&carrier=UPS&tracking=1NH323452345WODFS&comments=Test%20again%20comment%20with%20spaces10%20receipt=4NVXUFNW