Page 2 of 2

Re: ios zway authentication - help

Posted: 16 Oct 2015 22:53
by pofs
Are you not specifying content type for post request?

Re: ios zway authentication - help

Posted: 16 Oct 2015 23:37
by yzheng
pofs wrote:Are you not specifying content type for post request?
This is my code, I have not specified content type for post request.

Code: Select all

AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
     manager.responseSerializer = [AFJSONResponseSerializer serializer];
     manager.requestSerializer.cachePolicy = NSURLRequestReloadIgnoringLocalAndRemoteCacheData;
     [manager.requestSerializer setAuthorizationHeaderFieldWithUsername:@"admin" password:@"admin"];
     [manager POST:@"http://192.168.0.12:8083/ZAutomation/api/v1/devices/ZWayVDev_zway_2-0-37/command/on" parameters:nil
     success:^(AFHTTPRequestOperation *operation, id DATA) {
     NSLog(@"notifications: %@",DATA);
     } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
     NSLog(@"getNotifications Error : %@",error.description);
     }];

Re: ios zway authentication - help

Posted: 17 Oct 2015 00:09
by pofs
Seems the serializer doesn't specify content type when there's no content.

Why using POST with empty parameters at all?
GET should do the same without this error.

Re: ios zway authentication - help

Posted: 17 Oct 2015 00:31
by yzheng
pofs wrote:Seems the serializer doesn't specify content type when there's no content.

Why using POST with empty parameters at all?
GET should do the same without this error.
Thanks pofs. It works now. I thought I should use POST for all the commands sending to the device.

During the testing through the web interface these days, I noticed Razberry can be non-responsive (request time out) sometime. I have to reboot it to fix the issue. Is there any solution other than reboot?

Another issue is, at the moment, I am using local ip to control the devices. How can I control them from out door? I know I can log onto find.zwave.me from the web browser to control them. How can I do the same function from iphone app? Can you provide me some sample codes?

I know above questions are not related to this thread. I can open a new thread if needed.