Merge branch 'main' of https://git.innov.energy/Innovenergy/git_trunk
This commit is contained in:
commit
64cf267dc1
|
@ -13,6 +13,9 @@ public static class Mailer
|
||||||
var config = JsonSerializer.Deserialize<SmptConfig>(File.OpenRead("./Resources/smtpConfig.json"))!;
|
var config = JsonSerializer.Deserialize<SmptConfig>(File.OpenRead("./Resources/smtpConfig.json"))!;
|
||||||
var email = new MimeMessage();
|
var email = new MimeMessage();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
email.From.Add(new MailboxAddress("InnovEnergy", "noreply@innov.energy"));
|
email.From.Add(new MailboxAddress("InnovEnergy", "noreply@innov.energy"));
|
||||||
email.To.Add(new MailboxAddress(emailRecipientUser.Name, emailRecipientUser.Email));
|
email.To.Add(new MailboxAddress(emailRecipientUser.Name, emailRecipientUser.Email));
|
||||||
|
|
||||||
|
@ -29,6 +32,11 @@ public static class Mailer
|
||||||
|
|
||||||
smtp.Send(email);
|
smtp.Send(email);
|
||||||
smtp.Disconnect(true);
|
smtp.Disconnect(true);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
|
@ -68,7 +68,23 @@ public static class EnumerableUtils
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
public static Queue<T> ToQueue<T>(this IEnumerable<T> ts)
|
||||||
|
{
|
||||||
|
var q = new Queue<T>();
|
||||||
|
foreach (var t in ts)
|
||||||
|
q.Enqueue(t);
|
||||||
|
|
||||||
|
return q;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Stack<T> ToStack<T>(this IEnumerable<T> ts)
|
||||||
|
{
|
||||||
|
var s = new Stack<T>();
|
||||||
|
foreach (var t in ts)
|
||||||
|
s.Push(t);
|
||||||
|
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
public static async IAsyncEnumerable<R>
|
public static async IAsyncEnumerable<R>
|
||||||
SelectManyAsync<T, R>(this IEnumerable<T> ts, Func<T, Task<IEnumerable<R>>> func)
|
SelectManyAsync<T, R>(this IEnumerable<T> ts, Func<T, Task<IEnumerable<R>>> func)
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -475,12 +475,7 @@ def update_graphs(n, graphs):
|
||||||
# TODO GRAB NEW DATA FROM DISK OR S3
|
# TODO GRAB NEW DATA FROM DISK OR S3
|
||||||
timeData = {}
|
timeData = {}
|
||||||
#Local copy of allFileNames because we loop over them at the moment
|
#Local copy of allFileNames because we loop over them at the moment
|
||||||
n = allFileNames
|
number = [item for item in allFileNames if item not in fileNames][n % len(allFileNames)-1]
|
||||||
number = int(list(set(n) - set(fileNames))[0])
|
|
||||||
|
|
||||||
# #TODO REMOVE ME
|
|
||||||
# if number >= 1673427558:
|
|
||||||
# number = 1673427378
|
|
||||||
|
|
||||||
fileNames.pop(0)
|
fileNames.pop(0)
|
||||||
fileNames.append(str(number))
|
fileNames.append(str(number))
|
||||||
|
@ -527,8 +522,8 @@ def update_graphs(n, graphs):
|
||||||
devices[k].power[1] = fig["data"][0]['y'][0]
|
devices[k].power[1] = fig["data"][0]['y'][0]
|
||||||
|
|
||||||
fig["data"][0]['x'][0] = now(filename)
|
fig["data"][0]['x'][0] = now(filename)
|
||||||
fig["data"][0]['y'] = np.roll(fig["data"][0]['y'], -1)
|
fig["data"][0]['y'] = fig["data"][0]['y'][-1:] + fig["data"][0]['y'][:-1]
|
||||||
fig["data"][0]['x'] = np.roll(fig["data"][0]['x'], -1)
|
fig["data"][0]['x'] = fig["data"][0]['x'][-1:] + fig["data"][0]['x'][:-1]
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if "Dc" in id["role"].split(" ",1)[1] or "Ac" in id["role"].split(" ",1)[1] or "Alarm" in id["role"] and "Actual" not in id["role"] :
|
if "Dc" in id["role"].split(" ",1)[1] or "Ac" in id["role"].split(" ",1)[1] or "Alarm" in id["role"] and "Actual" not in id["role"] :
|
||||||
|
@ -559,11 +554,10 @@ def update_graphs(n, graphs):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
fig["data"][0]['y'][0] = devices[k].data[list(devices[k].data.keys())[-1]][id["role"].split(" ", 1)[1]]
|
fig["data"][0]['y'][0] = devices[k].data[list(devices[k].data.keys())[-1]][id["role"].split(" ", 1)[1]]
|
||||||
|
|
||||||
fig["data"][0]['y'] = np.roll(fig["data"][0]['y'], -1)
|
|
||||||
|
|
||||||
fig["data"][0]['x'][0] = now(filename)
|
fig["data"][0]['x'][0] = now(filename)
|
||||||
fig["data"][0]['x'] = np.roll(fig["data"][0]['x'], -1)
|
fig["data"][0]['y'] = fig["data"][0]['y'][-1:] + fig["data"][0]['y'][:-1]
|
||||||
|
fig["data"][0]['x'] = fig["data"][0]['x'][-1:] + fig["data"][0]['x'][:-1]
|
||||||
|
|
||||||
return graphs
|
return graphs
|
||||||
|
|
||||||
# Main HTML Layout of the app ------------------------------------------------------------------------------------------
|
# Main HTML Layout of the app ------------------------------------------------------------------------------------------
|
||||||
|
@ -635,4 +629,4 @@ app.layout = html.Div(children=[
|
||||||
|
|
||||||
# Main App Start on specified ip (here local)
|
# Main App Start on specified ip (here local)
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
app.run_server(host= 'localhost', debug=False)
|
app.run_server(host= 'localhost', debug=False, port=8080)
|
|
@ -14,7 +14,7 @@ def find_Device_strict(name: str, devices):
|
||||||
return [dev for dev in devices if dev.name == name]
|
return [dev for dev in devices if dev.name == name]
|
||||||
|
|
||||||
def now(timestamp):
|
def now(timestamp):
|
||||||
#return datetime.fromtimestamp(int(timestamp.split("/")[-1])).replace(microsecond=0)
|
# return datetime.fromtimestamp(int(timestamp.split("/")[-1])).replace(microsecond=0)
|
||||||
return datetime.now().replace(microsecond=0) #TODO CHANGE ME WHEN GETTING NEW FILES
|
return datetime.now().replace(microsecond=0) #TODO CHANGE ME WHEN GETTING NEW FILES
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue