Implemented PropertyType.SHUTTER

This commit is contained in:
Patrick Haßel 2021-10-29 11:59:08 +02:00
parent 48205ba7c7
commit e8f3380793
6 changed files with 25 additions and 43 deletions

View File

@ -20,6 +20,7 @@
<select [(ngModel)]="schedule.propertyType" (ngModelChange)="set(null,'propertyType', schedule.propertyType)">
<option value="ON_OFF">An / Aus</option>
<option value="PERCENT">Prozent</option>
<option value="SHUTTER">Rollladen</option>
</select>
</td>
</tr>
@ -60,18 +61,18 @@
<ng-container *ngIf="entry.type === 'SUNRISE' || entry.type === 'SUNSET'">
<td>
<select class="number" [(ngModel)]="entry.zenith" (ngModelChange)="set(entry, 'zenith', entry.zenith)">
<select [(ngModel)]="entry.zenith" (ngModelChange)="set(entry, 'zenith', entry.zenith)">
<option value="90.8333">
[&nbsp;90°]
<ng-container *ngIf="entry.type === 'SUNRISE'">Sonnenaufgang</ng-container>
<ng-container *ngIf="entry.type === 'SUNSET'">Sonnenuntergang</ng-container>
[&nbsp;90°]
</option>
<option value="93">[&nbsp;93°]</option>
<option value="96">Bürgerliche Dämmerung [&nbsp;96°]</option>
<option value="96">[&nbsp;96°] Bürgerliche Dämmerung</option>
<option value="99">[&nbsp;99°]</option>
<option value="102">Nautische Dämmerung [102°]</option>
<option value="102">[102°] Nautische Dämmerung</option>
<option value="105">[105°]</option>
<option value="108">Astronomische Dämmerung [108°]</option>
<option value="108">[108°] Astronomische Dämmerung</option>
</select>
</td>
</ng-container>
@ -79,13 +80,13 @@
<ng-container *ngIf="entry.type === 'TIME'">
<td class="first">
<select class="number" [(ngModel)]="entry.hour" (ngModelChange)="set(entry, 'hour', entry.hour)">
<select [(ngModel)]="entry.hour" (ngModelChange)="set(entry, 'hour', entry.hour)">
<option *ngFor="let _ of [].constructor(24); let value = index" [ngValue]="value">{{value}}</option>
</select>
</td>
<td class="middle">:</td>
<td class="last">
<select class="number" [(ngModel)]="entry.minute" (ngModelChange)="set(entry, 'minute', entry.minute)">
<select [(ngModel)]="entry.minute" (ngModelChange)="set(entry, 'minute', entry.minute)">
<option *ngFor="let _ of [].constructor(60); let value = index" [ngValue]="value">{{value | number:'2.0'}}</option>
</select>
</td>
@ -93,7 +94,7 @@
<td *ngIf="entry.type !== 'TIME'" colspan="3" class="empty"></td>
<td>
<select class="number" [(ngModel)]="entry.fuzzySeconds" (ngModelChange)="set(entry, 'fuzzySeconds', entry.fuzzySeconds)">
<select [(ngModel)]="entry.fuzzySeconds" (ngModelChange)="set(entry, 'fuzzySeconds', entry.fuzzySeconds)">
<option [ngValue]="0">Keine</option>
<option [ngValue]="60">1 Minute</option>
<option [ngValue]="300">5 Minuten</option>
@ -134,10 +135,19 @@
{{entry.value ? "An" : "Aus"}}
</td>
<td *ngIf="schedule.propertyType === 'PERCENT'" [class.true]="entry.value" [class.false]="!entry.value" [class.tristate]="0 < entry.value && entry.value < 100">
<select class="number" [(ngModel)]="entry.value" (ngModelChange)="set(entry, 'value', entry.value)">
<select [(ngModel)]="entry.value" (ngModelChange)="set(entry, 'value', entry.value)">
<option *ngFor="let _ of [].constructor(21); let value = index" [ngValue]="value * 5">{{value * 5}}%</option>
</select>
</td>
<td *ngIf="schedule.propertyType === 'SHUTTER'" [class.true]="entry.value === 0" [class.false]="entry.value === 100" [class.tristate]="0 < entry.value && entry.value < 100">
<select [(ngModel)]="entry.value" (ngModelChange)="set(entry, 'value', entry.value)">
<option [ngValue]="0">100% Offen</option>
<option [ngValue]="35">&nbsp;50%</option>
<option [ngValue]="75">&nbsp;90% Sonnenschutz</option>
<option [ngValue]="85">100% Schlitze</option>
<option [ngValue]="100">100% Geschlossen</option>
</select>
</td>
<td class="delete" (click)="delete(entry)">
<fa-icon title="Löschen" [icon]="faTimes"></fa-icon>

View File

@ -68,17 +68,17 @@ public class DemoDataService {
createSunset(scheduleOgAmbiente, Zenith.ASTRONOMICAL, MIN30, false);
scheduleRepository.save(scheduleOgAmbiente);
final Schedule scheduleWohnzimmerRollladen = createSchedule("Rollläden Wohnzimmer", wohnzimmer_rollladen_position_anfahren, PropertyType.PERCENT);
final Schedule scheduleWohnzimmerRollladen = createSchedule("Rollläden Wohnzimmer", wohnzimmer_rollladen_position_anfahren, PropertyType.SHUTTER);
createSunrise(scheduleWohnzimmerRollladen, Zenith.CIVIL, 0, 0);
createSunset(scheduleWohnzimmerRollladen, Zenith.CIVIL, 0, 100);
scheduleRepository.save(scheduleWohnzimmerRollladen);
final Schedule scheduleSchlafzimmerRollladen = createSchedule("Rollläden Schlafzimmer", schlafzimmer_rollladen_position_anfahren, PropertyType.PERCENT);
final Schedule scheduleSchlafzimmerRollladen = createSchedule("Rollläden Schlafzimmer", schlafzimmer_rollladen_position_anfahren, PropertyType.SHUTTER);
createTime(scheduleSchlafzimmerRollladen, 7, 0, 0, 0, 0);
createSunset(scheduleSchlafzimmerRollladen, Zenith.CIVIL, 0, 100);
scheduleRepository.save(scheduleSchlafzimmerRollladen);
final Schedule scheduleFlurRollladen = createSchedule("Rollläden Flur", flur_rollladen_position_anfahren, PropertyType.PERCENT);
final Schedule scheduleFlurRollladen = createSchedule("Rollläden Flur", flur_rollladen_position_anfahren, PropertyType.SHUTTER);
createSunrise(scheduleFlurRollladen, Zenith.CIVIL, 0, 0);
createSunset(scheduleFlurRollladen, Zenith.CIVIL, 0, 100);
scheduleRepository.save(scheduleFlurRollladen);

View File

@ -34,6 +34,7 @@ public class KnxGroup {
private String name;
@Column(nullable = false)
@Enumerated(EnumType.STRING)
private PropertyType propertyType;
private byte[] value;

View File

@ -1,5 +1,5 @@
package de.ph87.homeautomation.property;
public enum PropertyType {
ON_OFF, PERCENT, LUX
ON_OFF, PERCENT, SHUTTER, LUX
}

View File

@ -1,30 +0,0 @@
package de.ph87.homeautomation.schedule;
import de.ph87.homeautomation.knx.group.KnxGroupDto;
import lombok.Data;
import java.util.Map;
@Data
public class PropertyEntry implements Map.Entry<String, String> {
private final String key;
private String value;
public PropertyEntry(final KnxGroupDto knxGroupDto, final boolean value) {
this.key = knxGroupDto.getPropertyName();
this.value = "" + value;
}
public PropertyEntry(final KnxGroupDto knxGroupDto, final int value) {
this.key = knxGroupDto.getPropertyName();
this.value = "" + value;
}
public String setValue(final String value) {
this.value = value;
return value;
}
}

View File

@ -30,6 +30,7 @@ public class Schedule {
private String propertyName;
@Column(nullable = false)
@Enumerated(EnumType.STRING)
private PropertyType propertyType = PropertyType.ON_OFF;
@ToString.Exclude