[jablotron] fixed programmable gates channels are not visible in the OH3 UI (#9809)

- fixed programmable gates channels are not visible in the OH3 UI

Signed-off-by: Ondrej Pecta <opecta@gmail.com>
This commit is contained in:
Ondrej Pecta 2021-01-13 21:00:50 +01:00 committed by GitHub
parent a46d9cb306
commit 41f8ae6acc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 7 deletions

View File

@ -28,7 +28,7 @@ import org.openhab.core.thing.ThingTypeUID;
@NonNullByDefault @NonNullByDefault
public class JablotronBindingConstants { public class JablotronBindingConstants {
private static final String BINDING_ID = "jablotron"; public static final String BINDING_ID = "jablotron";
// List of all Thing Type UIDs // List of all Thing Type UIDs
public static final ThingTypeUID THING_TYPE_BRIDGE = new ThingTypeUID(BINDING_ID, "bridge"); public static final ThingTypeUID THING_TYPE_BRIDGE = new ThingTypeUID(BINDING_ID, "bridge");

View File

@ -12,6 +12,7 @@
*/ */
package org.openhab.binding.jablotron.internal.handler; package org.openhab.binding.jablotron.internal.handler;
import static org.openhab.binding.jablotron.JablotronBindingConstants.BINDING_ID;
import static org.openhab.binding.jablotron.JablotronBindingConstants.CACHE_TIMEOUT_MS; import static org.openhab.binding.jablotron.JablotronBindingConstants.CACHE_TIMEOUT_MS;
import static org.openhab.binding.jablotron.JablotronBindingConstants.CHANNEL_LAST_CHECK_TIME; import static org.openhab.binding.jablotron.JablotronBindingConstants.CHANNEL_LAST_CHECK_TIME;
@ -125,15 +126,16 @@ public class JablotronJa100FHandler extends JablotronAlarmHandler {
} }
private void createPGChannel(String name, String label) { private void createPGChannel(String name, String label) {
ChannelTypeUID pgmStatus = new ChannelTypeUID(BINDING_ID, "pgm_state");
ThingBuilder thingBuilder = editThing(); ThingBuilder thingBuilder = editThing();
Channel channel = ChannelBuilder.create(new ChannelUID(thing.getUID(), name), "Switch").withLabel(label) Channel channel = ChannelBuilder.create(new ChannelUID(thing.getUID(), name), "Switch").withLabel(label)
.build(); .withType(pgmStatus).build();
thingBuilder.withChannel(channel); thingBuilder.withChannel(channel);
updateThing(thingBuilder.build()); updateThing(thingBuilder.build());
} }
private void createStateChannel(String name, String label) { private void createStateChannel(String name, String label) {
ChannelTypeUID alarmStatus = new ChannelTypeUID("jablotron", "ja100f_alarm_state"); ChannelTypeUID alarmStatus = new ChannelTypeUID(BINDING_ID, "ja100f_alarm_state");
ThingBuilder thingBuilder = editThing(); ThingBuilder thingBuilder = editThing();
Channel channel = ChannelBuilder.create(new ChannelUID(thing.getUID(), name), "String").withLabel(label) Channel channel = ChannelBuilder.create(new ChannelUID(thing.getUID(), name), "String").withLabel(label)
.withType(alarmStatus).build(); .withType(alarmStatus).build();

View File

@ -12,6 +12,7 @@
*/ */
package org.openhab.binding.jablotron.internal.handler; package org.openhab.binding.jablotron.internal.handler;
import static org.openhab.binding.jablotron.JablotronBindingConstants.BINDING_ID;
import static org.openhab.binding.jablotron.JablotronBindingConstants.CACHE_TIMEOUT_MS; import static org.openhab.binding.jablotron.JablotronBindingConstants.CACHE_TIMEOUT_MS;
import static org.openhab.binding.jablotron.JablotronBindingConstants.CHANNEL_LAST_CHECK_TIME; import static org.openhab.binding.jablotron.JablotronBindingConstants.CHANNEL_LAST_CHECK_TIME;
@ -98,7 +99,7 @@ public class JablotronJa100Handler extends JablotronAlarmHandler {
} }
private void createTempChannel(String name, String label) { private void createTempChannel(String name, String label) {
ChannelTypeUID temperature = new ChannelTypeUID("jablotron", "temperature"); ChannelTypeUID temperature = new ChannelTypeUID(BINDING_ID, "temperature");
ThingBuilder thingBuilder = editThing(); ThingBuilder thingBuilder = editThing();
Channel channel = ChannelBuilder.create(new ChannelUID(thing.getUID(), name), "Number:Temperature") Channel channel = ChannelBuilder.create(new ChannelUID(thing.getUID(), name), "Number:Temperature")
.withLabel(label).withType(temperature).build(); .withLabel(label).withType(temperature).build();
@ -107,7 +108,7 @@ public class JablotronJa100Handler extends JablotronAlarmHandler {
} }
private void createThermostatChannel(String name, String label) { private void createThermostatChannel(String name, String label) {
ChannelTypeUID temperature = new ChannelTypeUID("jablotron", "thermostat"); ChannelTypeUID temperature = new ChannelTypeUID(BINDING_ID, "thermostat");
ThingBuilder thingBuilder = editThing(); ThingBuilder thingBuilder = editThing();
Channel channel = ChannelBuilder.create(new ChannelUID(thing.getUID(), name), "Number:Temperature") Channel channel = ChannelBuilder.create(new ChannelUID(thing.getUID(), name), "Number:Temperature")
.withLabel(label).withType(temperature).build(); .withLabel(label).withType(temperature).build();
@ -116,15 +117,16 @@ public class JablotronJa100Handler extends JablotronAlarmHandler {
} }
private void createPGMChannel(String name, String label) { private void createPGMChannel(String name, String label) {
ChannelTypeUID pgmStatus = new ChannelTypeUID(BINDING_ID, "pgm_state");
ThingBuilder thingBuilder = editThing(); ThingBuilder thingBuilder = editThing();
Channel channel = ChannelBuilder.create(new ChannelUID(thing.getUID(), name), "Switch").withLabel(label) Channel channel = ChannelBuilder.create(new ChannelUID(thing.getUID(), name), "Switch").withLabel(label)
.build(); .withType(pgmStatus).build();
thingBuilder.withChannel(channel); thingBuilder.withChannel(channel);
updateThing(thingBuilder.build()); updateThing(thingBuilder.build());
} }
private void createStateChannel(String name, String label) { private void createStateChannel(String name, String label) {
ChannelTypeUID alarmStatus = new ChannelTypeUID("jablotron", "alarm_state"); ChannelTypeUID alarmStatus = new ChannelTypeUID(BINDING_ID, "alarm_state");
ThingBuilder thingBuilder = editThing(); ThingBuilder thingBuilder = editThing();
Channel channel = ChannelBuilder.create(new ChannelUID(thing.getUID(), name), "String").withLabel(label) Channel channel = ChannelBuilder.create(new ChannelUID(thing.getUID(), name), "String").withLabel(label)
.withType(alarmStatus).build(); .withType(alarmStatus).build();

View File

@ -125,6 +125,13 @@
<state readOnly="true"/> <state readOnly="true"/>
</channel-type> </channel-type>
<!-- pgm_state -->
<channel-type id="pgm_state">
<item-type>Switch</item-type>
<label>Programmable Gate State</label>
<description>A channel used for controlling the PGM state</description>
</channel-type>
<!-- alarm_state --> <!-- alarm_state -->
<channel-type id="alarm_state"> <channel-type id="alarm_state">
<item-type>String</item-type> <item-type>String</item-type>