Class CommandEntity
-
- All Implemented Interfaces:
-
crackers.kobots.mqtt.homeassistant.KobotHAEntity,kotlin.Comparable
public abstract class CommandEntity extends AbstractKobotEntity
-
-
Field Summary
Fields Modifier and Type Field Description private final StringcommandTopicprivate final Stringiconprivate final StringstatusTopicprivate final StringuniqueIdprivate final Stringnameprivate final DeviceIdentifierdeviceIdentifierprivate final Stringcomponent
-
Constructor Summary
Constructors Constructor Description CommandEntity(String uniqueId, String name, DeviceIdentifier deviceIdentifier)
-
Method Summary
Modifier and Type Method Description StringgetCommandTopic()The MQTT topic for the devices command (receive). abstract UnithandleCommand(String payload)Handle the MQTT command message for this device. Unitstart()Over-ride the base class to add a subscription to handle commands. JSONObjectdiscovery()A generic configuration for the device, which can be used to generate the discovery message because there are too many "base" configuration parameters to be able to handle them cleanly, so just dump it on the child class to figure it out. -
Methods inherited from class crackers.kobots.mqtt.homeassistant.AbstractKobotEntity
getDeviceIdentifier, getIcon, getName, getStatusTopic, getUniqueId, remove, sendCurrentState -
Methods inherited from class crackers.kobots.mqtt.homeassistant.KobotHAEntity
compareTo, currentState, getComponent -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
CommandEntity
CommandEntity(String uniqueId, String name, DeviceIdentifier deviceIdentifier)
-
-
Method Detail
-
getCommandTopic
String getCommandTopic()
The MQTT topic for the devices command (receive). Allows over-rides.
-
handleCommand
abstract Unit handleCommand(String payload)
Handle the MQTT command message for this device.
-
start
Unit start()
Over-ride the base class to add a subscription to handle commands. This also "automatically" sends a current state once the handler has finished.
-
discovery
JSONObject discovery()
A generic configuration for the device, which can be used to generate the discovery message because there are too many "base" configuration parameters to be able to handle them cleanly, so just dump it on the child class to figure it out.
-
-
-
-