The Vera Community forums have moved!

General => AV Control => Topic started by: rostmo on March 01, 2017, 01:34:03 pm

Title: Here are some Tips for iTach, IR and UI7
Post by: rostmo on March 01, 2017, 01:34:03 pm
After trying for a long time to add a device to control an IR command, it suddenly dawned on me that that I actually don't want devices at such tasks. I don't want to have a device where I can lower the screen etc. Because Vera is not an extra remote, it's a "scene tool". The screen should be lowered based solely on a scene. Watching Netflix is a scene where many things happen, not a collection of devices. So here are my tips.

Tip 1.
Don't use devices for IR commands. Instead:
Now you can send IR commands to the AV system using LUA in scenes. There are no need for any Vera devices. I put the LUA code into a scene like this example:

require "ircommand"
ircommand.benqon()
ircommand.screendown()
ircommand.stream()


This will lower the Screen, turn on the projector and turn on the AVR and activate the HDMI where Chromecast is connected. (Yes, I now use this method instead of an app for the AVR.)
I also have other devices configured normally in the same scene like turning off the lights etc.

About step 2:
You will need to adjust the IP address in the file. Only IP though, the port is correct. Look for this line:

c = assert(socket.connect("192.168.1.97", 4998))

The need for IR commands to end with ",\r" is handled in the code. Do not apply this at the end of your IR codes.
Add your IR codes based on your need and name the functions thereafter. The module name and the function name builds the command you will use in your scene.
The file I attached have some comments which might assist.

Tip 2.
When using iLearn to fetch IRs from the remote, set the Format to "GC Compressed" when learning. This will solve the problems reading long IR commands. E.g. I was not able to fetch any working code from my Onkyo AVR remote before using the compressed format. After iTach has read it, set the Format back to "Global Cache" before you press Edit. Then it will be copied correctly into the "Edit view" field, and is now ready to be copied to the file mentioned in Tip 1.

Tip 3.
Try the commands in "Apps | Develop apps | Test luup code (LUA)" before applying them to scenes. Remember to start with: require "ircommand".

If anyone see any issue in the LUA file, or suggestions to do it better please give feedback.

Hope this can be of help. (It would have been for me when first starting on the "iTach, IR and UI7" path  ;) )

Thanks to wilme2 for the code I reused here. See http://forum.micasaverde.com/index.php/topic,32420.msg299775.html#msg299775 (http://forum.micasaverde.com/index.php/topic,32420.msg299775.html#msg299775)

Other resources used was:
https://www.globalcache.com/files/docs/API-iTach.pdf (https://www.globalcache.com/files/docs/API-iTach.pdf)
http://lua-users.org/wiki/ModulesTutorial (http://lua-users.org/wiki/ModulesTutorial)
Title: Re: Here are some Tips for iTach, IR and UI7
Post by: Thomas1975 on March 12, 2017, 04:47:55 pm
Worked really well and an elegant simple approach to Ir control with the iTach. Had spent 6 hours trying to add my devices and given up  :'(....thank you for sharing
Title: Re: Here are some Tips for iTach, IR and UI7
Post by: FeuerMeister on April 09, 2017, 09:53:29 am
Works Great! months waiting to use my itach vith Vera. Thank You!
Title: Re: Here are some Tips for iTach, IR and UI7
Post by: cormaza on April 11, 2017, 11:01:51 am
rostmo:
thanks very much for sharing this approach that will allow me to control air conditioners by vera

after review and implement all the steps for implement your solution, i stopped in the step 2:
"Create a text file called "ircommand.lua" (see attachement), and saved it under "/usr/lib/lua".

i've the "ircommand.lua" whit the IR codes for my equipement created and stored in my windows pc, but i can't figurite out how transfer it to /usr/lib/lua dir in vera
i must reocnginze that i don?t have any expirience and knowledge about unix and SSH

i need step by step instructions to transfer de file from my pc to the vera system

could yo please help me?

Best Regards
Cristian
Title: Re: Here are some Tips for iTach, IR and UI7
Post by: rostmo on April 15, 2017, 12:47:53 pm
@cormaza:

Step 1:
You will need to connect to your Vera with a file browser. If you are using Windows I recommend you download WinSCP. Download from here: https://winscp.net/eng/download.php

Step 2:
After installation of WinSCP you should be able to log into Vera by using it's IP.
Username is: root
password is noted under your Vera as the WIFI password


After you press login. You will then see all the files in Vera in the right pane.

Step 3:
You should now be able to navigate to the following path in the Vera File system:

/usr/lib/lua

Step 4:
In WinSCP locate the new lua file from your local drive. Navigate in the left pane to the correct path where the fie is located.

Than drag it over to the right pane, so it is copied to Vera. IMPORTANT: Make sure you are on the correct location in Vera, that is /usr/lib/lua

That should be it. Remember Tip 1, #3 in the original post. That is: luup.realod().

Please inform if I can assist further.
Title: Re: Here are some Tips for iTach, IR and UI7
Post by: cormaza on April 17, 2017, 01:39:47 am

@cormaza:

Step 1:
You will need to connect to your Vera with a file browser. If you are using Windows I recommend you download WinSCP. Download from here: https://winscp.net/eng/download.php

Step 2:
After installation of WinSCP you should be able to log into Vera by using it's IP.
Username is: root
password is noted under your Vera as the WIFI password


After you press login. You will then see all the files in Vera in the right pane.

Step 3:
You should now be able to navigate to the following path in the Vera File system:

/usr/lib/lua

Step 4:
In WinSCP locate the new lua file from your local drive. Navigate in the left pane to the correct path where the fie is located.

Than drag it over to the right pane, so it is copied to Vera. IMPORTANT: Make sure you are on the correct location in Vera, that is /usr/lib/lua

That should be it. Remember Tip 1, #3 in the original post. That is: luup.realod().

Please inform if I can assist further.

dear rostmo:
i folowed the detailed step by step instructions for transfet the file to vera. result: i'm controlling my ac conditioners (2) from scenes in vera :)

thank you very much for your help!!!

Best regards
Cristian
Title: Re: Here are some Tips for iTach, IR and UI7
Post by: Don Phillips on April 17, 2017, 07:16:24 pm
+1 to rostmo for the excellent instructions to log into my Vera (and NAS). It may come in handy one day.
Title: Re: Here are some Tips for iTach, IR and UI7
Post by: parkerc on April 24, 2017, 02:17:18 pm
Hi @rostmo

Thanks for sharing this.

Seeing as you are using the GC100, have you got any examples that uses the serial port / RS232 connections ?

A 'sendser' function to add to your 'sendir' :)

Title: Re: Here are some Tips for iTach, IR and UI7
Post by: rostmo on May 02, 2017, 08:48:02 am
@parkerc

Hi.

Sorry for delayed reply.

No, I haven't done any other testing with this. Though I have had a private mail dialog with another user here (based on this thread) who used GC Flex. I can confirm that worked fine.

I think it ill work though, just apply the correct commands for RS232. The LUA file only opens IP connection to an IP host and submit a command which the host can understand. Rather simple. You might need to remove the "/r" which is added to the lines which is needed for IR (I'm not sure if it's needed for RS232). Test with or without it to see which work. Remember to execute luup.reaload() when updating the LUA file.

I'm planning to do the same with my AVR. That means not using IR but communicate directly with IP to the AVR. I just haven't had the time yet. IR is not a good solution for controlling volume, as it submits it by steps up or down. I want to send a certain volume percent (e.g. 65%) in one command.  I will update when I have tried it.

Br
Rostmo.
Title: Re: Here are some Tips for iTach, IR and UI7
Post by: jjwork on May 19, 2017, 05:18:22 am
Thank You Rostmo !!

You are a life saver !!

I have managed to get multiple Flex units working on IR.

Now for the holy grail of Serial ....

I am anxiously waiting to see if anyone has had any success.

I think it is a different beast as the serial commands are different to the IR ....
Title: Re: Here are some Tips for iTach, IR and UI7
Post by: rostmo on May 22, 2017, 02:19:01 pm
Thank You Rostmo !!

You are a life saver !!

I have managed to get multiple Flex units working on IR.

Now for the holy grail of Serial ....

I am anxiously waiting to see if anyone has had any success.

I think it is a different beast as the serial commands are different to the IR ....
Can you show me (post here) a command that you know is correct for the serial? I can see if I can add it to the file.

Sent fra min E6653 via Tapatalk

Title: Re: Here are some Tips for iTach, IR and UI7
Post by: shallowearth on May 22, 2017, 04:59:02 pm
Here is a code example of how to you talk to a ITach Flex is that is configured for Serial comms
This is to talk to a Monoprice 6-zone audio amp

Code: [Select]
local socket = require("socket")
host = "1.0.0.5"
c = assert(socket.connect(host, 4999))
c:settimeout(5)
 
local sres, serr = c:send("<10PR01\r")
local data, rerr = c:receive(8)
luup.sleep(1000)
c:close()
Some things to know about the Serial.
They don't all require a return code at the end. Monoprice specifically asks for the "\r" return code at the end.
You do actually have to listen for a receive, the iTach won't take another send command if it gets a response and you don't call receive. (monoprice always sends back a 8 char response which is why I use 8.  Not sure if the buffer and response actually have to match though).
I also noticed you can close the connection too early and Monoprice will just stop processing the commands you sent.  So I put a sleep in before the closing of the socket particularly if you are sending a bunch of commands (I break them in to no more than 6 commands in a row than sleep for a second, etc).  Definitely sleep before you close the socket if sending more than 4 or 5 commands.
Title: Re: Here are some Tips for iTach, IR and UI7
Post by: sebpoterie on August 03, 2017, 06:23:07 am
Thank You Rostmo !!


I have managed to get multiple Flex units working on IR.


Hello gentlemen,

How did you manage to use several units ?
The IP address of the unit is adjusted in the file "ircommand.lua".
Help appreciate
Regards.
Title: Re: Here are some Tips for iTach, IR and UI7
Post by: rostmo on August 29, 2017, 02:12:09 pm

Hello gentlemen,

How did you manage to use several units ?
The IP address of the unit is adjusted in the file "ircommand.lua".
Help appreciate
Regards.

You can have two units by either:
1: Create another lua-file. E.g. ir2command.lua which have another IP set. This might be the easiest if you're not familliare with programming.

or

2: Add a parameter to the function, and use an IF-ELSE clause to set the IP into a variable at the top of the ircommand.lua file.

Hope this helps.
Title: Re: Here are some Tips for iTach, IR and UI7
Post by: sebpoterie on August 29, 2017, 11:06:32 pm
Many thanks.
Title: Re: Here are some Tips for iTach, IR and UI7
Post by: parkerc on September 08, 2017, 04:02:29 am
I also noticed you can close the connection too early and Monoprice will just stop processing the commands you sent.  So I put a sleep in before the closing of the socket particularly if you are sending a bunch of commands (I break them in to no more than 6 commands in a row than sleep for a second, etc).  Definitely sleep before you close the socket if sending more than 4 or 5 commands.

Hi @shallowearth

just an FYI - I understand from reading other threads that luup.sleep is not the best thing to use as it can cause restarts.
Title: Re: Here are some Tips for iTach, IR and UI7
Post by: shallowearth on September 08, 2017, 11:53:18 am
I haven't seen any restarts using that code on my Vera edge.  It has been very stable.  But The sleeps are very short and could probably be reduced even further, if you see instability.  General the sleep commons is s problem of you are talking long sleeps.  This is just a second pause to allow the itach to catchup.
Title: Re: Here are some Tips for iTach, IR and UI7
Post by: JCH on September 27, 2017, 01:27:34 am
Hi
I have tried controlling an iTach as descibed in this post.
I have modified the ircommand.lua file and have uploaded it to my vera... but when i try a command i get "Failed to test code" error.
Although if i use the code From wilme2 it works!!
Any ideas?
Title: Re: Here are some Tips for iTach, IR and UI7
Post by: PrincessCleavage on September 30, 2017, 11:18:50 pm
Hi
I have tried controlling an iTach as descibed in this post.
I have modified the ircommand.lua file and have uploaded it to my vera... but when i try a command i get "Failed to test code" error.
Although if i use the code From wilme2 it works!!
Any ideas?
I had similar issues and one I started again using the provided Scipt as a template again and working through step by step it worked. I guess I am suggesting to check your code logic
Title: Re: Here are some Tips for iTach, IR and UI7
Post by: PrincessCleavage on September 30, 2017, 11:24:38 pm
Question for the script experts. Is it possible to add to the lua script that first time the script is executed it will send xyz IR command and second time it is executed it will send xyz IR command ( I assume a count of 1st 2nd will be required to be held somewhere).
The purpose of this will be when I assign the scene to a physical button I can turn on all AV units and with the second press of the same physical button (second time the scene is executed) turn off all the required AV units (as one of the units has a different on/off IR command)
Title: Re: Here are some Tips for iTach, IR and UI7
Post by: rostmo on October 01, 2017, 04:03:40 am
@JCH:
I suspect an error in the LUA-file. You might post it her (as an attchement) so it can be examined, or you can PM it to me and I'll have a look.   


@PrincessCleavage:
If I understand your need correctly I suggest you do not apply that logic into the LUA-file, but solve it before the LUA call. Two approaches:

1. Add an IF-ELSE clause in the Scene Edit (where you call the ircommand's). Then you can send the commands needed from the LUA file based on what's inside the clause. You will need a virtual switch which tracks the status (ON/OFF). The IF-ELSE clause reads from this virtual switch. See http://wiki.micasaverde.com/index.php/Luup_Scenes_Events.

2. This might be the simplest approach. Use the Program Logic Event plugin. As soon as you start using and understand this plugin you will see how to apply the solution to your problem.
Title: Re: Here are some Tips for iTach, IR and UI7
Post by: PrincessCleavage on October 01, 2017, 06:46:33 am
@JCH:
I suspect an error in the LUA-file. You might post it her (as an attchement) so it can be examined, or you can PM it to me and I'll have a look.   


@PrincessCleavage:
If I understand your need correctly I suggest you do not apply that logic into the LUA-file, but solve it before the LUA call. Two approaches:

1. Add an IF-ELSE clause in the Scene Edit (where you call the ircommand's). Then you can send the commands needed from the LUA file based on what's inside the clause. You will need a virtual switch which tracks the status (ON/OFF). The IF-ELSE clause reads from this virtual switch. See http://wiki.micasaverde.com/index.php/Luup_Scenes_Events.

2. This might be the simplest approach. Use the Program Logic Event plugin. As soon as you start using and understand this plugin you will see how to apply the solution to your problem.
Thanks for the tips rosmoto, can I have the virtual switch change each time I execute the scene ( as the avr has not network link to check on or off status).
So far I have created several scenes for on or off of my RF devices and they all work as expected. Would it be possible to assist with the line of code that I should add to change the virtual switch and execute scene 1 or scene 2 (on or off for the AVr amp) please
Title: Re: Here are some Tips for iTach, IR and UI7
Post by: rostmo on October 01, 2017, 09:11:33 am
OK, I created a script which monitor the "status" of my BENQ projector. (Because the projector will turn on if I by error try to turn it off when its already off).

You should be able to use it for your purpose. The virtual switch (plugin) has ID 100 in my installation. You will need to find the unique ID in your setup and adjust the line "LOCAL dID = 100". The rest should work if you use the same addon as in my setup.

This code will NOT try to turn off the BENQ if it's not ON. IF the projector is ON it will turn off and set the virtual switch to off.

require "ircommand"
local dID = 100
local sID = "urn:upnp-org:serviceId:VSwitch1"
local TEMP= luup.variable_get(sID, "Status", dID)
if (TEMP == "1") then
     ircommand.benqoff()
     luup.call_action(sID, "SetTarget", {newTargetValue = "0"}, dID)
end
ircommand.screenup()


This is another scene for turning everything on:

require "ircommand"
local dID = 100
local sID = "urn:upnp-org:serviceId:VSwitch1"
luup.call_action(sID, "SetTarget", {newTargetValue = "1"}, dID)
ircommand.screendown()
ircommand.benqon()
ircommand.stream()


I use two scenes in my case above, but you can combine the two actions into one scene so you can use the same physical button trigger the same scene and send different ircommands based on status like this:

require "ircommand"
local dID = 100
local sID = "urn:upnp-org:serviceId:VSwitch1"
local TEMP= luup.variable_get(sID, "Status", dID)
if (TEMP == "1") then
     ircommand.benqoff()
     luup.call_action(sID, "SetTarget", {newTargetValue = "0"}, dID)
else
    ircommand.benqon()
    luup.call_action(sID, "SetTarget", {newTargetValue = "1"}, dID)
end


Title: Re: Here are some Tips for iTach, IR and UI7
Post by: PrincessCleavage on October 01, 2017, 09:23:53 am
OK, I created a script which monitor the "status" of my BENQ projector. (Because the projector will turn on if I by error try to turn it off when its already off).

You should be able to use it for your purpose. The virtual switch (plugin) has ID 100 in my installation. You will need to find the unique ID in your setup and adjust the line "LOCAL dID = 100". The rest should work if you use the same addon as in my setup.

This code will NOT try to turn off the BENQ if it's not ON. IF the projector is ON it will turn off and set the virtual switch to off.

require "ircommand"
local dID = 100
local sID = "urn:upnp-org:serviceId:VSwitch1"
local TEMP= luup.variable_get(sID, "Status", dID)
if (TEMP == "1") then
     ircommand.benqoff()
     luup.call_action(sID, "SetTarget", {newTargetValue = "0"}, dID)
end
ircommand.screenup()


This is another scene for turning everything on:

require "ircommand"
local dID = 100
local sID = "urn:upnp-org:serviceId:VSwitch1"
luup.call_action(sID, "SetTarget", {newTargetValue = "1"}, dID)
ircommand.screendown()
ircommand.benqon()
ircommand.stream()


I use two scenes in my case above, but you can combine the two actions into one scene so you can use the same physical button trigger the same scene and send different ircommands based on status like this:

require "ircommand"
local dID = 100
local sID = "urn:upnp-org:serviceId:VSwitch1"
local TEMP= luup.variable_get(sID, "Status", dID)
if (TEMP == "1") then
     ircommand.benqoff()
     luup.call_action(sID, "SetTarget", {newTargetValue = "0"}, dID)
else
    ircommand.benqon()
    luup.call_action(sID, "SetTarget", {newTargetValue = "1"}, dID)
end

Thanks I will give it a try tomorrow morning and report back.
Title: Re: Here are some Tips for iTach, IR and UI7
Post by: PrincessCleavage on October 01, 2017, 09:19:19 pm
OK, I created a script which monitor the "status" of my BENQ projector. (Because the projector will turn on if I by error try to turn it off when its already off).

You should be able to use it for your purpose. The virtual switch (plugin) has ID 100 in my installation. You will need to find the unique ID in your setup and adjust the line "LOCAL dID = 100". The rest should work if you use the same addon as in my setup.

This code will NOT try to turn off the BENQ if it's not ON. IF the projector is ON it will turn off and set the virtual switch to off.

require "ircommand"
local dID = 100
local sID = "urn:upnp-org:serviceId:VSwitch1"
local TEMP= luup.variable_get(sID, "Status", dID)
if (TEMP == "1") then
     ircommand.benqoff()
     luup.call_action(sID, "SetTarget", {newTargetValue = "0"}, dID)
end
ircommand.screenup()


This is another scene for turning everything on:

require "ircommand"
local dID = 100
local sID = "urn:upnp-org:serviceId:VSwitch1"
luup.call_action(sID, "SetTarget", {newTargetValue = "1"}, dID)
ircommand.screendown()
ircommand.benqon()
ircommand.stream()


I use two scenes in my case above, but you can combine the two actions into one scene so you can use the same physical button trigger the same scene and send different ircommands based on status like this:

require "ircommand"
local dID = 100
local sID = "urn:upnp-org:serviceId:VSwitch1"
local TEMP= luup.variable_get(sID, "Status", dID)
if (TEMP == "1") then
     ircommand.benqoff()
     luup.call_action(sID, "SetTarget", {newTargetValue = "0"}, dID)
else
    ircommand.benqon()
    luup.call_action(sID, "SetTarget", {newTargetValue = "1"}, dID)
end

Simple but Elegant!
Works great!
Thanks a million Rostmo
I used the below code with virtual switch app (Id 133) and substituted my IR calls for Rostmo IR calls:
require "ircommand"
local dID = 100
local sID = "urn:upnp-org:serviceId:VSwitch1"
local TEMP= luup.variable_get(sID, "Status", dID)
if (TEMP == "1") then
     ircommand.benqoff()
     luup.call_action(sID, "SetTarget", {newTargetValue = "0"}, dID)
else
    ircommand.benqon()
    luup.call_action(sID, "SetTarget", {newTargetValue = "1"}, dID)
end
Title: Re: Here are some Tips for iTach, IR and UI7
Post by: PrincessCleavage on October 01, 2017, 11:26:25 pm
OK, I created a script which monitor the "status" of my BENQ projector. (Because the projector will turn on if I by error try to turn it off when its already off).

You should be able to use it for your purpose. The virtual switch (plugin) has ID 100 in my installation. You will need to find the unique ID in your setup and adjust the line "LOCAL dID = 100". The rest should work if you use the same addon as in my setup.

This code will NOT try to turn off the BENQ if it's not ON. IF the projector is ON it will turn off and set the virtual switch to off.

require "ircommand"
local dID = 100
local sID = "urn:upnp-org:serviceId:VSwitch1"
local TEMP= luup.variable_get(sID, "Status", dID)
if (TEMP == "1") then
     ircommand.benqoff()
     luup.call_action(sID, "SetTarget", {newTargetValue = "0"}, dID)
end
ircommand.screenup()


This is another scene for turning everything on:

require "ircommand"
local dID = 100
local sID = "urn:upnp-org:serviceId:VSwitch1"
luup.call_action(sID, "SetTarget", {newTargetValue = "1"}, dID)
ircommand.screendown()
ircommand.benqon()
ircommand.stream()


I use two scenes in my case above, but you can combine the two actions into one scene so you can use the same physical button trigger the same scene and send different ircommands based on status like this:

require "ircommand"
local dID = 100
local sID = "urn:upnp-org:serviceId:VSwitch1"
local TEMP= luup.variable_get(sID, "Status", dID)
if (TEMP == "1") then
     ircommand.benqoff()
     luup.call_action(sID, "SetTarget", {newTargetValue = "0"}, dID)
else
    ircommand.benqon()
    luup.call_action(sID, "SetTarget", {newTargetValue = "1"}, dID)
end


How would I join a call to http (to sleep my media PC) into code? I already have a WOL/Ping switch setup for the PC to monitor if it is ON or OFF, if the WOL/Ping sensor is ON then would need to call:
http://I.P address of PC:Port/suspend
If the WOL/Ping sensor is OFF then it would need to Turn ON WOL/Ping App (which would send a WOL call to the device)
       
Title: Re: Here are some Tips for iTach, IR and UI7
Post by: rostmo on October 05, 2017, 01:33:04 pm
I doesn't have anything to test this on in my setup, so this is only a guide to point you in a direction.

See this post http://forum.micasaverde.com/index.php?topic=11745.0

And this for syntax on  the wget function.
http://wiki.micasaverde.com/index.php/Luup_Lua_extensions#Module:_luup.inet

Hope this helps.


Sent fra min E6653 via Tapatalk
Title: Re: Here are some Tips for iTach, IR and UI7
Post by: brucehvn on October 29, 2017, 07:44:26 am
Wow, this is exactly what I was looking for.  I just need to control a few devices, mainly turning off and on via a scene.  Seems the wife never turns off the TV, AV receiver, and Sat box when she goes to bed.  It's just one button on the remote, but I guess that's too much work for her  ;D

If anyone needs codes for the GlobalCache for your devices, check out http://irdb.globalcache.com (http://irdb.globalcache.com).  They have complete codesets for many devices already in GC format, so you don't have to use the iLearn app.
Title: Here are some Tips for iTach, IR and UI7
Post by: PrincessCleavage on November 28, 2017, 08:00:08 pm
I have had this working for sometime and something occurred where now I get the attached error when attempting to call my usual luup code IR command from apps/develop apps/test luup code. I am calling the following:
require "ircommand"
ircommand.airconcool()
And I get the below error
(https://uploads.tapatalk-cdn.com/20171129/d2b307b893c93c4a9efae5da4b6e86fc.jpg)
Not sure how to troubleshoot this?
Title: Re: Here are some Tips for iTach, IR and UI7
Post by: rostmo on November 29, 2017, 01:46:01 am
Let's try some simple things first.

Try this first (from step 3):
luup.reload()

If that doesn't help confirm the Lua file is still in its location and is the correct version.

Also try a reboot on Vera.
Title: Here are some Tips for iTach, IR and UI7
Post by: PrincessCleavage on November 29, 2017, 02:21:31 am
Let's try some simple things first.

Try this first (from step 3):
luup.reload()

If that doesn't help confirm the Lua file is still in its location and is the correct version.

Also try a reboot on Vera.
I have already attempted several restarts and luup engine reload and also replacing/creating a simplified ircommand.lup file on the vera unit. I have my IR commands working again and I hope the system is now stable. In case this may help someone else below is what I believe ( but mostly luck ) that got my system working again:
1. Enable notifications Users & Account Info → Notification Settings → and check; ?Notification Header?, then Update Notification Settings
2. I then notice device 171 was stalling the Luup engine to load successfully (which I think Vera not so helpful support may of added)
3. Then ran the below code to list all active devices
local file = io.open("/www/devlist.txt", "w")
file:write("[DeviceNo / id] device names on " .. os.date() .. "\n")
 
for deviceNo,d in pairs(luup.devices) do
if d.id ~= "" then
file:write(string.format('[%03d / %s] %s \n', deviceNo, d.id, d.description))
end
end
 
file:close()
View your device list at - http://vera i.p/devlist.txt
4. I then compared the output of the above list to device listed under, create new scene goto advanced editor add new task and compare from the drop down selectable device list. Note any device ID that look safe to delete
5. Delete safe list made from step 4 using below code
http://vera i.p:3480/data_request?id=device&action=delete&device=deviceID
Then restarted the unit and tested IR codes which were working as expected. I then added all my IR scenes back as per normal operations.

Thanks for your time to make suggestions!
Title: Re: Here are some Tips for iTach, IR and UI7
Post by: rock on December 19, 2017, 11:38:07 am
OK, first off, apologies if I hijacked this discussion, but this appears to be the most current thread I could find that is germane to what I'd like to accomplish.

I've got a Vera Lite running version 1.7.987 of the firmware.
I'm trying to get it to talk to my GC-100 so I can send RS232 commands. End goal is control of my Lutron Radio RA (not RA 2) system through the RS232 port on the Chronos System Bridge (I've got two, hence the two ports on the GC-100).
I'm pretty well versed with RS232 and IR communication as I have a slew of Global Cache devices running my entertainment systems via iRule.

From what I've read the GC-100 Plugin and Lutron Plugins (there are two) are a time sink with no joy at the end and indeed I can find almost no doc on these and my efforts to get any of them to work were unsuccessful.

I have no problem coding up a text file and dumping it on the Vera, in fact I'd prefer to do it that way.

Is that the way to go. Are there any example files out there that have a GC-100 (both ports) working with a Vera Lite? How to I connect to the Vera via terminal, ssh? telnet? How do I push files to the Vera, scp? Where do I put them, is there a standard Posix type directory structure? How do I then get the code to run? Are there debugging tools?
Title: Re: Here are some Tips for iTach, IR and UI7
Post by: rock on December 20, 2017, 09:41:38 am
After much digging I believe I've answered most of my own questions.

If I were to code up functions in a .lua file (which seems pretty straight forward), then drop the file in the /usr/lib/lua directory on the Vera, how to I associate the functions with the various aspects (ON / OFF for example) of a gui device in the devices tab. Or can I only associate those functions with scenes?
Title: Here are some Tips for iTach, IR and UI7
Post by: PrincessCleavage on December 20, 2017, 02:54:34 pm
After much digging I believe I've answered most of my own questions.

If I were to code up functions in a .lua file (which seems pretty straight forward), then drop the file in the /usr/lib/lua directory on the Vera, how to I associate the functions with the various aspects (ON / OFF for example) of a gui device in the devices tab. Or can I only associate those functions with scenes?
I have an air conditioner unit that has one on/off button (same ir code for on off) in the lua file that I have uploaded to Vera the air conditioner ir line is ?airconcool? so I the created a scene called Aircon On/off and under advance section add the below code to ?also execute the following lup code? and set the triggers.

require "ircommand"
ircommand.airconcool()

Information is scattered but I believe there is an attachment at the start of one of the threads where you can use the attached files as a template to upload to Vera, also be sure to test your code in develop apps section as I have observed bad calls can introduce unpredictable delays into your system.
I hope this is of some help
Title: Re: Here are some Tips for iTach, IR and UI7
Post by: avigo2000 on May 12, 2018, 08:52:47 am
I am not seeing the attachment here.. Any help with posting it, or pointing me in the right direction. Thanks
Title: Re: Here are some Tips for iTach, IR and UI7
Post by: Dacron on July 03, 2018, 12:46:42 pm
I just can't access vera to place the file, I've used a number of programs and have used root, IP, wifi password from the bottom of the unit and port 22 but I just can't sign in to place the file.

Please help !

Thanks
Title: Re: Here are some Tips for iTach, IR and UI7
Post by: neverathome on July 09, 2018, 01:29:46 am
Does any one know a code to control the relays on the GC100?
Title: Re: Here are some Tips for iTach, IR and UI7
Post by: sebpoterie on August 07, 2018, 09:19:02 am
I just can't access vera to place the file, I've used a number of programs and have used root, IP, wifi password from the bottom of the unit and port 22 but I just can't sign in to place the file.

Please help !

Thanks

Have U try with winSCP ? (see attachment)

login : root
password : located on the label under your Vera unit assigned to "WiFI Pass"

It works for my VeraEdge


On Vera Lite's, the root password isn't printed on the bottom. So you need to access to the 'Tech Support' settings. Depending on your UI version, this is either under the Advanced tab, the Settings tab, or the Account tab. There will be an 'enable' button. Click that to turn on the tech support service. You will see a message like this:

Tech support full control enabled, access code 3000000-436969

The first number is your serial number, which is always printed on the bottom. The second number is a temporary password created for a user called "remote". So, follow the same login instructions, but, instead of typing root for the login, type remote. And instead of using the normal password, use that temporary password, 436969 in this case. Once you have gotten in to the console, you can see the actual root password using this command: nvram show | grep pass

You'll see something like this:

root@MiOS_30000000:~# nvram show | grep pass vera_wifipass=shade83forest

So in this case, shade83forest, is the actual root password. Write it down, and from now on login as 'root' as explained earlier, and use that password. The temporary password for the remote user will only be valid for 24 hours or until you click 'Disable it' on the tech support page.

Title: Re: Here are some Tips for iTach, IR and UI7
Post by: Talisker on September 03, 2018, 04:55:15 pm
Have just changed my IP address for my iTach.  Prior to that it's been working (as set up following this post) for months. Now the commands won't run.  If I paste the following in to "Apps | Develop apps | Test luup code (LUA)"

require "ircommand"
ircommand.LS1()

I get error messages 'failed to test code please try again'.  Similarly if I run a scene with similar code I get 'Scene failed to run'.

I have double checked my IP address in my ircommand.lua file.  The commands work if I use the iLearn sofware so I have the correct IP address.

Any suggestions would be gratefully received.


Title: Re: Here are some Tips for iTach, IR and UI7
Post by: rostmo on September 29, 2018, 04:51:13 am
@Talisker, did you solve this?

If not, start with
1: confirming you actually have the latest version of the LUA-file in /usr/lib/lua. I have noticed it have been overwritten in my system once or twice with an older version (from the auto backup folder)
2: Make sure you execute step 3 from the original post: "luup.reload()"

If this didn't help please tell, and I'll try to look forther into it.
Title: Re: Here are some Tips for iTach, IR and UI7
Post by: Talisker on October 01, 2018, 03:58:27 pm
rostmo,

I fixed it.....  It would appear that my LUA-file in /usr/lib/lua was somehow replaced with an older version.  I replaced it with the correct file and it is now working OK.

Thanks.
Title: Re: Here are some Tips for iTach, IR and UI7
Post by: thumper702 on October 06, 2018, 03:44:45 pm
I have been unable to get this to work, any help would be appreciated.

I am using a Vera3 running UI7. I also have a GC-100 rack mounted device (GC-100-18R). Module 1 and 2 are for the serial ports, thus module 4 is the correct module when using the code for this device. I use the Global Cache learner attached to the 1st serial port and can pull the code using iLearn. Using iTest I can send the command and the projector responses. I can send the command using repeat 2 and it turns the projector off.

Additionally, the IP address is correct as I can visit the Global Cache GC-100 UI. I also set the device to maintain a static IP address (so it never changes).

I have created the ircommand.lua file and it is located in the proper location (usr/lib/lua) and has to proper name ircommand.lua
the Lua file itself is as followed:
Code: [Select]
module("ircommand", package.seeall)

local cmd

function epsonon()
cmd = 'sendir,4:1,0,38000,1,1,340,168,22,62,22,62,22,20,22,20,22,20,22,20,22,20,22,62,22,62,22,20,22,62,22,20,22,62,22,20,22,62,22,20,22,20,22,20,22,20,22,20,22,62,22,20,22,20,22,62,22,62,22,62,22,62,22,62,22,20,22,62,22,62,22,20,22,3800'
sendir(cmd)
end

function epsonoff()
-- Epson needs the On/Off button to be pressed two times.
cmd = 'sendir,4:1,0,38000,1,1,340,168,22,62,22,62,22,20,22,20,22,20,22,20,22,20,22,62,22,62,22,20,22,62,22,20,22,62,22,20,22,62,22,20,22,20,22,20,22,20,22,20,22,62,22,20,22,20,22,62,22,62,22,62,22,62,22,62,22,20,22,62,22,62,22,20,22,3800'
sendir(cmd)
sendir(cmd)
end

function sendir(commandtosend)
commandtosend = commandtosend .. ',\r'
local socket = require("socket")
c = assert(socket.connect("192.168.1.253", 4998))
c:settimeout(5)
local sres, serr = c:send(commandtosend)
local data, rerr = c:receive(5)
c:close()
end

When I reloaded the luup and attempt to test on the test luup code (lua) under Apps/Develop Apps in Vera UI7 I use the following code.

Code: [Select]
require "ircommand"
ircommand.epsonon()

I get the code successfully sent. However, no action is done by the project. Where am I messing up? Again, any help is appreciated.

Thank you.
Title: Re: Here are some Tips for iTach, IR and UI7
Post by: rostmo on October 06, 2018, 05:29:37 pm
Try swap 4:1,0 with 4:1,1

Sent fra min E6653 via Tapatalk

Title: Re: Here are some Tips for iTach, IR and UI7
Post by: thumper702 on October 06, 2018, 06:18:02 pm
Thank you for a swift reply. I appreciate the assistance.

However, I switched the 0 to a 1 and it still did not work. I also reloaded Luup after making the changes.

sendir,4:1,0,38000,1,1,340,168,22,62,22,62,22,20,22,20,22,20,22,20,22,20,22,62,22,62,22,20,22,62,22,20,22,62,22,20,22,62,22,20,22,20,22,20,22,20,22,20,22,62,22,20,22,20,22,62,22,62,22,62,22,62,22,62,22,20,22,62,22,62,22,20,22,3800

and

sendir,4:1,1,38000,1,1,340,168,22,62,22,62,22,20,22,20,22,20,22,20,22,20,22,62,22,62,22,20,22,62,22,20,22,62,22,20,22,62,22,20,22,20,22,20,22,20,22,20,22,62,22,20,22,20,22,62,22,62,22,62,22,62,22,62,22,20,22,62,22,62,22,20,22,3800

both work as codes using iTest (and turns on/off the projector).
Vera stats the code sent was successful, but not luck in getting it to work.
Title: Re: Here are some Tips for iTach, IR and UI7
Post by: PrincessCleavage on October 06, 2018, 07:32:31 pm
Originally I had similar issues and the best way I found to move forward was to go back to the original lua example file posted in this thread and just change the code and the name description on one of his items (as a test) then upload and test. Usually I will find that it works and I slowly modify and test from that working point (I.e usually an error on my part but buggered if I could see it).
Title: Re: Here are some Tips for iTach, IR and UI7
Post by: thumper702 on October 06, 2018, 07:47:12 pm
That is exactly what I did. I used the original file in the first post and only changed the cmd string to match that used in iTest (for my device) and the last 3 digitals of the IP address. I followed the directions outlined on this post, but have not had much luck. I have not even added other devices, just the projector at this moment.

Decided to try it all over again and deleted the ircommand.lua file and recreated it using the template provided in the first post. Still no luck  :(

Vera Logs show the following:
Code: [Select]
08 10/06/18 17:34:17.883 JobHandler_LuaUPnP::HandleActionRequest device: 0 service: urn:micasaverde-com:serviceId:HomeAutomationGateway1 action: RunLua <0x2f91a680>
08 10/06/18 17:34:17.884 JobHandler_LuaUPnP::HandleActionRequest argument id=lu_action <0x2f91a680>
08 10/06/18 17:34:17.884 JobHandler_LuaUPnP::HandleActionRequest argument serviceId=urn:micasaverde-com:serviceId:HomeAutomationGateway1 <0x2f91a680>
08 10/06/18 17:34:17.885 JobHandler_LuaUPnP::HandleActionRequest argument action=RunLua <0x2f91a680>
08 10/06/18 17:34:17.885 JobHandler_LuaUPnP::HandleActionRequest argument Code=require "ircommand"
ircommand.screenon() <0x2f91a680>

I don't get this. ...

I also changed epsonon to screenon and that doesn't work. iTest works with the remote code pulled from the GC serial learner, but vera is not executing the Lua command, but it is recognizing it and executing it.

Perhaps a file problem?
Title: Re: Here are some Tips for iTach, IR and UI7
Post by: thumper702 on October 06, 2018, 09:22:39 pm
I have the projector responding using the GC Plugin. I converted the code to Pronto and created a scene with the plugin. I wish I did have to go this route and could have used your method, but using the plugin also gives me access to the serial ports and the three relays so either way its a win-win.
Title: Re: Here are some Tips for iTach, IR and UI7
Post by: rostmo on January 06, 2019, 09:17:07 am
This also might be of interest for delayed actions in the lua file:

http://forum.micasaverde.com/index.php/topic,118117.0.html