Class MqttWesClient
java.lang.Object
org.rockhopper.smarthome.wes.wes2mqtt.MqttWesClient
- All Implemented Interfaces:
org.eclipse.paho.client.mqttv3.MqttCallback,WesEventListener,org.springframework.beans.factory.DisposableBean
@Component
public class MqttWesClient
extends Object
implements WesEventListener, org.eclipse.paho.client.mqttv3.MqttCallback, org.springframework.beans.factory.DisposableBean
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.slf4j.Loggerprotected boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidconnectionLost(Throwable cause) voiddeliveryComplete(org.eclipse.paho.client.mqttv3.IMqttDeliveryToken token) voiddestroy()intGet current number of reconnection attemptsbooleanGet current reconnection statusbooleanlabelToSubTopic(String label) voidmessageArrived(String topic, org.eclipse.paho.client.mqttv3.MqttMessage message) voidvoidRe-publish Home Assistant discovery messages This can be called manually or after reconnectionvoidReset reconnection counters (can be called when connection is manually restored)voidsetWesServer(WesServer wesServer) voidstart()voidstop()
-
Field Details
-
log
protected org.slf4j.Logger log -
shutdownInProgress
protected boolean shutdownInProgress
-
-
Constructor Details
-
MqttWesClient
public MqttWesClient()
-
-
Method Details
-
start
public void start() -
isShutdownInProgress
public boolean isShutdownInProgress() -
stop
public void stop() -
onEvent
- Specified by:
onEventin interfaceWesEventListener
-
labelToSubTopic
-
connectionLost
- Specified by:
connectionLostin interfaceorg.eclipse.paho.client.mqttv3.MqttCallback
-
resetReconnectionState
public void resetReconnectionState()Reset reconnection counters (can be called when connection is manually restored) -
isReconnecting
public boolean isReconnecting()Get current reconnection status -
getReconnectionAttempts
public int getReconnectionAttempts()Get current number of reconnection attempts -
republishHomeAssistantDiscovery
public void republishHomeAssistantDiscovery()Re-publish Home Assistant discovery messages This can be called manually or after reconnection -
messageArrived
public void messageArrived(String topic, org.eclipse.paho.client.mqttv3.MqttMessage message) throws Exception - Specified by:
messageArrivedin interfaceorg.eclipse.paho.client.mqttv3.MqttCallback- Throws:
Exception
-
deliveryComplete
public void deliveryComplete(org.eclipse.paho.client.mqttv3.IMqttDeliveryToken token) - Specified by:
deliveryCompletein interfaceorg.eclipse.paho.client.mqttv3.MqttCallback
-
setWesServer
-
destroy
- Specified by:
destroyin interfaceorg.springframework.beans.factory.DisposableBean- Throws:
Exception
-