Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Node3Dvd Device Node example
# Only required for placeholder status function
import random
def TurnOn(arg = None):
print("Turning Dvd On")
print("Turning Dvd On function not yet implemented. Doing nothing...")
UpdateStatus();
def UpdateStatus(arg = None):
print('Dvd Status: Status requested')
print('UpdateStatus function not yet implemented, emiting random message...')
if(random.choice([True, False])):
message = {'message': 'ok'}
else:
message = {'message': 'not ok: randomly generated status is not okay...'}
lookup_local_event("DvdStatus").emit(message)
statusMetadata = {'Group': 'Status', 'schema':
{'title': '', 'type': 'array', 'items':
{'type': 'object', 'properties':
{
'message': {'type': 'string'},
}
}
}}
def main(arg = None):
print("Node started...")
create_local_action("TurnOn", TurnOn, None)
statusMetadata['schema']['title'] = 'DvdStatus'
create_local_event("DvdStatus", statusMetadata)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.