-
ChatGPT samples:
Me:
Tell me about an iot program called openLuup.
It:
OpenLuup is an open source home automation system that is built on the VeraLuup platform. It is designed to be easy to install and configure, and provides users with a powerful and versatile way to control their home automation devices. OpenLuup offers a wide range of features, including support for many popular home automation devices, scheduling, scripting, and integration with other services. OpenLuup is designed to be customizable, allowing users to create their own home automation systems. It is an excellent choice for those looking to create their own home automation system without spending a lot of money.
Me:
Write an iot program using openLuup.
It:
--openLuup IoT Program-- -- Initialize Variables -- local device_id = "MyHomeDevice" local temperature_sensor_id = "MyTemperatureSensor" local temperature_threshold = 75 -- Create Devices -- luup.create_device("OpenLuup Temperature Sensor", 0, device_id, "D_GenericSensor1.xml", "I_GenericSensor1.xml", "S_TemperatureSensor1.xml", "") luup.variable_set("urn:upnp-org:serviceId:TemperatureSensor1", "CurrentTemperature", 0, device_id) -- Start Timer -- luup.call_delay("check_temperature", 10, "", false) --Function to Check Temperature-- function check_temperature() local current_temperature = luup.variable_get(temperature_sensor_id, "CurrentTemperature", 0) --Check Temperature Threshold-- if current_temperature >= temperature_threshold then --Send Alert-- luup.call_action("urn:micasaverde-com:serviceId:HomeAutomationGateway1", "SendTextMessage", {PhoneNumber="1234567890", Message="ALERT! Temperature exceeded threshold!"}, 0) end --Reset Timer-- luup.call_delay("check_temperature", 10, "", false) endMe:
Write an iot program using openLuup.
It:
Write an iot program using openLuup. -- openLuup IOT Program -- -- Variables local lampState = false local lampTime = 0 -- Functions function lampTimer() if lampTime > 0 then lampTime = lampTime - 1 if lampTime == 0 then luup.variable_set('urn:upnp-org:serviceId:SwitchPower1', 'Status', 0, lampDeviceID) lampState = false end end end -- Setup luup.call_delay('lampTimer', 60, 0) -- Main Loop while true do -- Check for motion if luup.variable_get('urn:micasaverde-com:serviceId:MotionSensor1', 'Tripped', motionSensorDeviceID) == '1' then if not lampState then luup.variable_set('urn:upnp-org:serviceId:SwitchPower1', 'Status', 1, lampDeviceID) lampState = true -- Set lamp timer to 5 minutes lampTime = 300 end end luup.sleep(1) endWhat??
luup.sleep(1)Not good - looks like I still have some semblance of a job to fulfill.
Me:
An iot program called openLuup was written by akbooer. Who is akbooer?
It: (note: answer redacted and as I understand it, also incorrect re: AltUI):
akbooer is the pseudonym of the software developer and home automation enthusiast. He is the creator of the openLuup home automation software, which is an open-source version of the Vera home automation system. He is also the creator of the AltUI graphical user interface for openLuup.
Me:
Who created of the AltUI graphical user interface for openLuup.
and
Me:
Who created of the AltUI graphical user interface for the home automation system Vera.
Names two different people - mmmm.
Regardless very impressive - give it a few more years.
-
Hi,
I am a student and recently i am working on smart home project and writing a seminar paper about the way users handle and manage IoT devices. I you have 3 min, please fill below survey. Its really short.
Thank you in advance, I really appreciate everyone's help. -
For what it's worth, I've been putting the finishing touches on a much-updated version of my DP Apps spreadsheet -- specifically intended for HE users, at least for now -- and invite you all to take a gander http://bit.ly/hedb23 at the PDF one-page version.
Corrections and edits welcome (esp. for the HOMEKIT column, just added yesterday)! Thanks in advance, especially because I'm not a big dashboard user myself, but somehow accepted this role as "keeper of the list" as it were.
-
Hello guys,
I would like to achieve two different things with lights, but I am not sure it could be done. I am starting with smart things, and I am far from any electrician knowledge, wo any help is really appreciated.
I have dumb switches in my hall, controlled from 3 places. I understood that installing one smart module before first switch will make them "hybrid", both smart controlled and dumb controlled.
I would like to buy ceiling light with two bulb sockets. What I would like to achieve is I would like to have one bulb for normal daily usage (lets say cold white full brightness), and second for night time (aprox from 10pm till morning) with some red/orange - minimum brightness.
So question are:
Is there a way to keep both bulbs turning-on separated? So only one will be on during day, and then only second during night?
And could that be done with pressing dumb switch? What would I need to achieve it? (maybe another module into the ceiling lights)
Thank you in advance
-
Aften some testing I watt to clear KWH how ?
Regards Bjarne
-
Hello,
I have a kitchen light that can be controlled by two switches, using either to turn it off or on. I have been slowly changing things over to be a smart home but this is the first switch I am attempting to install.
I am in a double wide modular home (mobile) that was built in 1994.
At first I thought I would need a 3 way switch but when taking the normal switches apart I realized that was incorrect because the wiring on my switches are different than anything I could find online.
For one a 3 way smart switch requires 5 wires and there are only 2 wires going into the primary switch with 3 wires going into the secondary switch from the primary switch (at least I think the 3 wires connect the two switches together). Images will be attached of the wiring.
There are two wires (one black and one white) going into the first switch and 3 wires (black, white, and red) going out of that and into the second switch (I assume). The odd thing is the red wire going to the second switch is connected to the white wire going into the first switch and the white wire going into the second switch seems to be a bridge wire or a traveler wire. Not exactly sure. You will see what I mean in the images.
I need to know what kind of smart switch I can use in this set up with one remaining a normal switch.
Note that for some reason the images got switched around when uploading them. The image with 2 wires on one side and 3 on the other is what I think is the primary and the image with just 3 wires is the secondary.
Primary.jpg Secondary.jpg -
You lot are more likely to have a view than most I know. Our much used Logitech Harmony is (not so) slowly dying.
And Logitech have discontinued the entire line.
And no one else appears to be making something similar.
Was going for a Sofabaton X1, but no numeric keypad. Sofabaton U1, but no favourites.
Anyone got suggestions?
Needs to have those features, oh and not be only a phone app.....C
-
Since one member asked at one point about the "front end" and "back end", I drew this showing the controller from the base to the tip along with what I have found to be the best options from my testing. Almost every controller will try to integrate all elements, especially commercial ones but... they all have strengths and weaknesses so if one can have a medley of the best ones...
-
-
So, I think I'm in a bit of an unusual situation. I work at a camp & retreat center that has wifi throughout. I want to put a few switches in the office that can control outdoor lighting throughout the camp. We currently have switches in each of the buildings, but it is a particularly frustrating job to get all the lights on in the evening when it is brutally cold out or we are short staffed.
Most of our staff is not very tech savvy (my boss literally has his wife print out his emails for him each day!!!) so, I'd love to avoid having to set up any sort of raspberry pi or new phone app.
Is there type of 3-way switch that can connect to the wifi, turn on a light in another building AND turn on an indicator light in the office, without having any sort of wire running between the buildings? Hopefully looking for a simple solution without breaking the bank too.
I greatly appreciate any input that you can give. Thank you!
Discover IR codes for lost remote
-
Hi all
Possibly a long shot - but does anyone know of a way, (maybe you have some code or know of an app) that can help you discover the IR codes of a device when you’ve lost the remote?
Looking online there seems to be a growing number of IR banks, yet I can’t find anything on the market that could cycle through a huge set of different codes (e.g just the power on/off) to let me know which ones are compatible ?
When you consider so many things these days are made in the same place, and often thing can just be re/badges versions of other items - it’s likely that a sets of codes for one branded product will work in the most part with another ..
-
Lost remote? It's probably down the back of the couch.
While not exactly what you want but have looked at Remote Central or possibly buy a new one on ebay?
-
@a-lurker said in Discover IR codes for lost remote:
Lost remote? It's probably down the back of the couch.
Sadly not, I picked these items up 2nd hand, so they didn’t come with the original remotes.
@a-lurker said in Discover IR codes for lost remote:
While not exactly what you want but have looked at Remote Central or possibly buy a new one on ebay
Yep, tried that already, along with http://irdb.tk/codes/ too - but neither of the manufacturers/ models I’m looking for are listed..
Hence I was thinking there must be a high chance something in those code banks will work, at the very least to power on/off..
Any ideas ?
-
I'm not aware of anything like you requested. There are things that could learn codes, but they require a handheld. Have you tried calling the manufacturer? Maybe they will give you instructions about this issue.
-
@therealdb said in Discover IR codes for lost remote:
Have you tried calling the manufacturer?
Yep, tried that I think I’ve tried everything, even have a saved search on eBay. Also as one of them had a RS232 connection, I explored that too, (via the Vera forum) but had to give up in the end as it wouldn’t work .
So far one manufacturer has stated that the unit in question was discontinued and the other has yet to respond after multiple attempts.
Rather that wait any long, seeing as I have a number of IR sender options, KIra, Harmony and BroadLink it made made me wonder if there was a way to retrieve codes, create a list and cycle through them.
I mainly use @a-lurker Broadlink, and looking at the IR ‘ProntoCode’ command option, it feels possible (with help?)
luup.call_action('urn:a-lurker-com:serviceId:IrTransmitter1', 'SendProntoCode', {ProntoCode = '0000 006C 0022 0002 015B 00AD 0016 0016 0016 0016 0016 0016 0016 0041 0016 0041 0016 0041 0016 0041 0016 0016 0016 0041 0016 0041 0016 0041 0016 0016 0016 0016 0016 0016 0016 0016 0016 0041 0016 0041 0016 0041 0016 0041 0016 0041 0016 0041 0016 0041 0016 0041 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0041 0016 05F7 015B 0057 0016 0E6C'},49)
it’s just the code bank connection to reduce the manual effort, and some way of recording/reporting which code was sent and if it worked or not. (Ideally all automated)
-
There is a great community/code bank on GitHub.
Index of codes is here - https://github.com/probonopd/irdb/blob/master/index
With their API - http://irdb.tk/api
And you can retrieve a .csv set for anyone via https://cdn.jsdelivr.net/gh/probonopd/irdb@master/codes/Samsung/TV/7,7.csv
-
I’ve just got an update from the guy behind the irdb - https://github.com/probonopd/irdb/issues/37
He mentioned..
Assuming you have the irdb tree locally on $IRDB_BASE, this pseudo code should do it
for file in $IRDB_BASE/codes/*/*.csv: for line in $file: (cmd_name,protocol,D,S,F) = split $line ',' if match('power', $cmd_name): echo "Trying signal $protocol $D $S $F" pronto = $(irptransmogrifier render -n D=$D,S=$D,F=$F $protocol) sendIr $pronto sleep $a_while endif endfor endfor
Please could someone help me to translate this into Lua and then to work with the Broadlink plug-in ?
-
I’d also appreciate any help/advice on how to maybe adjust @rigpapa’s GitHub Lua/plug-in to potentially pull into the irdb database (or would that simply be too much for Vera to take?)
-
@a-lurker - is there scope here for a possible add-on/enhancement to the Broadlink plug-in
-
well, it's possible in LUA as well. I'm not that expert in the file system libs, but Google is your friend
Just use io to open files, but I think that so many commands will probably crash your luup engine. We're potentially speaking of thousands of calls to try.
-
@parkerc said in Discover IR codes for lost remote:
Please could someone help me to translate this into Lua
for file in $IRDB_BASE/codes/*/*.csv: for line in $file: (cmd_name,protocol,D,S,F) = split $line ',' if match('power', $cmd_name): echo "Trying signal $protocol $D $S $F" pronto = $(irptransmogrifier render -n D=$D,S=$D,F=$F $protocol) sendIr $pronto sleep $a_while endif endfor endfor
becomes, in Lua:
local lfs = require "lfs" local dir = "codes/" -- make this your path to the files local split = "[^,]+,[^,]+,[^,]+,[^,]+,[^,]+" -- (cmd_name,protocol,D,S,F) for file in lfs.dir(dir) do if file: match "%.csv$" then for line in io.lines(dir .. filename)do local cmd_name,protocol,D,S,F = list: match (split) if 'power' == cmd_name then print ("$protocol $D $S $F", protocol,D,S,F) end end end end
I've just replaced the IR send with a print statement for now.
-
Thanks @akbooer
Some quick questions .
- Where would be the best place to store/sync the .csv files ?
- FYI to help test, here is an example/extract of the Samsung TV .csv
[functionname,protocol,device,subdevice,function INPUT SOURCE,NECx2,7,7,1 POWER,NECx2,7,7,2 1,NECx2,7,7,4 2,NECx2,7,7,5 3,NECx2,7,7,6 VOLUME +,NECx2,7,7,7 4,NECx2,7,7,8 5,NECx2,7,7,9 6,NECx2,7,7,10 VOLUME -,NECx2,7,7,11 7,NECx2,7,7,12 8,NECx2,7,7,13 9,NECx2,7,7,14 MUTE,NECx2,7,7,15 CHANNEL -,NECx2,7,7,16 0,NECx2,7,7,17 CHANNEL +,NECx2,7,7,18
By the looks of it to get the pronto version of the code, you would have to used the IrpTransmogrifier tool - https://github.com/bengtmartensson/IrpTransmogrifier
Where would be the best place to install that - is Vera a safe place or should I look elsewhere e.g a Pi ?
-
What were you thinking of using to send the codes?
I note that luup has an
ir
table with a single function in it. Also, thanks to @a-lurker it's implemented in openLuup. IT mentions GC100 in the comments:-- IR module -- thanks to @a-lurker for this. -- see: http://forum.micasaverde.com/index.php/topic,37268.0.html local ir = { pronto_to_gc100 = function (pronto) -- replace the pronto code preamble with the GC100 preamble
...but I have absolutely no idea about its functionality, not ever having used an IR devices at this level. I would have thought that these codes ARE the pronto codes?? (...or are they IRP notation protocols?)
-
@akbooer said in Discover IR codes for lost remote:
What were you thinking of using to send the codes?
I was ideally looking to use my Broadlink RM-Pro device and @a-lurker ‘s Vera plugin
@akbooer said in Discover IR codes for lost remote:
I have absolutely no idea about its functionality, not ever having used an IR devices at this level. I would have thought that these codes ARE the pronto codes?? (...or are they IRP notation protocols?)
I’m getting a bit out of my depth here now too,..
which is so often the case when I embark on these kind of HA adventures
.
My interpretation is that when using irdb, you have to convert the code for them them to be Pronto codes. - http://irdb.tk/convert/
If I use my Samsung TV as an example, that seems to use the necx2:7.7 protocol - which I’ve also seen written as NECx2, device 7.7. Either way that seems to be a very common TV code set for Samsung, Akai and some other brands.
So, looking at their api, I assumed I could at least try to call a specific code.
http://irdb.tk/api/code/?brand=Samsung&devicetype=TV
And then..
but alas no ir code was returned only this json, which perhaps is not surprise...
{ "meta": { "model": "code", "next": "", "page": 1, "previous": "" }, "objects": [ { "function": "2", "protocol": "NECx2", "subdevice": "7", "devicetype": "TV", "device": "7", "functionname": "POWER" } ] }
Any ideas on their api - http://irdb.tk/api ?
-
parkec
You haven't told us what hardware or software (MiOS/openLuup) you are using. If you read AK's code above you would just have to point to where the files are. Presumably the file(s) could be on a USB stick. You want to get AK's coe running first, on just one file first - one step at a time.
Later you need this bit:
bengtmartensson commented 16 hours ago •
Just install IrpTransmogrifier as shell command and call it (as shell program) using (I think) os.execute or io.popen in Lua. No need to call java from lua
pronto = $(irptransmogrifier render -n D=$D,S=$D,F=$F $protocol)The database looks like it could be huge and would take a while (who knows - a day?) to cycle around all the IR codes. Are you going to sit there and watch your device all day to catch when it turns on? AK's code needs to get the pronto code and then send it. Something like this (but totally untested):
-- Send an IR code every two seconds -- Function needs to be global as it's a delay timeout target function sendProntoCodeToBroadLinkDevice(prontoCode) local BROADLINK_DEVICE_ID = 49 luup.call_action('urn:a-lurker-com:serviceId:IrTransmitter1', 'SendProntoCode', {ProntoCode = prontoCode}, BROADLINK_DEVICE_ID) end function scanIndexFiles () local lfs = require "lfs" local dir = "codes/" -- make this your path to the files local split = "[^,]+,[^,]+,[^,]+,[^,]+,[^,]+" -- (cmd_name,protocol,D,S,F) local prontoCode = '' for file in lfs.dir(dir) do if file: match "%.csv$" then for line in io.lines(dir .. filename) do local cmd_name,protocol,D,S,F = list: match (split) if 'power' == cmd_name then print ("$protocol $D $S $F", protocol,D,S,F) local irptransmogrifierPath = "insert path here" -- this may all need work depending on whatever "irptransmogrifier" does local command = string.format("%sirptransmogrifier render -n D=%s,S=%s,F=%s protocol",irptransmogrifierPath,D,S,F,protocol) local handle = assert(io.popen(command)) local prontoCode = handle:read("*a") handle:close() local INTERVAL_SECS = 2 luup.call_delay('sendProntoCodeToBroadLinkDevice', INTERVAL_SECS, prontoCode) end end end end end scanIndexFiles()
Note: luup.call_delay only works in the openLuup window test window - I'm still not clear why. But the Vera and AltUI test windows won't run it correctly. You need the delay so the BroadLink device has time to send the code. (the function sleep() is not suitable)
-
@a-lurker said in Discover IR codes for lost remote:
You haven't told us what hardware or software (MiOS/openLuup) you are using.
Sorry,, I’m looking first to Vera/MIOS , with the Broadlink RM Pro4, and your plug-in.
@a-lurker said in Discover IR codes for lost remote:
The database looks like it could be huge and would take a while (who knows - a day?) to cycle around all the IR codes. Are you going to sit there and watch your device all day to catch when it turns on? AK's code needs to get the pronto code and then send it. Something like this (but totally untested):
To avoid sitting around as the devices in question register for an IP, which I can fix, I was thinking I can watch for that variable to be updated .e.g via ping test or another option could be to place a light sensor right in front of the power LED to react when the light comes on..
@a-lurker said in Discover IR codes for lost remote:
You want to get AK's coe running first, on just one file first - one step at a time.
Agreed, and here’s an example .csv of the Samsung TV code/set they store. /codes/
functionname,protocol,device,subdevice,function INPUT SOURCE,NECx2,7,7,1 POWER,NECx2,7,7,2 1,NECx2,7,7,4 2,NECx2,7,7,5 3,NECx2,7,7,6 VOLUME +,NECx2,7,7,7 4,NECx2,7,7,8 5,NECx2,7,7,9 6,NECx2,7,7,10 VOLUME -,NECx2,7,7,11 7,NECx2,7,7,12 8,NECx2,7,7,13 9,NECx2,7,7,14 MUTE,NECx2,7,7,15 CHANNEL -,NECx2,7,7,16 0,NECx2,7,7,17 CHANNEL +,NECx2,7,7,18 LAST,NECx2,7,7,19 MENU,NECx2,7,7,26 INFO,NECx2,7,7,31 AD/SUBT,NECx2,7,7,37 EXIT,NECx2,7,7,45 E-MANUAL,NECx2,7,7,63 TOOLS,NECx2,7,7,75 GUIDE,NECx2,7,7,79 RETURN,NECx2,7,7,88 CUSOR UP,NECx2,7,7,96 CURSOR DOWN,NECx2,7,7,97 CURSOR RIGHT,NECx2,7,7,98 CURSOR LEFT,NECx2,7,7,101 ENTER,NECx2,7,7,104 CH LIST,NECx2,7,7,107 SMART HUB,NECx2,7,7,121 3D,NECx2,7,7,159
And overall size wise, I assume - as they are not storing every individual code and Ir format/type, instead it’s just the protocol and some other identifier - the whole irdb/code folder seems reasonably small.
-
Are you sure you can’t open those devices and look at the electronics? It seems to be simpler than this, to me
Maybe, also, some repair shop could help you. They usually deal with these kind of things and maybe they have something smarter to identify them. May be worth a try.
-
@therealdb said in Discover IR codes for lost remote:
Are you sure you can’t open those devices and look at the electronics? It seems to be simpler than this, to me
These items are racked up so it;s not quite as easy as I’d like that option to be - but I am weighing up the hassle of doing that vs doing this
The benefit of making this code/process work is that a) i will have learnt something new - b) This could then be something g that helps others and c) it would give the Broadlink plug-in access to a huge ir bank of codes for people to use.
-
Hi,
I’ve been working with the code that was shared (thanks so much), and have trimming it down a bit to work it through in sections, but - here’s my current issue - any ideas ?
(I) if I put the .csv file in the main search folder it does not return any errors, but it also does not print anything out.
/mnt/nas/vera/ircodes/7,7.csv
LuaTest 1.7 Lua file: /etc/cmh-ludl/luatest.lua Results No errors Runtime: 51.4 ms Code returned: nil Print output (none) Code 1 2 local lfs = require "lfs" 3 local dir = "mnt/nas/vera/ircodes/" -- make this your path to the files 4 local split = "[^,]+,[^,]+,[^,]+,[^,]+,[^,]+" -- (cmd_name,protocol,D,S,F) 5 6 local prontoCode = '' 7 8 for file in lfs.dir(dir) do 9 if file: match "%.csv$" then 10 for line in io.lines(dir .. filename) do 11 local cmd_name,protocol,D,S,F = list: match (split) 12 if 'power' == cmd_name then 13 print ("$protocol $D $S $F", protocol,D,S,F) 14 end 15 end 16 end 17 end
- When I run it again, I get this, should filename be local or specified ?
LuaTest 1.7 Lua file: /etc/cmh-ludl/luatest.lua Results Runtime error: Line 9: attempt to concatenate global 'filename' (a nil value) Locals [main] lfs={ _VERSION="LuaFileSystem 1.6.2", symlinkattributes=function, lock_dir=function, dir=function, _DESCRIPTION="LuaFileSystem is a Lua library developed to complement the set of functions related to file systems offered by the standard Lua distribution", setmode=function, unlock=function, _COPYRIGHT="Copyright (C) 2003-2012 Kepler Project", currentdir=function, touch=function, mkdir=function, lock=function, link=function, attributes=function, chdir=function, rmdir=function } dir="mnt/nas/vera/ircodes/" split="[^,]+,[^,]+,[^,]+,[^,]+,[^,]+" prontoCode="" Print output (none) Code 1 local lfs = require "lfs" 2 local dir = "mnt/nas/vera/ircodes/" -- make this your path to the files 3 local split = "[^,]+,[^,]+,[^,]+,[^,]+,[^,]+" -- (cmd_name,protocol,D,S,F) 4 5 local prontoCode = '' 6 7 for file in lfs.dir(dir) do 8 if file: match "%.csv$" then 9 for line in io.lines(dir .. filename) do 10 local cmd_name,protocol,D,S,F = list: match (split) 11 if 'POWER' == cmd_name then 12 print ("$protocol $D $S $F", protocol,D,S,F) 13 end 14 end 15 end 16 end
II) I know we are doing this in sections, but as there are many layers of manufacturer folders and device type sub folders, will the eventual end code systematically search for all *.csv files within all the levels below? E.g.
/mnt/nas/vera/ircodes/Samsung/TV/7,7.csv
/mnt/nas/vera/ircodes/Panasonic/TV/128,0.csv
/mnt/nas/vera/ircodes/Panasonic/TV/128,1.csv
/mnt/nas/vera/ircodes/Panasonic/TV/128,4.csv
/mnt/nas/vera/ircodes/Panasonic/TV/128,9.csv
/mnt/nas/vera/ircodes/Panasonic/DVD Player/128,0.csv /mnt/nas/vera/ircodes/Panasonic/DVD Player/160,0.csv /mnt/nas/vera/ircodes/Panasonic/DVD Player/160,16.csv
/mnt/nas/vera/ircodes/Panasonic/DVD Player/160,18.csv
/mnt/nas/vera/ircodes/Panasonic/DVD Player/160,28.csv
/mnt/nas/vera/ircodes/Panasonic/DVD Player/160,34.csv
/mnt/nas/vera/ircodes/Panasonic/DVD Player/160,4.csv
/mnt/nas/vera/ircodes/Panasonic/Unknown_EUR7617010/170,3csvI found this online, is that the sort of thing we will need to factor i later on..
If I remove the ‘filename’ variable call, and specify a file, it then does this.
LuaTest 1.7 Lua file: /etc/cmh-ludl/luatest.lua Results Runtime error: Line 10: attempt to index global 'list' (a nil value) Locals [main] lfs={ _VERSION="LuaFileSystem 1.6.2", symlinkattributes=function, lock_dir=function, dir=function, _DESCRIPTION="LuaFileSystem is a Lua library developed to complement the set of functions related to file systems offered by the standard Lua distribution", setmode=function, unlock=function, _COPYRIGHT="Copyright (C) 2003-2012 Kepler Project", currentdir=function, touch=function, mkdir=function, lock=function, link=function, attributes=function, chdir=function, rmdir=function } dir="mnt/nas/vera/ircodes/" split="[^,]+,[^,]+,[^,]+,[^,]+,[^,]+" prontoCode="" Print output (none) Code 1 local lfs = require "lfs" 2 local dir = "mnt/nas/vera/ircodes/" -- make this your path to the files 3 local split = "[^,]+,[^,]+,[^,]+,[^,]+,[^,]+" -- (cmd_name,protocol,D,S,F) 4 5 local prontoCode = '' 6 7 for file in lfs.dir(dir) do 8 if file: match "%.csv$" then 9 for line in io.lines(dir .. '7,7.csv') do 10 local cmd_name,protocol,D,S,F = list: match (split) 11 if 'POWER' == cmd_name then 12 print ("$protocol $D $S $F", protocol,D,S,F) 13 end 14 end 15 end 16 end
-
"list" should be "line"
And /mnt/nas/vera/ircodes/Panasonic/Unknown_EUR7617010/170,3csv files are expected to end in ".csv"
And "file" should probably be changed to "filename"
Refer: https://keplerproject.github.io/luafilesystem/manual.html
Also I see you changed "power" to "POWER", which is correct but it's safer to do this: 'POWER' == cmd_name:upper() to guarantee you get uppercase. You are also using commas in your filenames. While this is allowed in Linux, I'm not so sure it should be encouraged. If that's how they come, so be it.