Skip to content

Error Codes in Telemetry #4

Description

@ztnel

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
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions