private ThingStatusInfo buildStatusInfo(ThingStatus thingStatus, ThingStatusDetail thingStatusDetail, String description) { ThingStatusInfoBuilder statusInfoBuilder = ThingStatusInfoBuilder.create(thingStatus, thingStatusDetail); statusInfoBuilder.withDescription(description); return statusInfoBuilder.build(); }
/** * Creates a status info builder for the given status and detail. * * @param status the status (must not be null) * @param statusDetail the detail of the status (must not be null) * @return status info builder */ public static ThingStatusInfoBuilder create(ThingStatus status, ThingStatusDetail statusDetail) { return new ThingStatusInfoBuilder(status, statusDetail, null); }
/** * Creates a status info builder for the given status. * * @param status the status (must not be null) * @return status info builder */ public static ThingStatusInfoBuilder create(ThingStatus status) { return create(status, ThingStatusDetail.NONE); }
@Override public Channel getChannel(ThingUID thingUID, ZigBeeEndpoint endpoint) { if (!supportsIasChannel(endpoint, ZoneTypeEnum.MOTION_SENSOR)) { return null; } return ChannelBuilder .create(createChannelUID(thingUID, endpoint, ZigBeeBindingConstants.CHANNEL_NAME_IAS_MOTIONINTRUSION), ZigBeeBindingConstants.ITEM_TYPE_SWITCH) .withType(ZigBeeBindingConstants.CHANNEL_IAS_MOTIONINTRUSION) .withLabel(ZigBeeBindingConstants.CHANNEL_LABEL_IAS_MOTIONINTRUSION) .withProperties(createProperties(endpoint)).build(); } }
/** * Creates a thing builder, which allows to modify the thing. The method * {@link BaseThingHandler#updateThing(Thing)} must be called to persist the changes. * * @return {@link ThingBuilder} which builds an exact copy of the thing (not null) */ protected ThingBuilder editThing() { return ThingBuilder.create(this.thing.getThingTypeUID(), this.thing.getUID()) .withBridge(this.thing.getBridgeUID()).withChannels(this.thing.getChannels()) .withConfiguration(this.thing.getConfiguration()).withLabel(this.thing.getLabel()) .withLocation(this.thing.getLocation()).withProperties(this.thing.getProperties()); }
@Override public Bridge build() { return (Bridge) super.build(); }
@Override public BridgeBuilder withChannels(Channel... channels) { return (BridgeBuilder) super.withChannels(channels); }
@Override public BridgeBuilder withConfiguration(Configuration thingConfiguration) { return (BridgeBuilder) super.withConfiguration(thingConfiguration); }
@Override public BridgeBuilder withChannel(Channel channel) { return (BridgeBuilder) super.withChannel(channel); }
@Override public BridgeBuilder withLabel(@Nullable String label) { return (BridgeBuilder) super.withLabel(label); }
@Override public BridgeBuilder withoutChannel(ChannelUID channelUID) { return (BridgeBuilder) super.withoutChannel(channelUID); }
@Override public BridgeBuilder withProperties(Map<String, String> properties) { return (BridgeBuilder) super.withProperties(properties); }
public static BridgeBuilder create(ThingTypeUID thingTypeUID, ThingUID thingUID) { BridgeImpl bridge = new BridgeImpl(thingTypeUID, thingUID); return new BridgeBuilder(bridge); }
@Override public Channel getChannel(ThingUID thingUID, ZigBeeEndpoint endpoint) { if (!supportsIasChannel(endpoint, ZoneTypeEnum.FIRE_SENSOR)) { return null; } return ChannelBuilder .create(createChannelUID(thingUID, endpoint, ZigBeeBindingConstants.CHANNEL_NAME_IAS_FIREINDICATION), ZigBeeBindingConstants.ITEM_TYPE_SWITCH) .withType(ZigBeeBindingConstants.CHANNEL_IAS_FIREINDICATION) .withLabel(ZigBeeBindingConstants.CHANNEL_LABEL_IAS_FIREINDICATION) .withProperties(createProperties(endpoint)).build(); } }
@Override public BridgeBuilder withChannels(List<Channel> channels) { return (BridgeBuilder) super.withChannels(channels); }
public ThingBuilder withoutChannels(List<Channel> channels) { for (Channel channel : channels) { withoutChannel(channel.getUID()); } return this; }
@Override public Channel getChannel(ThingUID thingUID, ZigBeeEndpoint endpoint) { if (hasIasZoneInputCluster(endpoint)) { return ChannelBuilder .create(createChannelUID(thingUID, endpoint, ZigBeeBindingConstants.CHANNEL_NAME_IAS_LOWBATTERY), ZigBeeBindingConstants.ITEM_TYPE_SWITCH) .withType(ZigBeeBindingConstants.CHANNEL_IAS_LOWBATTERY) .withLabel(ZigBeeBindingConstants.CHANNEL_LABEL_IAS_LOWBATTERY) .withProperties(createProperties(endpoint)).build(); } else { return null; } }
@Override public Channel getChannel(ThingUID thingUID, ZigBeeEndpoint endpoint) { if (!supportsIasChannel(endpoint, ZoneTypeEnum.MOTION_SENSOR)) { return null; } return ChannelBuilder .create(createChannelUID(thingUID, endpoint, ZigBeeBindingConstants.CHANNEL_NAME_IAS_MOTIONPRESENCE), ZigBeeBindingConstants.ITEM_TYPE_SWITCH) .withType(ZigBeeBindingConstants.CHANNEL_IAS_MOTIONPRESENCE) .withLabel(ZigBeeBindingConstants.CHANNEL_LABEL_IAS_MOTIONPRESENCE) .withProperties(createProperties(endpoint)).build(); } }