Trigger Scene or Device through a HTTP Get Request

  • 219 Views
  • Last Post 23 June 2013
Rod posted this 16 June 2013

Is there a way to trigger a scene or a device through an HTTP Get Request on the same network or through the cloud server? If yes, what is the syntax to do so?

Order By: Standard | Newest | Votes
Ryan-Scott posted this 16 June 2013

Is there a way to trigger a scene or a device through an HTTP Get Request on the same network or through the cloud server? If yes, what is the syntax to do so?


Rod, yes, there's a way:

http://developer.incontrolha.com/json-api/introduction.aspx

Let me know if you have any questions about the API documentation.

Rod posted this 16 June 2013

The link appears to be broken?

Ryan-Scott posted this 16 June 2013

The link appears to be broken?


It's a pretty new site (last night it came online), so it could just be that the DNS hasn't been updated yet. If you know how to modify your hosts file, you can add a host for that domain pointing to 208.71.141.194.... otherwise, wait for a bit and try again -- it should show up soon depending on your DNS.

Rod posted this 16 June 2013

Hi Ryan,

Thanks for the quick responses. It really helps when you're trying to trouble shoot things. I tried the following GET calls and so far it doesn't work:

http://192.168.1.xxx:1178/zwave/activateSceneGet?password={xxxxx}&sceneName={mainoff}
http://192.168.1.xxx:1178/zwave/activateSceneGet?password=xxxxx&sceneName=mainoff

xxx are obviously my data... mainoff is the correct case sensitive name.

I'm using IC HA 3.7.4875

Any idea?

rscott posted this 16 June 2013

Hi Ryan,

Thanks for the quick responses. It really helps when you're trying to trouble shoot things. I tried the following GET calls and so far it doesn't work:

http://192.168.1.xxx:1178/zwave/activateSceneGet?password={xxxxx}&sceneName={mainoff}
http://192.168.1.xxx:1178/zwave/activateSceneGet?password=xxxxx&sceneName=mainoff

xxx are obviously my data... mainoff is the correct case sensitive name.

I'm using IC HA 3.7.4875

Any idea?


If you aren't already, can you try it in a browser? Also, an easy test to make sure the server and port is correct is to first try using localhost and retrieving the device list.

Also, the command without the curly brackets is the correct syntax.

Rod posted this 16 June 2013

If I enter it into a browser I get:

Service

Endpoint not found.

I also know the base URL is correct as I can retrieve the JSON device list.

Rod posted this 16 June 2013

I tried this in a browser:

http://192.168.1.xxx:xxxx/zwave/device/1aba0654-70b8-4c41-bbeb-xxxxxxxxxxxxx?password=xxxxxxx

and received:

Request Error
The server encountered an error processing the request. The exception message is 'Cannot serialize parameter of type 'MLS.HA.DeviceController.Common.Device.ZWave.ZWaveHaDevice' (for operation 'getDevice', contract 'IzWaveSVC') because it is not the exact type 'MLS.HA.DeviceController.Common.Device.HaDevice' in the method signature and is not in the known types collection. In order to serialize the parameter, add the type to the known types collection for the operation using ServiceKnownTypeAttribute.'. See server logs for more details. The exception stack trace is:

at System.ServiceModel.Dispatcher.SingleBodyParameterMessageFormatter.ValidateOutputType(Type type, Type parameterType, IList`1 knownTypes) at System.ServiceModel.Dispatcher.SingleBodyParameterDataContractMessageFormatter.GetOutputSerializer(Type type) at System.ServiceModel.Dispatcher.SingleBodyParameterMessageFormatter.CreateBodyWriter(Object body) at System.ServiceModel.Dispatcher.SingleBodyParameterMessageFormatter.SerializeReply(MessageVersion messageVersion, Object[] parameters, Object result) at System.ServiceModel.Dispatcher.MultiplexingDispatchMessageFormatter.SerializeReply(MessageVersion messageVersion, Object[] parameters, Object result) at System.ServiceModel.Dispatcher.CompositeDispatchFormatter.SerializeReply(MessageVersion messageVersion, Object[] parameters, Object result) at System.ServiceModel.Dispatcher.DispatchOperationRuntime.SerializeOutputs(MessageRpc& rpc) at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage41(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc& rpc) at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)

Ryan-Scott posted this 17 June 2013

I tried this in a browser:

http://192.168.1.xxx:xxxx/zwave/device/1aba0654-70b8-4c41-bbeb-xxxxxxxxxxxxx?password=xxxxxxx

and received:

Request Error
The server encountered an error processing the request. The exception message is 'Cannot serialize parameter of type 'MLS.HA.DeviceController.Common.Device.ZWave.ZWaveHaDevice' (for operation 'getDevice', contract 'IzWaveSVC') because it is not the exact type 'MLS.HA.DeviceController.Common.Device.HaDevice' in the method signature and is not in the known types collection. In order to serialize the parameter, add the type to the known types collection for the operation using ServiceKnownTypeAttribute.'. See server logs for more details. The exception stack trace is:

at System.ServiceModel.Dispatcher.SingleBodyParameterMessageFormatter.ValidateOutputType(Type type, Type parameterType, IList`1 knownTypes) at System.ServiceModel.Dispatcher.SingleBodyParameterDataContractMessageFormatter.GetOutputSerializer(Type type) at System.ServiceModel.Dispatcher.SingleBodyParameterMessageFormatter.CreateBodyWriter(Object body) at System.ServiceModel.Dispatcher.SingleBodyParameterMessageFormatter.SerializeReply(MessageVersion messageVersion, Object[] parameters, Object result) at System.ServiceModel.Dispatcher.MultiplexingDispatchMessageFormatter.SerializeReply(MessageVersion messageVersion, Object[] parameters, Object result) at System.ServiceModel.Dispatcher.CompositeDispatchFormatter.SerializeReply(MessageVersion messageVersion, Object[] parameters, Object result) at System.ServiceModel.Dispatcher.DispatchOperationRuntime.SerializeOutputs(MessageRpc& rpc) at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage41(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc& rpc) at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)


I'm pretty sure the scene GET method was added in version 3.10 -- 3.7 might be too early to have that one. The error above -- I've seen that before with someone running on Windows XP; the same running on Windows 7 didn't have that error though. Which OS are you on?

Rod posted this 17 June 2013

I'm using win 7 64bit. I'll try a newer version when I get a chance and let you know.

Rod posted this 23 June 2013

3.10 enabled the activateScene class. I'm now stuck on letting another device on the same network load the GET url. I can run the URL on the same computer but not on my iPhone. I'm assuming i'll have to open something up on my InControl PC?

Ryan-Scott posted this 23 June 2013

You will probably need to open up port 1178 in your firewall.

Close