Newbie HTTP Dim command help

Hi,

I have just purchased a Veralite and I am a complete newbie. I have managed to workout the http command to turn my lights on/off and to a defined level.

  1. Is it possible to to send a http command to dim a light from it current level by say 10%?

  2. If not, can I set up a scene that will dim a light from its current state by 10% every time its called by http command?

Option one is what i’m hoping for.

Many thanks

HTTP URL commands to Vera to set a dim level require you to specify the specific SetLoadLevelTarget. Even scenes do not allow you to decrease a certain percentage based on the current level.

To do what you seek, you would need to create a scene with LUA code or use the PLEG plugin, to decrease from present level by a percentage. You could then call that scene or PLEG via an HTTP request.

[quote=“Z-Waver, post:2, topic:179886”]HTTP URL commands to Vera to set a dim level require you to specify the specific SetLoadLevelTarget. Even scenes do not allow you to decrease a certain percentage based on the current level.

To do what you seek, you would need to create a scene with LUA code or use the PLEG plugin, to decrease from present level by a percentage. You could then call that scene or PLEG via an HTTP request.[/quote]

Hi,

Thank you for your reply. It?s encouraging to hear there is a workaround to do this.

If you were I what way would you use? LUA code or the PLEG plugin?

As I said I’m new top Vera so this is a learning curve for me hence I would appreciate your guidance.

Thanks again

Steve

It depends on what you’re trying to do here. Are you trying to set the dimmers from another device, when you use the URL calls.

Or, do you want to manage this dimmer function within Vera?

[quote=“Bulldoglowell, post:4, topic:179886”]It depends on what you’re trying to do here. Are you trying to set the dimmers from another device, when you use the URL calls.

Or, do you want to manage this dimmer function within Vera?[/quote]

Yes I want to make calls from outside Vera but on the same network. Can you confirm the only way to make calls are with http calls or is there a better way?

Thank you for your help.

Steve

For a quick solution, create two scenes named as you like. For example: LightUp10 and LightDown10. Paste the code below into the respective scene’s LUUP tab. Change dID = 99 to the device ID of your dimmer.

LightUp10:

local dID = 99 local curlev = tonumber((luup.variable_get("urn:upnp-org:serviceId:Dimming1","LoadLevelStatus",dID))) local newlev = curlev + 10 if newlev > 100 then newlev = 100 end if newlev ~= curlev then luup.call_action("urn:upnp-org:serviceId:Dimming1","SetLoadLevelTarget",{newLoadlevelTarget=newlev},dID) end

LightDown10:

local dID = 99 local curlev = tonumber((luup.variable_get("urn:upnp-org:serviceId:Dimming1","LoadLevelStatus",dID))) local newlev = curlev - 10 if newlev < 0 then newlev = 0 end if newlev ~= curlev then luup.call_action("urn:upnp-org:serviceId:Dimming1","SetLoadLevelTarget",{newLoadlevelTarget=newlev},dID) end

You can run the scenes with:

http://ip_address:3480/data_request?id=action&serviceId=urn:micasaverde-com:serviceId:HomeAutomationGateway1&action=RunScene&SceneNum=

Replace ip_address with Vera’s IP address and end the command with the required scene number.

@RexBeckett - Awesome! You’re a fountain of LUA code. I hope you get paid for it.

You mean like you get paid for solving the world’s Z-Wave and switch installation problems? :wink:

[quote=“RexBeckett, post:6, topic:179886”]For a quick solution, create two scenes named as you like. For example: LightUp10 and LightDown10. Paste the code below into the respective scene’s LUUP tab. Change dID = 99 to the device ID of your dimmer.

Replace ip_address with Vera’s IP address and end the command with the required scene number.[/quote]

Thank you for your code. It dims the lamp by the requested 10% but when I call the scene from the http request it reply’s with the following error

This page contains the following errors:

[b]error on line 2 at column 28: xmlns:u: ‘Unknown Service’ is not a valid URI
Below is a rendering of the page up to the first error.

OK[/b]

Is this an issue ?

Thanks again

Steve

I am not sure whether you are saying that the http runs the scenes but shows an error or that the scenes only work when run manually. Could you clarify that, please? Also can you post the http commands you are using?

Yes your codes actions the dim command both manually and via a http call when directly typed into Chrome. i.e. -

http://192.168.0.151:3480/data_request?id=action&serviceId=urn:micasaverde-com:serviceId:HomeAutomationGateway1&action=RunScene&SceneNum=4

That happens on Chrome for me too. I’m not sure why but try this instead:

http://192.168.0.151:3480/data_request?id=action&serviceId=urn:micasaverde-com:serviceId:HomeAutomationGateway1&action=RunScene&SceneNum=4&output_format=json

[quote=“RexBeckett, post:12, topic:179886”]That happens on Chrome for me too. I’m not sure why but try this instead:

http://192.168.0.151:3480/data_request?id=action&serviceId=urn:micasaverde-com:serviceId:HomeAutomationGateway1&action=RunScene&SceneNum=4&output_format=json

Thanks, yes that works without error. Much appreciated.

Steve

I know I’m probably pushing my luck now, but is there a way to parse the node number from within the http request?

If so then I could setup one scene to control various nodes from my main HA controller.

Steve

I’m not aware of any way to parse additional fields from the simple http requests. See Luup Requests for what is currently supported.

Thanks Rex I thought that was going to be the case. I will have a look at the link you provided. I think I’m going to need to look into learning Luup code!

Last question; forgive me if it?s a stupid question… Is there any other way to remotely control Veralite other than http requests and access through MiOS servers? Maybe Tcp/IP direct to a socket?

Steve

The only way to communicate with Vera remotely is via the http api. There is no tcp / socket communication.

  • Garrett

[quote=“garrettwp, post:17, topic:179886”]The only way to communicate with Vera remotely is via the http api. There is no tcp / socket communication.

  • Garrett[/quote]

Hi Garrett,

Thank you for clarifying this for me.

Steve