2024-05-06 15:00:19 +02:00
|
|
|
# This is a bare-minimum telemetry plugin
|
|
|
|
# example that you can build upon to
|
|
|
|
# implement your own telemetry plugins.
|
|
|
|
|
2024-03-26 00:29:49 +01:00
|
|
|
import RNS
|
|
|
|
|
|
|
|
class BasicTelemetryPlugin(SidebandTelemetryPlugin):
|
|
|
|
plugin_name = "telemetry_example"
|
|
|
|
|
|
|
|
def start(self):
|
|
|
|
# Do any initialisation work here
|
|
|
|
RNS.log("Basic telemetry plugin example starting...")
|
|
|
|
|
|
|
|
# And finally call start on superclass
|
|
|
|
super().start()
|
|
|
|
|
|
|
|
def stop(self):
|
|
|
|
# Do any teardown work here
|
|
|
|
pass
|
|
|
|
|
|
|
|
# And finally call stop on superclass
|
|
|
|
super().stop()
|
|
|
|
|
|
|
|
def update_telemetry(self, telemeter):
|
|
|
|
if telemeter != None:
|
|
|
|
RNS.log("Updating power sensors")
|
|
|
|
telemeter.synthesize("power_consumption")
|
|
|
|
telemeter.sensors["power_consumption"].update_consumer(2163.15, type_label="Heater consumption")
|
|
|
|
telemeter.sensors["power_consumption"].update_consumer(12.7/1e6, type_label="Receiver consumption")
|
|
|
|
telemeter.sensors["power_consumption"].update_consumer(0.055, type_label="LED consumption")
|
|
|
|
telemeter.sensors["power_consumption"].update_consumer(982.22*1e9, type_label="Smelter consumption")
|
|
|
|
|
|
|
|
telemeter.synthesize("power_production")
|
|
|
|
telemeter.sensors["power_production"].update_producer(5732.15, type_label="Solar production")
|
|
|
|
|
|
|
|
# Finally, tell Sideband what class in this
|
|
|
|
# file is the actual plugin class.
|
|
|
|
plugin_class = BasicTelemetryPlugin
|