Sending state changes

what I am trying to accomplish is to have the vera send device state changes via HTTP

i would like something that would send the device name, device id, room name, state change, dimming level(if its a dimmer), device type

and any other pertinent information.

this is what i have so far and it works for the switches. but ony a device id and state

and it also doesn’t work in the respect that if i change a dimmer to say 30% it will send a 1 for the fact it just got turned on and the 30 afterwards.

now I know i can code around this on the vack end because i have it sending the service type.

but i want something that can send all the different types of device services without it double sending as mentioned above.

i put this code into the lua startup i need greater information and i am brain dead when it comes to lua

    -- Set up all variable-watches for delayed start
    function setWatch()   
       luup.log("Starting Variable Watches")
       luup.variable_watch("statusChangeSwitchPower","urn:upnp-org:serviceId:SwitchPower1","Status",nil)
       luup.variable_watch("statusChangeSwitchPower","urn:upnp-org:serviceId:Dimming1","LoadLevelStatus",nil)

    end
    -- Wait for 60 seconds after restart then run setWatch
    luup.call_delay("setWatch",60)

    -- Send an event to EventGhost via the web server plugin
    function sendToEG(post)
       luup.log("Send Event to EventGhost")
       local http = require("socket.http")
       http.TIMEOUT=4
       result, statuscode = socket.http.request("http://192.168.***.***:****/?" .. post)
       luup.log("Status: " .. statuscode)
    end

    function statusChangeSwitchPower(device, service, variable, lastvalue, newvalue)
       luup.log("Switch Power Status Change")
       luup.log("Device: " .. device)
       luup.log("Service: " .. service)
       luup.log("Variable: " .. variable)
       luup.log("Last Value: " .. lastvalue)
       luup.log("New Value: " .. newvalue)
       strPost = "{'device_id':'" .. device .. "','service_name':'" .. service .. "','variable_name':'" .. variable .. "','old_state':'" .. lastvalue .. "','new_state':'" .. newvalue .. "'}"
       luup.log(strPost)
       sendToEG(strPost)
    end

thanks

K