Own Girahomeserver binding and double-bound items

Dear Forum,

I wrote my own little binding to connect openhab to Gira’s Homeserver CO-Gateway.
For single-bound items, this works very well.

However, my binding does not receive updates / commands that come from other bindings that are associated with the item. The item looks as follows:

Number Ventilation_HouseSystem_Inflow “Lueftung: Haussystem: Istwert Volumenstrom Zuluft [%d m3/h]” {modbus=“ventilationHouse:11”, girahomeserver=“102/1/3”}

I have seen this working for the knx binding; so it must be possible. What did I miss?

Best,
Jochen

It depends on what the other binding is. The modbus binding may be suppressing updates to its bound items when they haven’t changed.

Your binding has to override the method internalReceiveUpdate to catch updates to the items you are bound to, and internalReceiveCommand to catch commands sent to the item. Like:

    /**
     * {@inheritDoc}
     */
    @Override
    protected void internalReceiveCommand(String itemName, Command command) {
        logger.trace("internalReceiveCommand(item='{}', command='{}')", itemName, command);
        yourMethodToHandleCommands(itemName, command);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    protected void internalReceiveUpdate(final String itemName, final State newState) {
        logger.trace("Received update (item='{}', state='{}')", itemName, newState.toString());
        yourMethodToHandleUpdates(itemName, newState);
    }

Thank you for the quick response.

Boundle-bound items never update the server, so I assume it’s not a problem with the modbus binding suppressing some updates.

I the methods you mentioned are already implemented as you suggested:

/**
 * @{inheritDoc}
 */
@Override
protected void internalReceiveCommand(String itemName, Command command) {
    writeToGiraHomeServer(itemName, command);
}

/**
 * @{inheritDoc}
 */
@Override
protected void internalReceiveUpdate(String itemName, State newState) {
    writeToGiraHomeServer(itemName, newState);
}

Can you create a command- or timer-triggered rule that does

Ventilation_HouseSystem_Inflow.postUpdate(1)

or similar, to see if the binding’s internalReceiveUpdate is called?

Thank you watou,
I just found the problem.

In the binding.xml, it said
<property name="event.topics" type="String" value="openhab/command/*"/>

replacing it with
<property name="event.topics" type="String" value="openhab/*"/>

solves the problem.

1 Like