Hi, I’m on Windows and I’m trying to develope my own Binding.
I have created a binding skeleton with the file /git/openhab2-addons/addons/binding/create_openhab_binding_skeleton.sh and I changed the item-type to Switch. I have put a break point on the handleCommand method of the Handler class and run on debug.
My issue is that my command is a RefreshType and not a OnOffType . Does anybody knows why ?
Here is my thing-types.xml file
<!-- Sample Thing Type -->
<thing-type id="sample">
<label>ObjectRest Binding Thing</label>
<description>Sample thing for ObjectRest Binding</description>
<channels>
<channel id="channel1" typeId="sample-channel" />
</channels>
</thing-type>
<!-- Sample Channel Type -->
<channel-type id="sample-channel">
<item-type>Switch</item-type>
<label>ObjectRest Binding Channel</label>
<description>Sample channel for ObjectRest Binding</description>
</channel-type>
</thing:thing-descriptions>
and here is my Handler class
@NonNullByDefault
public class ObjectRestHandler extends BaseThingHandler {
private final Logger logger = LoggerFactory.getLogger(ObjectRestHandler.class);
@Nullable
private ObjectRestConfiguration config;
public ObjectRestHandler(Thing thing) {
super(thing);
}
@Override
public void handleCommand(ChannelUID channelUID, Command command) {
if (channelUID.getId().equals(CHANNEL_1)) { //with a breakpoint here
}
}
@Override
public void initialize() {
config = getConfigAs(ObjectRestConfiguration.class);
updateStatus(ThingStatus.ONLINE);
}
}
Thank you for helping me.