Search in sources :

Example 6 with BinRpcRequest

use of org.openhab.binding.homematic.internal.binrpc.BinRpcRequest in project openhab1-addons by openhab.

the class BinRpcClient method getRssiInfo.

/**
     * {@inheritDoc}
     */
@SuppressWarnings("unchecked")
@Override
public Map<String, HmRssiInfo> getRssiInfo(HmInterface hmInterface) throws HomematicClientException {
    BinRpcRequest request = new BinRpcRequest("rssiInfo");
    Map<String, HmRssiInfo> rssiList = new HashMap<String, HmRssiInfo>();
    Object[] result = sendMessage(hmInterface, request);
    if (result != null && result.length > 0 && result[0] instanceof Map) {
        Map<String, ?> devices = (Map<String, ?>) result[0];
        for (String sourceDevice : devices.keySet()) {
            Map<String, Object[]> targetDevices = (Map<String, Object[]>) devices.get(sourceDevice);
            for (String targetDevice : targetDevices.keySet()) {
                if (targetDevice.equals(context.getServerId().getAddress())) {
                    Integer rssiDevice = (Integer) targetDevices.get(targetDevice)[0];
                    Integer rssiPeer = (Integer) targetDevices.get(targetDevice)[1];
                    HmRssiInfo rssiInfo = new HmRssiInfo(sourceDevice, rssiDevice, rssiPeer);
                    rssiList.put(rssiInfo.getAddress(), rssiInfo);
                }
            }
        }
    }
    return rssiList;
}
Also used : HashMap(java.util.HashMap) HmRssiInfo(org.openhab.binding.homematic.internal.model.HmRssiInfo) BinRpcRequest(org.openhab.binding.homematic.internal.binrpc.BinRpcRequest) HashMap(java.util.HashMap) Map(java.util.Map)

Example 7 with BinRpcRequest

use of org.openhab.binding.homematic.internal.binrpc.BinRpcRequest in project openhab1-addons by openhab.

the class BinRpcClient method release.

/**
     * {@inheritDoc}
     */
@Override
public void release(HmInterface hmInterface) throws HomematicClientException {
    BinRpcRequest request = new BinRpcRequest("init");
    request.addArg(context.getConfig().getBinRpcCallbackUrl());
    sendMessage(hmInterface, request);
}
Also used : BinRpcRequest(org.openhab.binding.homematic.internal.binrpc.BinRpcRequest)

Example 8 with BinRpcRequest

use of org.openhab.binding.homematic.internal.binrpc.BinRpcRequest in project openhab1-addons by openhab.

the class BinRpcClient method executeProgram.

/**
     * {@inheritDoc}
     */
@Override
public void executeProgram(HmInterface hmInterface, String programName) throws HomematicClientException {
    BinRpcRequest request = new BinRpcRequest("runScript");
    request.addArg(programName);
    sendMessage(hmInterface, request);
}
Also used : BinRpcRequest(org.openhab.binding.homematic.internal.binrpc.BinRpcRequest)

Aggregations

BinRpcRequest (org.openhab.binding.homematic.internal.binrpc.BinRpcRequest)8 HashMap (java.util.HashMap)2 Map (java.util.Map)2 HmRssiInfo (org.openhab.binding.homematic.internal.model.HmRssiInfo)1