-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Winky copy Teleinfo driver example to FS (#31)
* Create cp2fs.be * disable driver load by default * exec copy files to filesystem
- Loading branch information
Showing
3 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
# load Winky teleinfo driver | ||
load("teleinfo.be") | ||
#load("teleinfo.be") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Copy teleinfo driver to file system to be end user editable | ||
|
||
# simple function to copy from autoconfig archive to filesystem | ||
# return true if ok | ||
def cp(from, to) | ||
import path | ||
if to == nil to = from end # to is optional | ||
tasmota.log("OTA: copying "+tasmota.wd + to, 2) | ||
if !path.exists(to) | ||
try | ||
# tasmota.log("f_in="+tasmota.wd + from) | ||
var f_in = open(tasmota.wd + from) | ||
var f_content = f_in.readbytes() | ||
f_in.close() | ||
var f_out = open(to, "w") | ||
f_out.write(f_content) | ||
f_out.close() | ||
except .. as e,m | ||
tasmota.log("OTA: Couldn't copy "+to+" "+e+" "+m,2) | ||
return false | ||
end | ||
return true | ||
end | ||
return true | ||
end | ||
|
||
import path | ||
|
||
# copy some samples files from autoconf | ||
# to filesystem for end user speed up learn | ||
var ok | ||
ok = cp("autoexec.be") | ||
ok = cp("teleinfo.be") | ||
|
||
|
||
# Done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters