LegacyStats class

The $stats attribute got removed from homie 3.0.1 to 4.0. Adding this extension enables you to send stats just as you would have in homie versions lower 4.0.

Inheritance

Constructors

LegacyStats({@required int statsIntervall, DeviceStats stats })
Stats about a device are peroidically published. With this extension, this happens automatically. As long as the Device.deviceState of the Device this extension is added to is DeviceState.ready the stats will be published every statsIntervall seconds. This value must not be null and greater than 0. The stats give information about the device. You can preconfigure the stats with custom initial values and pass them here. If the stats are null, a new DeviceStats object will be created. In this case, the uptime of Device objects using this extension object will be counted since creation of this extension object.

Properties

deviceStats DeviceStats
The stats of this device are periodically published to the mqtt broker. The stats can be accessed and modified.
read-only
extensionId → String
The id of this extension.
read-only, override
homieVersions → List<String>
The homie versions this extension supports.
read-only, override
statsIntervall → int
The intervall in seconds the deviceStats are published, as long as the Device.deviceState is DeviceState.ready.
final
version → String
The version of this extension.
read-only, override
extensionsEntry → String
The string that identifies this extension in a the extension topic of a Device.
read-only, inherited
hashCode → int
The hash code for this object.
read-only, inherited
runtimeType → Type
A representation of the runtime type of the object.
read-only, inherited

Methods

onStateChange(Device device, DeviceState state) → Future<Null>
Called when a device is asked to change its state. The state parameter describes which state the device is going to be, but calling device.deviceState will return the state the device is currently in. This means that before this method returns state != device.deviceState. This is usefull, since you not only know wich state is going to be the next, but also know from which state you are going there. The only exception is when this method is called during Device.init, here state == device.deviceState == DeviceState.init. When this method is called, the new state WAS ALREADY published to the broker, even though not updated in the device object. When this method is called during device.init, alle device attributes, as well as all nodes and porperties have already been published, too.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
publish(HomieTopic<Extension> base, String topic, [ String content, [ bool retained = true, int qos ]) → Future<Null>
Uses base to publish content (utf8 encoded) to topic. By default published messages are retained.
inherited
toString() → String
Returns a string representation of this object.
inherited

Operators

operator ==(dynamic other) → bool
The equality operator.
inherited