StateMachine now supports attributes for states
This commit is contained in:
1 parent
c1819e19a4
commit
66d432d0a2
4 files changed
+38
-19
No files matched your search
@@ -110,7 +110,7 @@ class RequestHandler(BaseHTTPRequestHandler):
|
||||
|
||||
write(("<table><tr>"
|
||||
"<th>Name</th><th>State</th>"
|
||||
"<th>Last Changed</th></tr>"))
|
||||
"<th>Last Changed</th><th>Attributes</th></tr>"))
|
||||
|
||||
for category in \
|
||||
sorted(self.server.statemachine.categories,
|
||||
@@ -120,9 +120,17 @@ class RequestHandler(BaseHTTPRequestHandler):
|
||||
|
||||
state = self.server.statemachine.get_state(category)
|
||||
|
||||
write("<tr><td>{}</td><td>{}</td><td>{}</td></tr>".
|
||||
format(category, state.state,
|
||||
util.datetime_to_str(state.last_changed)))
|
||||
attributes = "<br>".join(
|
||||
["{}: {}".format(attr, state.attributes[attr])
|
||||
for attr in state.attributes])
|
||||
|
||||
write(("<tr>"
|
||||
"<td>{}</td><td>{}</td><td>{}</td><td>{}</td>"
|
||||
"</tr>").
|
||||
format(category,
|
||||
state.state,
|
||||
util.datetime_to_str(state.last_changed),
|
||||
attributes))
|
||||
|
||||
write("</table>")
|
||||
|
||||
|
||||
Reference in new issue
Block a user