use of org.openhab.binding.lightwaverf.LightwaveRfBindingProvider in project openhab1-addons by openhab.
the class LightwaveRfBinding method versionMessageReceived.
@Override
public void versionMessageReceived(LightwaveRfVersionMessage message) {
for (LightwaveRfBindingProvider provider : providers) {
List<String> itemNames = provider.getBindingItemsForType(LightwaveRfType.VERSION);
publishUpdate(itemNames, message, provider);
}
}
use of org.openhab.binding.lightwaverf.LightwaveRfBindingProvider in project openhab1-addons by openhab.
the class LightwaveRfBinding method serialMessageReceived.
@Override
public void serialMessageReceived(LightwaveRfSerialMessage message) {
for (LightwaveRfBindingProvider provider : providers) {
List<String> itemNames = provider.getBindingItemsForSerial(message.getSerial());
publishUpdate(itemNames, message, provider);
}
}
use of org.openhab.binding.lightwaverf.LightwaveRfBindingProvider in project openhab1-addons by openhab.
the class LightwaveRfBinding method activate.
/**
* Called by the SCR to activate the component with its configuration read
* from CAS
*
* @param bundleContext
* BundleContext of the Bundle that defines this component
* @param configuration
* Configuration properties for this component obtained from the
* ConfigAdmin service
*/
public void activate(final BundleContext bundleContext, final Map<String, Object> configuration) {
String ipString = (String) configuration.get("ip");
if (StringUtils.isNotBlank(ipString)) {
LIGHTWAVE_IP = ipString;
}
String recieverPortsString = (String) configuration.get("receiveport");
if (StringUtils.isNotBlank(recieverPortsString)) {
LIGHTWAVE_PORTS_TO_RECEIVE_ON = Integer.parseInt(recieverPortsString);
}
String portTwoString = (String) configuration.get("sendport");
if (StringUtils.isNotBlank(portTwoString)) {
LIGHTWAVE_PORT_TO_SEND_TO = Integer.parseInt(portTwoString);
}
String sendRegistrationMessageString = (String) configuration.get("registeronstartup");
if (StringUtils.isNotBlank(sendRegistrationMessageString)) {
SEND_REGISTER_ON_STARTUP = Boolean.parseBoolean(sendRegistrationMessageString);
}
String sendDelayString = (String) configuration.get("senddelay");
if (StringUtils.isNotBlank(sendDelayString)) {
TIME_BETWEEN_SENT_MESSAGES_MS = Integer.parseInt(sendDelayString);
}
String okTimeoutString = (String) configuration.get("okTimeout");
if (StringUtils.isNotBlank(okTimeoutString)) {
TIMEOUT_FOR_OK_MESSAGES_MS = Integer.parseInt(okTimeoutString);
}
logger.info("LightwaveBinding: IP[{}]", LIGHTWAVE_IP);
logger.info("LightwaveBinding: ReceivePort[{}]", LIGHTWAVE_PORTS_TO_RECEIVE_ON);
logger.info("LightwaveBinding: Send Port[{}]", LIGHTWAVE_PORT_TO_SEND_TO);
logger.info("LightwaveBinding: Register On Startup[{}]", SEND_REGISTER_ON_STARTUP);
logger.info("LightwaveBinding: Send Delay [{}]", TIME_BETWEEN_SENT_MESSAGES_MS);
logger.info("LightwaveBinding: Timeout for Ok Messages [{}]", TIMEOUT_FOR_OK_MESSAGES_MS);
messageConvertor = new LightwaverfConvertor();
try {
wifiLink = new LightwaveRfWifiLink(LIGHTWAVE_IP, LIGHTWAVE_PORT_TO_SEND_TO, LIGHTWAVE_PORTS_TO_RECEIVE_ON, messageConvertor, TIME_BETWEEN_SENT_MESSAGES_MS, TIMEOUT_FOR_OK_MESSAGES_MS);
wifiLink.addListener(this);
wifiLink.start();
if (SEND_REGISTER_ON_STARTUP) {
wifiLink.sendLightwaveCommand(messageConvertor.getRegistrationCommand());
}
// Now the sender is started and we have sent the registration
// message
// start the Heat Poller
heatPoller = new LightwaveRfHeatPoller(wifiLink, messageConvertor);
// bindingChanged method
for (LightwaveRfBindingProvider provider : providers) {
Collection<String> itemNames = provider.getItemNames();
registerHeatingPollers(provider, itemNames);
}
} catch (UnknownHostException e) {
logger.error("Error creating LightwaveRFSender", e);
} catch (SocketException e) {
logger.error("Error creating LightwaveRFSender/Receiver", e);
}
}
use of org.openhab.binding.lightwaverf.LightwaveRfBindingProvider in project openhab1-addons by openhab.
the class LightwaveRfBinding method roomDeviceMessageReceived.
@Override
public void roomDeviceMessageReceived(LightwaveRfRoomDeviceMessage message) {
for (LightwaveRfBindingProvider provider : providers) {
List<String> itemNames = provider.getBindingItemsForRoomDevice(message.getRoomId(), message.getDeviceId());
publishUpdate(itemNames, message, provider);
}
}
use of org.openhab.binding.lightwaverf.LightwaveRfBindingProvider in project openhab1-addons by openhab.
the class LightwaveRfBinding method activateForTesting.
/**
* Used to active the binding when running as a test with the
* wifilink set manually
*/
public void activateForTesting() {
wifiLink.addListener(this);
wifiLink.start();
// Now the sender is started and we have sent the registration
// message
// start the Heat Poller
heatPoller = new LightwaveRfHeatPoller(wifiLink, messageConvertor);
// bindingChanged method
for (LightwaveRfBindingProvider provider : providers) {
Collection<String> itemNames = provider.getItemNames();
registerHeatingPollers(provider, itemNames);
}
}
Aggregations