ios zway authentication - help

Discussions about Z-Way software and Z-Wave technology in general
pofs
Posts: 688
Joined: 25 Mar 2011 19:03

Re: ios zway authentication - help

Post by pofs »

Are you not specifying content type for post request?

yzheng
Posts: 8
Joined: 09 Oct 2015 23:38

Re: ios zway authentication - help

Post 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);
     }];

pofs
Posts: 688
Joined: 25 Mar 2011 19:03

Re: ios zway authentication - help

Post 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.

yzheng
Posts: 8
Joined: 09 Oct 2015 23:38

Re: ios zway authentication - help

Post 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.

Post Reply