mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2026-01-10 08:33:59 +01:00
implemented update commands for berry driver
This commit is contained in:
@@ -25,11 +25,18 @@ Might be required to send the command twice (known issue, didn't investigate yet
|
||||
Start's flashing a tft file to the nextion screen via Nextion Upload Protocol 1.2
|
||||
Might be required to send the command twice (known issue, didn't investigate yet)
|
||||
|
||||
|
||||
Webserver must be reachable via HTTP and support Range Header
|
||||
|
||||
Example: `FlashNextion http://192.168.75.30:8123/local/nspanel.tft`
|
||||
|
||||
- `GetDriverVersion`
|
||||
|
||||
Returns the version currently defined in the berry script
|
||||
|
||||
- `UpdateDriverVersion URL`
|
||||
|
||||
Downloads the autoexec.be script from the specified URL and loads it.
|
||||
|
||||
|
||||
Besides the commands, serial input will be published on 'RESULT' Topic, depending on the input in one of the following formats:
|
||||
- `{"CustomRecv":%s}`
|
||||
|
||||
@@ -327,6 +327,48 @@ class Nextion : Driver
|
||||
end
|
||||
end
|
||||
|
||||
def get_current_version(cmd, idx, payload, payload_json)
|
||||
import string
|
||||
var version_of_this_script = 1
|
||||
var jm = string.format("{\"berry_version\":\"%s\"}", version_of_this_script)
|
||||
tasmota.publish_result(jm, "RESULT")
|
||||
end
|
||||
|
||||
tasmota.add_cmd('GetDriverVersion', get_current_version)
|
||||
|
||||
def update_berry_driver(cmd, idx, payload, payload_json)
|
||||
def task()
|
||||
import string
|
||||
var cl = webclient()
|
||||
cl.begin(payload)
|
||||
var r = cl.GET()
|
||||
if r == 200
|
||||
print("Sucessfully downloaded nspanel-lovelace-ui berry driver")
|
||||
else
|
||||
print("Error while downloading nspanel-lovelace-ui berry driver")
|
||||
end
|
||||
r = cl.write_file("autoexec.be")
|
||||
if r < 0
|
||||
print("Error while writeing nspanel-lovelace-ui berry driver")
|
||||
else
|
||||
print("Scucessfully written nspanel-lovelace-ui berry driver")
|
||||
var s = load('autoexec.be')
|
||||
if s == true
|
||||
var jm = string.format("{\"berry_update\":\"%s\"}", "succeeded")
|
||||
tasmota.publish_result(jm, "RESULT")
|
||||
else
|
||||
var jm = string.format("{\"berry_update\":\"%s\"}", "failed")
|
||||
tasmota.publish_result(jm, "RESULT")
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
tasmota.set_timer(0,task)
|
||||
tasmota.resp_cmnd_done()
|
||||
end
|
||||
|
||||
tasmota.add_cmd('UpdateDriverVersion', update_berry_driver)
|
||||
|
||||
var nextion = Nextion()
|
||||
|
||||
def flash_nextion(cmd, idx, payload, payload_json)
|
||||
|
||||
Reference in New Issue
Block a user