Description
The mqtt helper needs to be modified to also indicate the device status. Now this reporting must be performed at. a regular interval and not state driven. If we do not get a new telemetry reading from the device or something else goes wrong we report an error code in the telemetry indicating to the cloud that the device is still online but something went wrong. This removes the need for a seperate status channel.
class ErrCodes(Enum):
NO_DOCUMENT = 0
payload = {
'err':ErrCodes.NO_DOCUMENT,
'TC': icb.tc,
'CC': icb.cc,
'OC': icb.oc,
'RH': icb.rh,
'TP': icb.tp,
'CP': icb.cp,
'OP': icb.op,
'TO': icb.to,
'time': icb.timestamp,
'exp_id': "-1",
'ttl': 0 if save_point else datetime.now(timezone.utc).timestamp() + 120,
'point_type': 1 if save_point else 0
}
Description
The mqtt helper needs to be modified to also indicate the device status. Now this reporting must be performed at. a regular interval and not state driven. If we do not get a new telemetry reading from the device or something else goes wrong we report an error code in the telemetry indicating to the cloud that the device is still online but something went wrong. This removes the need for a seperate status channel.