mirror of
https://github.com/UtilitechAS/amsreader-firmware.git
synced 2026-03-25 18:18:18 +00:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9d902c63de | ||
|
|
a57405a7a5 | ||
|
|
550d32ee33 |
@@ -577,6 +577,11 @@ bool AmsDataStorage::isHappy() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool AmsDataStorage::isDayHappy() {
|
bool AmsDataStorage::isDayHappy() {
|
||||||
|
if(tz == NULL) {
|
||||||
|
if(debugger->isActive(RemoteDebug::VERBOSE)) debugger->printf_P(PSTR("(AmsDataStorage) Timezone is missing\n"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
time_t now = time(nullptr);
|
time_t now = time(nullptr);
|
||||||
if(now < FirmwareVersion::BuildEpoch) return false;
|
if(now < FirmwareVersion::BuildEpoch) return false;
|
||||||
|
|
||||||
|
|||||||
@@ -179,6 +179,7 @@ bool EnergyAccounting::update(AmsData* amsData) {
|
|||||||
void EnergyAccounting::calcDayCost() {
|
void EnergyAccounting::calcDayCost() {
|
||||||
time_t now = time(nullptr);
|
time_t now = time(nullptr);
|
||||||
tmElements_t local, utc;
|
tmElements_t local, utc;
|
||||||
|
if(tz == NULL) return;
|
||||||
breakTime(tz->toLocal(now), local);
|
breakTime(tz->toLocal(now), local);
|
||||||
|
|
||||||
if(getPriceForHour(0) != ENTSOE_NO_VALUE) {
|
if(getPriceForHour(0) != ENTSOE_NO_VALUE) {
|
||||||
@@ -205,10 +206,10 @@ float EnergyAccounting::getUseThisHour() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
float EnergyAccounting::getUseToday() {
|
float EnergyAccounting::getUseToday() {
|
||||||
|
if(tz == NULL) return 0.0;
|
||||||
float ret = 0.0;
|
float ret = 0.0;
|
||||||
time_t now = time(nullptr);
|
time_t now = time(nullptr);
|
||||||
if(now < FirmwareVersion::BuildEpoch) return 0.0;
|
if(now < FirmwareVersion::BuildEpoch) return 0.0;
|
||||||
if(tz == NULL) return 0.0;
|
|
||||||
tmElements_t utc, local;
|
tmElements_t utc, local;
|
||||||
breakTime(tz->toLocal(now), local);
|
breakTime(tz->toLocal(now), local);
|
||||||
for(uint8_t i = 0; i < currentHour; i++) {
|
for(uint8_t i = 0; i < currentHour; i++) {
|
||||||
@@ -237,6 +238,7 @@ float EnergyAccounting::getProducedThisHour() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
float EnergyAccounting::getProducedToday() {
|
float EnergyAccounting::getProducedToday() {
|
||||||
|
if(tz == NULL) return 0.0;
|
||||||
float ret = 0.0;
|
float ret = 0.0;
|
||||||
time_t now = time(nullptr);
|
time_t now = time(nullptr);
|
||||||
if(now < FirmwareVersion::BuildEpoch) return 0.0;
|
if(now < FirmwareVersion::BuildEpoch) return 0.0;
|
||||||
|
|||||||
2
lib/SvelteUi/app/dist/index.js
vendored
2
lib/SvelteUi/app/dist/index.js
vendored
File diff suppressed because one or more lines are too long
@@ -6,10 +6,10 @@
|
|||||||
export let offset;
|
export let offset;
|
||||||
|
|
||||||
let showFull;
|
let showFull;
|
||||||
let adjusteTimestamp;
|
|
||||||
$:{
|
$:{
|
||||||
showFull = Math.abs(new Date().getTime()-timestamp.getTime()) < 300000;
|
showFull = Math.abs(new Date().getTime()-timestamp.getTime()) < 300000;
|
||||||
addHours(timestamp, offset);
|
if(!isNaN(offset))
|
||||||
|
addHours(timestamp, offset);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -329,7 +329,7 @@ void AmsWebServer::sysinfoJson() {
|
|||||||
ea->getCostLastMonth(),
|
ea->getCostLastMonth(),
|
||||||
ea->getProducedLastMonth(),
|
ea->getProducedLastMonth(),
|
||||||
ea->getIncomeLastMonth(),
|
ea->getIncomeLastMonth(),
|
||||||
(tz->toLocal(now)-now)/3600
|
tz == NULL ? 0 : (tz->toLocal(now)-now)/3600
|
||||||
);
|
);
|
||||||
|
|
||||||
stripNonAscii((uint8_t*) buf, size+1);
|
stripNonAscii((uint8_t*) buf, size+1);
|
||||||
|
|||||||
@@ -387,15 +387,7 @@ void setup() {
|
|||||||
if(config.hasConfig()) {
|
if(config.hasConfig()) {
|
||||||
if(Debug.isActive(RemoteDebug::INFO)) config.print(&Debug);
|
if(Debug.isActive(RemoteDebug::INFO)) config.print(&Debug);
|
||||||
WiFi_connect();
|
WiFi_connect();
|
||||||
|
handleNtpChange();
|
||||||
NtpConfig ntp;
|
|
||||||
if(config.getNtpConfig(ntp)) {
|
|
||||||
tz = resolveTimezone(ntp.timezone);
|
|
||||||
ws.setTimezone(tz);
|
|
||||||
ds.setTimezone(tz);
|
|
||||||
ea.setTimezone(tz);
|
|
||||||
}
|
|
||||||
|
|
||||||
ds.load();
|
ds.load();
|
||||||
} else {
|
} else {
|
||||||
if(Debug.isActive(RemoteDebug::INFO)) {
|
if(Debug.isActive(RemoteDebug::INFO)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user