public class Lock extends AbstractComponent<Lock.ChannelConfiguration> {
public static final String LOCK_CHANNEL_ID = "lock";
public static final String STATE_CHANNEL_ID = "state";
+ public static final String JSON_ATTRIBUTES_CHANNEL_ID = "json-attributes";
/**
* Configuration class for MQTT component
protected String stateUnlocked = "UNLOCKED";
@SerializedName("state_unlocking")
protected String stateUnlocking = "UNLOCKING";
+
+ @SerializedName("json_attributes_template")
+ protected @Nullable String jsonAttributesTemplate;
+ @SerializedName("json_attributes_topic")
+ protected @Nullable String jsonAttributesTopic;
}
private boolean optimistic = false;
}
return true;
}).build();
+
+ if (channelConfiguration.jsonAttributesTopic != null) {
+ buildChannel(JSON_ATTRIBUTES_CHANNEL_ID, ComponentChannelType.STRING, new TextValue(), "JSON Attributes",
+ componentConfiguration.getUpdateListener())
+ .stateTopic(channelConfiguration.jsonAttributesTopic, channelConfiguration.jsonAttributesTemplate)
+ .withAutoUpdatePolicy(AutoUpdatePolicy.VETO).build();
+ }
+
finalizeChannels();
}