Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[freeathome] Fix not updating values of room temperature devices #17957

Merged
merged 4 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -429,9 +429,10 @@ public void setDatapointOnWebsocketFeedback(String receivedText) {

if (deviceHandler != null) {
deviceHandler.onDeviceStateChanged(eventDatapointID, value);
logger.debug("Socket event processed: event-datapoint-ID {} value {}", eventDatapointID, value);
} else {
logger.debug("Socket event not processed: event-datapoint-ID {} value {}", eventDatapointID, value);
}

logger.debug("Socket event processed: event-datapoint-ID {} value {}", eventDatapointID, value);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,6 @@ public void handleCommand(ChannelUID channelUID, Command command) {
if (dpg == null) {
logger.debug("Handle command for device (but invalid datapointgroup) {} - at channel {} - full command {}",
device.getDeviceId(), channelUID.getAsString(), command.toFullString());

updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR,
"@text/conf-error.invalid-deviceconfig");
} else {
Expand Down Expand Up @@ -480,8 +479,7 @@ public void updateChannels() throws FreeAtHomeGeneralException {
channelTypeUID = createChannelTypeForDatapointgroup(dpg, channelTypeUID);
}

ChannelUID channelUID = new ChannelUID(thingUID, channel.getChannelId(),
dpg.getLabel().substring(4));
ChannelUID channelUID = createChannelUID(thingUID, channel.getChannelId(), dpg.getLabel());

String channelLabel = String.format("%s",
i18nProvider.getText(bundle, dpg.getLabel(), "-", locale));
Expand Down Expand Up @@ -568,7 +566,7 @@ private void reloadChannelTypes() throws FreeAtHomeGeneralException {
channelTypeUID = createChannelTypeForDatapointgroup(dpg, channelTypeUID);
}

ChannelUID channelUID = new ChannelUID(thingUID, channel.getChannelId());
ChannelUID channelUID = createChannelUID(thingUID, channel.getChannelId(), dpg.getLabel());

FreeAtHomeDatapoint outputDatapoint = dpg.getOutputDatapoint();

Expand All @@ -589,6 +587,12 @@ private void reloadChannelTypes() throws FreeAtHomeGeneralException {
}
}

// Create a channel UID. Makes sure that the channel UID is unique and generated the same way every time
private ChannelUID createChannelUID(ThingUID thingUID, String channelID, String dpgLabel) {
ChannelUID channelUID = new ChannelUID(thingUID, channelID, dpgLabel.substring(4));
return channelUID;
JankKeks marked this conversation as resolved.
Show resolved Hide resolved
}

public void removeChannels() {
Bridge bridge = this.getBridge();

Expand Down