Fixed price config

This commit is contained in:
Gunnar Skjold 2024-04-14 14:20:46 +02:00
parent 77873f4a38
commit 3a980fac4c
3 changed files with 9 additions and 9 deletions

View File

@ -106,8 +106,8 @@ float PriceService::getValueForHour(uint8_t direction, time_t ts, int8_t hour) {
return ret;
tmElements_t tm;
breakTime(tz->toLocal(ts + (hour) * SECS_PER_HOUR), tm);
uint8_t day = 0x01 << (tm.Wday - 2);
breakTime(tz->toLocal(ts + (hour * SECS_PER_HOUR)), tm);
uint8_t day = 0x01 << ((tm.Wday+5)%7);
uint32_t hrs = 0x01 << tm.Hour;
for (uint8_t i = 0; i < priceConfig.size(); i++) {
@ -137,8 +137,8 @@ float PriceService::getValueForHour(uint8_t direction, time_t ts, int8_t hour) {
float PriceService::getEnergyPriceForHour(uint8_t direction, time_t ts, int8_t hour) {
tmElements_t tm;
breakTime(tz->toLocal(ts + (hour) * SECS_PER_HOUR), tm);
uint8_t day = 0x01 << (tm.Wday - 2);
breakTime(tz->toLocal(ts + (hour * SECS_PER_HOUR)), tm);
uint8_t day = 0x01 << ((tm.Wday+5)%7);
uint32_t hrs = 0x01 << tm.Hour;
float value = PRICE_NO_VALUE;

File diff suppressed because one or more lines are too long

View File

@ -143,26 +143,26 @@
</div>
</div>
<div class="flex flex-wrap mr-3">
<select name="rsm" class="in-f" bind:value={c.s.m}>
<select name="rsd" class="in-f" bind:value={c.s.d}>
<option value={0}>-</option>
{#each {length: 31} as _,i}
<option value={i+1}>{i+1}</option>
{/each}
</select>
<select name="rsd" class="in-m" bind:value={c.s.d}>
<select name="rsm" class="in-m" bind:value={c.s.m}>
<option value={0}>-</option>
{#each {length: 12} as _,i}
<option value={i+1}>{translations.months?.[i]}</option>
{/each}
</select>
<input class="in-m" disabled value="to" style="width: 20px;color:#888;"/>
<select name="rem" class="in-m" bind:value={c.e.m}>
<select name="red" class="in-m" bind:value={c.e.d}>
<option value={0}>-</option>
{#each {length: 31} as _,i}
<option value={i+1}>{i+1}</option>
{/each}
</select>
<select name="red" class="in-l" bind:value={c.e.d}>
<select name="rem" class="in-l" bind:value={c.e.m}>
<option value={0}>-</option>
{#each {length: 12} as _,i}
<option value={i+1}>{translations.months?.[i]}</option>