Closed deepakchopade closed 3 years ago
Hello @deepakchopade,
Hi Adam,
Thanks for replying. I will go through the documents which you have provided. Currently I am going through your project and i observed you have done lots of things. Thanks for sharing this on GitHub. I will reach you again if I face any issue.
Thanks, Deepak
On Fri, 6 Aug 2021 at 22:03, Adam Hrouda @.***> wrote:
Hello @deepakchopade https://github.com/deepakchopade,
- Here is how to issue application credentials (to be able to call MindSphere APIs): https://documentation.mindsphere.io/resources/html/developer-cockpit/en-US/124342231819.html
- I am not sure what you mean by creating endpoints, there are some endpoints ready to be used already e.g. read timeseries data, list assets and many many more. https://developer.mindsphere.io/apis/index.html Of course you can also create your own endpoints by developing and deploying an app that exposes API.
- You can used MindSphere API in your application as you want. You can use native HttpClients provided by the language you use or (recommanded) you can use SDK (depending on you technology). For Node.js: https://developer.mindsphere.io/resources/mindsphere-sdk-node/index.html or for .NET you can use this repository.😀
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/hroudaadam/mindsphere-sdk-dotnet/issues/1#issuecomment-894377053, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQFXPTAQMRSPADCQX3D5OZ3T3QFE5ANCNFSM5BBUB3EQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .
Ok, no problem, good luck with the developmennt 😊
Hi Adam,
I am trying to develop a blazor(ASP.NET) application for dashboard. I have followed the below process.
Written below code to retrieve Timeseries data from mindsphere.
using MindSphereSdk.Core.Common; using System.Net.Http; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using System.IdentityModel.Tokens.Jwt;
namespace WebAppServer.Data { public class TimeSeriesService {
public async Task<TimeSeriesData[]> GetTimeSeries()
{
var credentials =
AppCredentials.FromJsonFile(@"D:\ASP.NetCore\WebAppServer\WebAppServer\EnergyCred.json"); var httpClient = new HttpClient(); // var config = new ClientConfiguration(); var client = new IotTimeSeriesClient(credentials, httpClient); var request = new GetTimeSeriesRequest() { EntityId = "bd35f23e21af46e391ff2d6386e74fe6", PropertySetName = "MAINASPECT", From = DateTime.Now.AddDays(-1), To = DateTime.Now, Limit = 2 };
//var timeSeries = (await
client.GetTimeSeriesAsync
var timeSeries = (await
client.GetTimeSeriesAsync(request)).ToArray();
return (TimeSeriesData[])timeSeries;
}
}
}
Issue : It is retrieving NULL in time series.
Could you please help me out by guiding me.
Thanks, Deepak
On Sun, 8 Aug 2021 at 21:27, Adam Hrouda @.***> wrote:
Closed #1 https://github.com/hroudaadam/mindsphere-sdk-dotnet/issues/1.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/hroudaadam/mindsphere-sdk-dotnet/issues/1#event-5126794885, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQFXPTEIEMSM3YS33UK5CJDT32SOTANCNFSM5BBUB3EQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .
Hey Deepak, you should not cast dynamic types. If you want to use concrete types use generic version of GetTimeSeriesAsync method as follows.
var response = await client.GetTimeSeriesAsync<TimeSeriesData>(request);
I have tried to change that method in your code and everything worked fine (ofc with different values for my tenant). If there are still troubles try following.
TimeSeriesData
class correspond with the actual Aspect in the MDSP.If it still does not help you. I am going to need some more infos.
Also here is my working version of your code :-)
var credentials = AppCredentials.FromJsonFile("mdspcreds.json");
var httpClient = new HttpClient();
var client = new IotTimeSeriesClient(credentials, httpClient);
// GET DATA
var request = new GetTimeSeriesRequest()
{
EntityId = "73b2a7cdf27241e5b3f29b07266ff602",
PropertySetName = "acceleration",
From = DateTime.Now.AddDays(-1),
To = DateTime.Now,
Limit = 2
};
var response = await client.GetTimeSeriesAsync<TimeSeriesData>(request);
public class TimeSeriesData
{
public TimeSeriesData(DateTime time, double x, double y, double z)
{
Time = time;
X = x;
Y = y;
Z = z;
}
[JsonProperty("_time")]
public DateTime Time { get; set; }
[JsonProperty("x")]
public double X { get; set; }
[JsonProperty("y")]
public double Y { get; set; }
[JsonProperty("z")]
public double Z { get; set; }
[JsonProperty("te")]
public double T { get; set; }
}
Hi Adam,
Greetings!!! I am very happy to inform you that the data is getting reflected in the application after doing changes as suggested by you.
Changes :
Application screenshots :
1. Data from Mindsphere :
[image: image.png]
2. Dashboard : [image: image.png]
You have developed a wonderful framework and it helped me a lot to develop this application. It would not have been completed without your help and guidance.
Please keep in touch...
Thanks, Deepak Chopade
On Tue, 24 Aug 2021 at 22:00, Adam Hrouda @.***> wrote:
Hey Deepak, you should not cast dynamic types. If you want to use concrete types use generic version of GetTimeSeriesAsync method as follows.
var response = await client.GetTimeSeriesAsync
(request); I have tried to change that method in your code and everything worked fine (ofc with different values for my tenant). If there are still troubles try following.
- Check if properties in the TimeSeriesData class correspond with the actual Aspect in the MDSP.
- Make sure there are time series data in the MDSP for selected date.
- Make sure the application for which you have issued the credentials has the right MindSphere API Roles (e.g. mdsp:core:iot.tsaUser)
If it still does not help you. I am going to need some more infos.
- Screenshot of the aspect structure in the MindSphere.
- Code of you TimeSeriesData class.
Also here is my working version of your code :-)
var credentials = AppCredentials.FromJsonFile("mdspcreds.json");var httpClient = new HttpClient();var client = new IotTimeSeriesClient(credentials, httpClient); // GET DATAvar request = new GetTimeSeriesRequest() { EntityId = "73b2a7cdf27241e5b3f29b07266ff602", PropertySetName = "acceleration", From = DateTime.Now.AddDays(-1), To = DateTime.Now, Limit = 2 }; var response = await client.GetTimeSeriesAsync
(request); public class TimeSeriesData { public TimeSeriesData(DateTime time, double x, double y, double z) { Time = time; X = x; Y = y; Z = z; }
[JsonProperty("_time")] public DateTime Time { get; set; } [JsonProperty("x")] public double X { get; set; } [JsonProperty("y")] public double Y { get; set; } [JsonProperty("z")] public double Z { get; set; } [JsonProperty("te")] public double T { get; set; }
}
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/hroudaadam/mindsphere-sdk-dotnet/issues/1#issuecomment-904794485, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQFXPTG4V47JQ7NEU7TIZQTT6PCL5ANCNFSM5BBUB3EQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .
Hello Deepak, I am so glad to hear that! You can contact me anytime if you need anything else. Also please let me know if you find any issues or missing features. I have already found some bugs which will be addressed in the next version of the SDK.
Thank you for your comment 🤗
Best wishes, Adam
Hi Adam,
Currently I have worked on Time Series data only. I am going to use other methods also. I will let you know if I find any issues. Could you please provide me with what bug you have found.
Thanks, Deepak
On Fri, 27 Aug 2021 at 02:50, Adam Hrouda @.***> wrote:
Hello Deepak, I am so glad to hear that! You can contact me anytime if you need anything else. Also please let me know if you find any issues or missing features. I have already found some bugs which will be addressed in the next version of the SDK.
Thank you for your comment 🤗
Best wishes, Adam
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/hroudaadam/mindsphere-sdk-dotnet/issues/1#issuecomment-906751125, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQFXPTCIKGYQ55LDNCVUGL3T62VZVANCNFSM5BBUB3EQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
It is not so obvious bug. When you create concrete client (e.g. AssetManagementClient) you pass to its constructor credentials and HTTP client. Base on those SDK client will create its own MindSphereConnector that internally keeps access token to the MindSphere APIs. Problem is when you create multiple SDK clients each manages its own connector (thus token) which is quite inefficient.
New version will take a better approach that will result in slightly different way how you initialize the SDK clients. Nothing to worry just few changes in your code (where you create the IoTClient) and everything will be alright. The methods that you use to fetch data stay the same.
The new version will also add some new features:
Hi Adam,
Thanks for providing information. We had a demo today on mindsphere connectivity and application dashboard. Demo went well. We got some suggestions below from the audience.
Could you please help me out by giving solutions to the above two points.
I have one more request. Could I get your personal mail id.
Thanks, Deepak
On Fri, 27 Aug 2021 at 12:39, Adam Hrouda @.***> wrote:
It is not so obvious bug. When you create concrete client (e.g. AssetManagementClient) you pass to its constructor credentials and HTTP client. Base on those SDK client will create its own MindSphereConnector that internally keeps access token to the MindSphere APIs. Problem is when you create multiple SDK clients each manages its own connector (thus token) which is quite inefficient.
New version will take a better approach that will result in slightly different way how you initialize the SDK clients. Nothing to worry just few changes in your code (where you create the IoTClient) and everything will be alright. The methods that you use to fetch data stay the same.
The new version will also add some new features:
- client configuration (proxy, timeout)
- new type of credentials (UserCredentials)
- improved validations and error handling
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/hroudaadam/mindsphere-sdk-dotnet/issues/1#issuecomment-906979404, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQFXPTHASSRKAQ47B7YHVADT6423TANCNFSM5BBUB3EQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
Hey Deepak, I am happy to hear that. Unfortunately I am no expert on this matter. I am no longer working with MindSphere, the only thing I do with MindSphere is that I wrap its APIs with .NET code. However I can get you some suggestions.
I'm sorry I couldn't be more helpful (as I've said I am no longer working with MindSphere).
Adam
Hi Adam,
Thanks for helping me again. I will follow your suggestions. I will try to do it. If I am able to do that, I will let you know the result.
No need to say sorry. You helped me a lot 😊.
Thanks, Deepak
On Sat, 28 Aug 2021 at 18:38, Adam Hrouda @.***> wrote:
Hey Deepak, I am happy to hear that. Unfortunately I am no expert on this matter. I am no longer working with MindSphere, the only thing I do with MindSphere is that I wrap its APIs with .NET code. However I can get you some suggestions.
- As far as I know the MindSphere can not control your machines. You can send e.g. HTTP requests from your application directly to the machine (or some controller).
- Perhaps WebSockets? https://developer.mindsphere.io/concepts/concept-gateway-url-schemas.html#websockets
I'm sorry I couldn't be more helpful (as I've said I am no longer working with MindSphere).
Adam
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/hroudaadam/mindsphere-sdk-dotnet/issues/1#issuecomment-907624190, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQFXPTCEDZXSBEXUFLS24YLT7DNTVANCNFSM5BBUB3EQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
Hi Adam,
I have gone through your project. Architecture is very nice. Currently i am developing one app using ASP.Net Core and want to deploy in Mindsphere cloud. I am facing the below issue.
Intially i am trying to develop graphs in app. Could you please help me out..
Thanks