Spaces:
Sleeping
Sleeping
pls work now
Browse files
app.py
CHANGED
@@ -113,21 +113,22 @@ elif st.session_state.selected_command == "control/gripper":
|
|
113 |
|
114 |
with st.form("mqtt_form"):
|
115 |
if st.form_submit_button("Send Command"):
|
116 |
-
client
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
|
|
125 |
|
126 |
payload = {"command": st.session_state.selected_command, "args": args}
|
127 |
st.markdown("### Payload")
|
128 |
st.write(payload)
|
129 |
|
130 |
-
response = publish_and_wait(client, DEVICE_ID, payload)
|
131 |
st.markdown("### Response")
|
132 |
if response is not None:
|
133 |
if "image" in response:
|
|
|
113 |
|
114 |
with st.form("mqtt_form"):
|
115 |
if st.form_submit_button("Send Command"):
|
116 |
+
if "client" not in st.session_state:
|
117 |
+
st.session_state.client = create_paho_client()
|
118 |
+
setup_paho_client(
|
119 |
+
st.session_state.client,
|
120 |
+
HIVEMQ_USERNAME,
|
121 |
+
HIVEMQ_PASSWORD,
|
122 |
+
HIVEMQ_HOST,
|
123 |
+
PORT,
|
124 |
+
DEVICE_ID
|
125 |
+
)
|
126 |
|
127 |
payload = {"command": st.session_state.selected_command, "args": args}
|
128 |
st.markdown("### Payload")
|
129 |
st.write(payload)
|
130 |
|
131 |
+
response = publish_and_wait(st.session_state.client, DEVICE_ID, payload)
|
132 |
st.markdown("### Response")
|
133 |
if response is not None:
|
134 |
if "image" in response:
|