Skip to content

Commit

Permalink
Don't give a logo led for non-pro models
Browse files Browse the repository at this point in the history
  • Loading branch information
Niels van de Weem committed Nov 2, 2024
1 parent a5bd1b5 commit 89f8fec
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/main/java/com/getpcpanel/device/DeviceType.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
@Getter
@RequiredArgsConstructor(access = AccessLevel.PACKAGE)
public enum DeviceType {
PCPANEL_RGB("PCPanel RGB", 1240, 60242, 4, 4),
PCPANEL_MINI("PCPanel Mini", 1155, 41924, 4, 4),
PCPANEL_PRO("PCPanel Pro", 1155, 41925, 9, 5);
PCPANEL_RGB("PCPanel RGB", 1240, 60242, 4, 4, false),
PCPANEL_MINI("PCPanel Mini", 1155, 41924, 4, 4, false),
PCPANEL_PRO("PCPanel Pro", 1155, 41925, 9, 5, true);

public static final List<DeviceType> ALL = Arrays.asList(values());

Expand All @@ -21,4 +21,5 @@ public enum DeviceType {
private final int pid;
private final int analogCount;
private final int buttonCount;
private final boolean hasLogoLed;
}
2 changes: 1 addition & 1 deletion src/main/java/com/getpcpanel/mqtt/MqttDeviceService.java
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ private void writeLighting(Device device, LightingConfig lighting) {
sendColors(lighting.getKnobConfigs(), mqttHelper, knob, SingleKnobLightingConfig::getColor1);
sendColors(lighting.getSliderConfigs(), mqttHelper, slider, SingleSliderLightingConfig::getColor1);
sendColors(lighting.getSliderLabelConfigs(), mqttHelper, label, SingleSliderLabelLightingConfig::getColor);
if (lighting.getLogoConfig() != null) {
if (device.getDeviceType().isHasLogoLed() && lighting.getLogoConfig() != null) {
mqtt.send(mqttHelper.lightTopic(logo, 0), toColorString(lighting.getLogoConfig().getColor()), false);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ private void addBrightnessDevice(MqttSettings settings, Device device, HomeAssis
}

private void addLogoLight(MqttSettings settings, Device device, HomeAssistantDevice haDevice) {
if (!device.getDeviceType().isHasLogoLed()) {
return;
}

var configTopic = lightTopicFor(settings, device, "logo");
var valueTopic = topicHelper.lightTopic(device.getSerialNumber(), MqttTopicHelper.ColorType.logo, 0);

Expand Down

0 comments on commit 89f8fec

Please sign in to comment.