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 String
commandTopic
private final String
icon
private final String
statusTopic
private final String
uniqueId
private final String
name
private final DeviceIdentifier
deviceIdentifier
private final String
component
-
Constructor Summary
Constructors Constructor Description CommandEntity(String uniqueId, String name, DeviceIdentifier deviceIdentifier)
-
Method Summary
Modifier and Type Method Description String
getCommandTopic()
The MQTT topic for the devices command (receive). abstract Unit
handleCommand(String payload)
Handle the MQTT command message for this device. Unit
start()
Over-ride the base class to add a subscription to handle commands. 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. -
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.
-
-
-
-