You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using the following test page to get a list of my accessories (I have many, and they are all visible in the HOOBS desktop app's Accessories menu), but the response from the plugin is: {"topic":"accessories","payload":{}}. I was expecting to see a list of accessories in that payload. Am I doing something wrong?
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>WebSocket Client</title>
</head>
<body>
<button onclick="connectWebSocket()">Connect and Send Message</button>
<div id="output"></div>
<script>
function connectWebSocket() {
const outputDiv = document.getElementById('output');
// Create a new WebSocket connection
const socket = new WebSocket('ws://hoobs.local:4050');
socket.onopen = () => {
console.log('WebSocket is connected');
// Send the message once the connection is established
socket.send(JSON.stringify({
"topic": "get",
"payload": {
"name": "all"
}
}));
};
socket.onerror = (error) => {
outputDiv.innerHTML = 'Error occurred: ' + JSON.stringify(error);
};
socket.onmessage = (event) => {
outputDiv.innerHTML = 'Received: ' + event.data;
};
socket.onclose = () => {
console.log('WebSocket is closed');
};
}
</script>
</body>
</html>
The text was updated successfully, but these errors were encountered:
Sorry, I just noticed the note about needing to add the accessories first. It would be helpful if this was mentioned directly in the get and add examples. Now I'm trying to add my accessories (I got the list via http://hoobs.local:51826/accessories - would be nice if homebridge-websocket used this when possible) but it doesn't seem to be working. Does this look correct?:
WebSocket sent [{"topic":"add","payload":{"name":"Master Bath Motion","service":"MotionSensor"}}]
Received: {"topic":"response","payload":{"ack":false,"message":"topic 'undefined' unknown."}}
I'm using the following test page to get a list of my accessories (I have many, and they are all visible in the HOOBS desktop app's Accessories menu), but the response from the plugin is: {"topic":"accessories","payload":{}}. I was expecting to see a list of accessories in that payload. Am I doing something wrong?
The text was updated successfully, but these errors were encountered: