Skip to content

Commit

Permalink
[mqtt][mqtt.homeassistant] openhab#5632 One component discovered for …
Browse files Browse the repository at this point in the history
…a type, fixed. JSON's unique_id contains invalid chars for Openhab's UID, fixed. (openhab#5682)

Signed-off-by: Jevgeni Kiski <[email protected]>
  • Loading branch information
yozik04 authored and martinvw committed Jun 3, 2019
1 parent a9126eb commit 3a2cd02
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*/
package org.openhab.binding.mqtt.homeassistant.internal;

import java.net.URLEncoder;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
Expand Down Expand Up @@ -77,6 +78,7 @@ public AbstractComponent(CFactory.ComponentConfiguration componentConfiguration,
if (groupId == null || StringUtils.isBlank(groupId)) {
groupId = this.haID.getFallbackGroupId();
}
groupId = URLEncoder.encode(groupId).replace(".", "%DOT");

this.channelGroupTypeUID = new ChannelGroupTypeUID(MqttBindingConstants.BINDING_ID, groupId);
this.channelGroupUID = new ChannelGroupUID(componentConfiguration.getThingUID(), groupId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public void receivedMessage(ThingUID connectionBridge, MqttBrokerConnection conn
// Therefore the components are assembled into a list and given to the DiscoveryResult label for the user to
// easily recognize object capabilities.
HaID topicParts = determineTopicParts(topic);
final String thingID = topicParts.objectID;
final String thingID = topicParts.getFallbackGroupId();
final ThingUID thingUID = new ThingUID(MqttBindingConstants.HOMEASSISTANT_MQTT_THING, connectionBridge,
thingID);

Expand Down

0 comments on commit 3a2cd02

Please sign in to comment.