Skip to content

Commit

Permalink
Attempt network fix
Browse files Browse the repository at this point in the history
  • Loading branch information
alexwohlbruck committed May 17, 2022
1 parent a2e2eed commit 26baf6c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
3 changes: 2 additions & 1 deletion micro/app/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,5 @@ def start_server():
run_setup()
# run_startup()

return Server('www.projectcovalent.app', lamp_id)
return Server('www.projectcovalent.app', lamp_id)
# return Server('192.168.1.17:3000', lamp_id)
11 changes: 6 additions & 5 deletions micro/app/uwebsockets/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import urandom as random
import usocket as socket
from ucollections import namedtuple
import machine


# Opcodes
Expand Down Expand Up @@ -41,10 +42,9 @@ def urlparse(uri):
"""Parse ws:// URLs"""
try:
match = URL_RE.match(uri)
except:
print('Failed to parse URL')
return

except:
machine.reset()

if match:
protocol = match.group(1)
host = match.group(2)
Expand Down Expand Up @@ -246,4 +246,5 @@ def close(self, code=CLOSE_OK, reason=''):
def _close(self):
if __debug__: print("Connection closed")
self.open = False
self.sock.close()
self.sock.close()
machine.reset()
4 changes: 2 additions & 2 deletions server/routes/lamps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ router.post('/', isAuthenticated, async (req, res) => {
})

router.get('/:id/config', isAuthenticated, async (req, res) => {
// const config = await getLampConfig(req.params.id)
const config = {"deviceId":"4091519b56b8","readingLightColorTemperature":2001,"nightMode":false,"minimumLightLevel":0.8,"wifi":[{"ssid":"asu-visitor","password":""}],"brightness":0.5,"lampId":"626df507d6756882f166942c"}
const config = await getLampConfig(req.params.id)
// const config = {"deviceId":"4091519b56b8","readingLightColorTemperature":2001,"nightMode":false,"minimumLightLevel":0.8,"wifi":[{"ssid":"asu-visitor","password":""}],"brightness":0.5,"lampId":"626df507d6756882f166942c"}
return res.status(200).json(config)
})

Expand Down
2 changes: 1 addition & 1 deletion server/services/lamps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export const createLamp = async (
color: '#ff0000',
touching: false,
},
deviceData: deviceData,
deviceData,
group: new Types.ObjectId(group._id),
user: new Types.ObjectId(userId),
})
Expand Down

0 comments on commit 26baf6c

Please sign in to comment.