-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sample for enabling/disabling hardware sensors. #71
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a great sample! Thanks for providing this. I have a couple of minor comments.
# Below is what the payload should look like: | ||
payload_template = [ | ||
{'HardwareInfoID': int, 'HardwareCategoryStatusID': int, 'UniqueName': str}, | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These 3 lines should be prefixed with #
to make them part of the comment. We don't want to actually create payload_template
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good Suggestion. Commented out these lines.
"SELECT NodeID, IPAddress " | ||
"FROM Orion.Nodes " | ||
f"WHERE IPAddress = '{ip_address}' " | ||
)['results'][0]['NodeID'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be useful to add a comment to explain that this sample assumes this query will return exactly one matching record.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good Suggestion. Added a comment to clarify.
The payload for the verbs (Enable|Disable)Sensors was not straightforward. I spent a lot of time trolling thwack and swagger, trying to figure out how to format the payload to be used with orionsdk-python. Now that I have figured it out, I believe this information could be helpful to someone else.