Readonly
componentSensor component type
Optional
deviceInformation about the device this sensor belongs to
Optional
deviceSets the class of the device, changing the device state and icon that is displayed on the frontend.
Optional
enabledFlag which defines if the entity should be enabled when first added.
Optional
entityClassification of a non-primary entity.
Optional
expireIf set, it defines the number of seconds after the sensor’s state expires, if it’s not updated. After expiry, the sensor’s state becomes unavailable. Default the sensors state never expires.
Optional
forceSends update events even if the value hasn’t changed. Useful if you want to have meaningful value graphs in history.
Optional
iconIcon of the entity
Optional
lastDefines a template to extract the last_reset. When last_reset_value_template is set, the state_class option must be total. Available variables: entity_id. The entity_id can be used to reference the entity’s attributes.
Name of the sensor inside Home Assistant
Optional
objectSet this to generate the entity_id
in HA instead of using name
Optional
qosThe maximum QoS level to be used when receiving messages.
Optional
stateDefines the type of state. If not None, the sensor is assumed to be numerical and will be displayed as a line-chart in the frontend instead of as discrete values.
Optional
suggestedThe number of decimals which should be used in the sensor’s state after rounding.
Optional
uniqueSet this to enable editing sensor from the HA ui and to integrate with a device
Optional
unitDefines the units of measurement of the sensor, if any.
Optional
valueDefines a template to extract the value. If the template throws an error, the current state will be used instead.
Generates a JSON object that can be used as an MQTT payload.
Protected
propertyMapping of class properties to MQTT payload keys.
Static
createStatic
wholeValidates that uniqueId
is set if device
is provided.
Sensor specific information