API Breaks past 8-9 Devices? - nest-api

It would seem that streaming breaks when there is too many devices in the account. After about 8 or 9 it just stops streaming data to me all together.

Are you using Firebase? I came on here to post a similar issue myself. If I change the temp through the nest device or the web tool, my Firebase listeners are updated. If I try to set a value, the value that I try to set is echoed back to my listener (like there has been an update on the thermostat even though it wasn't changed successfully) then, the correct value (unchanged) comes immediately after.
The weird thing is that it works.... then it just doesn't. Is this similar to what you've been experiencing?
Update:
Now it appears as if my listeners are not working either. I can query the server using REST successfully.
Update #2:
Now my listeners are working again but still no control.
Update#3:
Well... I think I see my problem at least. I don't know if it will help you (or me for that matter) but here it is...
protected void setHighTemp(int value){
fb.child("target_temperature_high_f").setValue(value, new CompletionListener() {
public void onComplete(FirebaseError arg0, Firebase arg1) {
System.out.println("Communicaiton error: " + arg0);
}
});
Output:
Communicaiton error: FirebaseError: Too many requests

I remember reading the following paragraph in https://developer.nest.com/documentation/glossary#client
Client
An integration of your application or service with Nest
devices. When you create a Nest account and sign up for the Developer
Program, you can add up to 10 clients to the account.
This might be your problem.

Related

SAP Cloud SDK for javascript using the destination

I have followed the Tutorial and build the basic CF based nodejs applciation to display all BusinessPartners from my S/4HANA on-premise destination.
function getAllBusinessPartners(): Promise<BusinessPartner[]> {
return BusinessPartner.requestBuilder()
.getAll()
.execute({
destinationName: 'MockServer'
});
}
Destination is configured with the Virtual host from cloud connector.
But after deploying to the Cloud Foundry, i get following error for the GET request
{"message":"Service of type destination is not supported! Consider providing your own transformation function when calling destinationForServiceBinding, like this:\n destinationServiceForBinding(yourServiceName, { serviceBindingToDestination: yourTransformationFunction });","level":"warn","custom_fields":{"package":"core","messageContext":"destination-accessor"},"logger":"sap-cloud-sdk-logger","timestamp":"2020-03-09T18:15:41.856Z","msg":"Service of type destination is not supported! Consider providing your own transformation function when calling destinationForServiceBinding, like this:\n destinationServiceForBinding(yourServiceName, { serviceBindingToDestination: yourTransformationFunction });","written_ts":1583777741856,"written_at":"2020-03-09T18:15:41.856Z"}
The application is already bound to the Destination service as well.
Can someone help me here, what went wrong ? or the approach to use destination is different in the new version of Cloud-SDK ?
After lot of attempts, i have made this to work.
My Observations:
Connectivity service is also required to be bound, when using on-premise S4 backend.
There was no errors in the log, i have made certain modification in the code to use async/await
async function getAllBusinessPartners(): Promise<BusinessPartner[]> {
return await BusinessPartner.requestBuilder()
.getAll()
.execute({
destinationName: 'MockServer'
});
}
After this modification, when I hit the GET request, it gave me the following error:
"Failed to get business partners - get request to http://s4h-scc-basic:500/sap/opu/odata/sap/API_BUSINESS_PARTNER/sap/opu/odata/sap/API_BUSINESS_PARTNER failed!"
Could notice that the suffix after the http://domain:port is twice. One I gave in the destination, and the other VDM adds automatically.
Ideally, this error is supposed to be thrown even before adding async/await.
After removing the suffix from the destination, it started to work.
If your request really does error, what you posted here from your logs is most likely not the reason for the failure. We are aware that this message is confusing and will improve it (https://github.com/SAP/cloud-sdk/pull/32).
Can you check whether there are more errors in your logs? Based on the code you posted and the setup you described, this should work. Do you have a binding to the XSUAA service.

communicate with console application in service fabric

I've just started a PoC on service fabric for a project and I'm stuck on something that should have been straightforward but has become a real pain ...
What I need to do is host a console app returning some values in the service fabric and be able to call it on demand and get back its return value.
So I've created a simple exe looking like this, hosted in a GuestExe
static void Main(string[] args)
{
Console.WriteLine("123");
File.AppendAllText("hello.txt" + DateTime.Now.ToString(), "Hello world!");
//Console.ReadLine();
}
First, if the readline is commented, the explorer shows the guestExe as failing and the file is not created.
If I uncomment it, the guest exe will appear as being good in the explorer, and the console app will be started on it's own (despite I didn't ask for it), the file will be created, and I won't be able to call it.
cluster image
I've tried to just hit few things in my browser : the endpoint above, http://localhost:19081/PoC9/GuestExe?cmd=instance and same without the cmd argument.
If anyone has any idea of how that should be done, please help :)

Xamarin Android: Can I not create a new object of my MainActivity?

I have a location mocking method in my main activity. Unfortunately, I cant put this method into another class (yet!). So, I need a service, to call this method from my main activity every 5 seconds. So i created a countdown in within a service that, while the app is in the background, should run the method in my MainActivity. But it doesnt.
public void OnTimedEvent(object sender, System.Timers.ElapsedEventArgs e)
{
Log.Info("2", "CountDown ausgeführt!");
var test = new MainActivity();
test.getMockLocation();
}
This is my code. As you can see, I'm installing a new object of my Main Activity and then ask for the method in within this activity. This does work. Well at least Visual Studio does not complain. If I now debug my app on my phone, nothing happens. I dont get no errors or anything.
Now, when I run this app Step by Step and it reaches this point
"var test = new MainActivity();"
I get "Frame not in Module".
So, it basically crashes as soon as I ask it to install a new object of my Main Activity.
May anybody tell me why this is?
THANKS :)
Unfortunately in Android you cannot create Activities like this, they need to be instantiated by the OS. Also, instantiate a whole Activity only for a method is not ideal, I suggest you to find the way to get that method/function out of that Activity so you can use it anywhere in your program.
Did you create your app via Xamarin Forms? If you did, you can utilize the Xamarin Forms MessagingCenter for background services and then you can call your mock location tasks.
This is the link for a very helpful walk-through and example of MessagingCenter.

Handling WinJS app upon relaunch

When back home is pressed app exists but it is not terminated yet.
When user press primary or secondary tile app is relauched.
Default way is to let application navigate to the last visited page in the navigation history.
I don't know if there is a bug but this way doesn't work as expected because any code inside page ready function executes but it doesn't count later when page is rendered. Static binding works but not dynamic.
I need to know what is the proper way of handling relaunch in an app that uses default navigation template?
What to do if I want clean start, destroy everything and than navigate to home?
How to overcome problem with framework not taking into consideration code inside page ready function?
Upon app initialization you should check for the ApplicationExecutionState, and do whatever you want in either case.
Thanks for your answer but it is quite clear from the start how to obtain ApplicationExecutionState.
Actually what I need was to execute all bindings and other post processing after DOM has been loaded in a promise timeout.
if (app.sessionState.previousExecutionState === 1) {
WinJS.Promise.timeout().then(function () {
performeAfterProcessing();
});
}
else {
performeAfterProcessing();
}
So if everyone encounters some strange behavior after application has been relaunched try to execute your code using promise timeout.

Uploading photos using Grails Services

I would like to ask, What would be the most suitable scope for my upload photo service in Grails ? I created this PhotoService in my Grails 2.3.4 web app, all it does is to get the request.getFile("myfile") and perform the necessary steps to save it on the hard drive whenever a user wants to upload an image. To illustrate what it looks like, I give a skeleton of these classes.
PhotoPageController {
def photoService
def upload(){
...
photoService.upload(request.getFile("myfile"))
...
}
}
PhotoService{
static scope="request"
def upload(def myFile){
...
// I do a bunch of task to save the photo
...
}
}
The code above isn't the exact code, I just wanted to show the flow. But my question is:
Question:
I couldn't find the exact definition of these different grails scopes, they have a one liner explanation but I couldn't figure out if request scope means for every request to the controller one bean is injected, or each time a request comes to upload action of the controller ?
Thoughts:
Basically since many users might upload at the same time, It's not a good idea to use singleton scope, so my options would be prototype or request I guess. So which one of them works well and also which one only gets created when the PhotoService is accessed only ?
I'm trying to minimize the number of services being injected into the application context and stays as long as the web app is alive, basically I want the service instance to die or get garbage collect at some point during the web app life time rather than hanging around in the memory while there is no use for it. I was thinking about making it session scope so when the user's session is terminated the service is cleaned up too, but in some cases a user might not want to upload any photo and the service gets created for no reason.
P.S: If I move the "def photoService" within the upload(), does that make it only get injected when the request to upload is invoked ? I assume that might throw exception because there would be a delay until Spring injects the service and then the ref to def photoService would be n
I figured out that Singleton scope would be fine since I'm not maintaining the state for each request/user. Only if the service is supposed to maintain state, then we can go ahead and use prototype or other suitable scopes. Using prototype is safer if you think the singleton might cause unexpected behavior but that is left to testing.

Resources