Skip to content

Commit 1250f4d

Browse files
committed
Simplified example
1 parent 7c94278 commit 1250f4d

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

examples/simple_thing.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,17 +89,14 @@ def get(self):
8989
return my_component.magic_denoise
9090

9191
# Main function to handle POST requests (write)
92-
def post(self, body):
92+
def post(self, new_property_value):
9393
"""Change the current magic_denoise value"""
9494

9595
# Find our attached component
9696
my_component = find_component("org.labthings.example.mycomponent")
9797

98-
# Get the new value out of the request body
99-
new_value = body
100-
10198
# Apply the new value
102-
my_component.magic_denoise = new_value
99+
my_component.magic_denoise = new_property_value
103100

104101
return my_component.magic_denoise
105102

@@ -110,9 +107,8 @@ def post(self, body):
110107

111108

112109
@ThingProperty
110+
@PropertySchema(fields.List(fields.Float()))
113111
class QuickDataProperty(View):
114-
# Output will be a list of floats
115-
@marshal_with(fields.List(fields.Float()))
116112
# Main function to handle GET requests
117113
def get(self):
118114
"""Show the current data value"""

0 commit comments

Comments
 (0)