Merge pull request #1 from jlti-dev/main

add fix for updated tasmota web interface
This commit is contained in:
Nathan Higley 2022-11-23 16:24:18 -05:00 committed by GitHub
commit 3877e91c1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 4 deletions

View File

@ -49,10 +49,16 @@ class TasmotaCollector(object):
string_values = str(page.text).split("{s}")
for i in range(1,len(string_values)):
label = string_values[i].split("{m}")[0]
value = string_values[i].split("{m}")[1].split("{e}")[0]
values[label] = value
try:
label = string_values[i].split("{m}")[0]
value = string_values[i].split("{m}")[1].split("{e}")[0]
if "<td" in value:
value = value.replace("</td><td style='text-align:left'>", "")
value = value.replace("</td><td>&nbsp;</td><td>", "")
values[label] = value
except IndexError:
continue
return values
def signal_handler(signal, frame):