Hi guys!
I’m trying to control my air conditioner unit (a Hitachi DC Inverter) using a Global Cache Itach as an interface (a gateway).
I already controlled this equipment using Irule, so I’ve a bunch of ir codes, at least for the main functions.
So, I coded a Smart App (Service) that acts like a gateway, which I can set the IP adress and port that GC Itach is connected. This smartapp creates a child device (Device Handler), where I effectivelly coded all the functions I pretend to control in my AC. The parent app has a method which contains the sendhubcommand needed to send the commands through LAN to Itach.
Bellow:
def sendir(command) {
log.debug “Command sent to Gateway"
sendHubCommand(new physicalgraph.device.HubAction(”""${command}\r\n""", physicalgraph.device.Protocol.LAN, state.dni))
return null
}
In Device Handler I have a method that creates the string command (“sendir command”), based on some variables (fan speed, temperature, ac mode…) , such like this:
def command = "sendir,1:3,1,38100,1,1,127,64,16,48,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,48,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,48,16,16,16,48,16,48,16,48,16,48,16,48,16,48,16,16,16,48,16,48,16,48,16,48,16,48,16,48,16,48,16,48,16,48,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,48,16,48,16,16,16,16,16,48,16,48,16,48,16,48,16,16,16,16,16,48,16,48,16,16,16,16,16,16,16,48,16,16,16,16,16,48,16,16,16,16,16,48,16,48,16,16,16,48,16,48,16,16,16,48,16,48,16,16,16,${state.blade[0]},16,${state.blade[1]},16,16,16,16,16,${state.hib_act[0]},16,${state.hib_act[1]},16,${state.blade[2]},16,${state.blade[3]},16,${state.blade_not[0]},16,${state.blade_not[1]},16,48,16,48,16,${state.hib_act_not[0]},16,${state.hib_act_not[1]},16,${state.blade_not[2]},16,${state.blade_not[3]},16,16,16,16,16,${state.temperature[0]},16,${state.temperature[1]},16,${state.temperature[2]},16,${state.temperature[3]},16,${state.temperature[4]},16,16,16,48,16,48,16,${state.temperature_not[0]},16,${state.temperature_not[1]},16,${state.temperature_not[2]},16,${state.temperature_not[3]},16,${state.temperature_not[4]},16,48,16,16,16,16,16,${state.hib_time[0]},16,${state.hib_time[1]},16,${state.hib_time[2]},16,${state.hib_time[3]},16,${state.hib_time[4]},16,${state.hib_time[5]},16,48,16,48,16,${state.hib_time_not[0]},16,${state.hib_time_not[1]},16,${state.hib_time_not[2]},16,${state.hib_time_not[3]},16,${state.hib_time_not[4]},16,${state.hib_time_not[5]},16,16,16,16,16,16,16,16,16,${state.off_timer[0]},16,${state.off_timer[1]},16,${state.off_timer[2]},16,${state.off_timer[3]},16,48,16,48,16,48,16,48,16,${state.off_timer_not[0]},16,${state.off_timer_not[1]},16,${state.off_timer_not[2]},16,${state.off_timer_not[3]},16,${state.off_timer[4]},16,${state.off_timer[5]},16,${state.off_timer[6]},16,${state.off_timer[7]},16,${state.off_timer[8]},16,${state.off_timer[9]},16,${state.off_timer[10]},16,${state.off_timer[11]},16,${state.off_timer_not[4]},16,${state.off_timer_not[5]},16,${state.off_timer_not[6]},16,${state.off_timer_not[7]},16,${state.off_timer_not[8]},16,${state.off_timer_not[9]},16,${state.off_timer_not[10]},16,${state.off_timer_not[11]},16,${state.on_timer[0]},16,${state.on_timer[1]},16,${state.on_timer[2]},16,${state.on_timer[3]},16,${state.on_timer[4]},16,${state.on_timer[5]},16,${state.on_timer[6]},16,${state.on_timer[7]},16,${state.on_timer_not[0]},16,${state.on_timer_not[1]},16,${state.on_timer_not[2]},16,${state.on_timer_not[3]},16,${state.on_timer_not[4]},16,${state.on_timer_not[5]},16,${state.on_timer_not[6]},16,${state.on_timer_not[7]},16,${state.on_timer[8]},16, ${state.on_timer[9]},16,${state.on_timer[10]},16,${state.on_timer[11]},16,${state.off_timer_act},16,${state.on_timer_act},16,16,16,16,16,${state.on_timer_not[8]},16,${state.on_timer_not[9]},16,${state.on_timer_not[10]},16,${state.on_timer_not[11]},16,${state.off_timer_act_not},16,${state.on_timer_act_not},16,48,16,48,16,${state.mode[0]},16,${state.mode[1]},16,${state.mode[2]},16,${state.mode[3]},16,${state.fan[0]},16,${state.fan[1]},16,${state.fan[2]},16,16,16,${state.mode_not[0]},16,${state.mode_not[1]},16,${state.mode_not[2]},16,${state.mode_not[3]},16,${state.fan_not[0]},16,${state.fan_not[1]},16,${state.fan_not[2]},16,48,16,48,16,16,16,16,16,16,16,${state.power},16,16,16,48,16,48,16,16,16,48,16,48,16,48,16,${state.power_not},16,48,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,48,16,48,16,48,16,48,16,48,16,48,16,48,16,48,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,48,16,48,16,48,16,48,16,48,16,48,16,48,16,48,16,244"
This is the message that need to be sent to GC Itach. Then, my plan is to pass this variable (command), that I construct in device handler, to the parent app calling:
parent.sendir(command)
(Obviously, all states variables included on the string (state.on_timer, etc), was previously declared,) This way, nothing happens.
But, if I send a “plain” sendir string, ie, without the state variables just explicit numbers, the command is sent and recognized by AC.
So, I’m stuck trying to find a way to pass this big string variable to my parent app. For me, it seems that is the problem.
Is there any special way to pass this variable to the parent app?
Thanks for help!
Fabio