relm923 / MMM-Roomba

Roomba980 module for the Magic Mirror.
MIT License
10 stars 5 forks source link

No response from Dorita/Roomba, loading forever #4

Closed FrankBlackMG closed 3 years ago

FrankBlackMG commented 5 years ago

I was able to successfully retrieve the BLID and Password from my 960 but any other operations return nothing e.g. retrieving battery percentage or weekly schedule. The module just displays loading forever. In fact, my Pi Zero eventually needs to be rebooted. Any debugging suggestions?

fallenbuddhist commented 4 years ago

Same issue on my 980

relm923 commented 4 years ago

I recently updated the dorita980 dependency to pull in some new devices and various fixes. Can you update and try again? If that doesn't work can you check the MagicMirror logs for any additional information?

fallenbuddhist commented 4 years ago

I recently updated the dorita980 dependency to pull in some new devices and various fixes. Can you update and try again? If that doesn't work can you check the MagicMirror logs for any additional information?

Thanks for the update, but it's still stuck on "Loading..." under the header for me. I did a fresh MMM-Roomba install from the beginning, re-checked my un, pw, and ip (still correct). Still stuck on "Loading..."

I can get Dorita commands to work like starting my Roomba through MM. How/what logs would you need to see to further troubleshoot?

relm923 commented 4 years ago

MagicMirror manages the logs for all plugins. Depending how you start MagicMirror you'll access the logs in different ways

ChristianThingKnudsen commented 3 years ago

I have a Roomba 976 and im also stuck at loading... I have doubled checked username, pw and ip and tried to run the fix: "ROBOT_CIPHERS=AES128-SHA npm start" but doesn't seem to fix the problem. Help would be very appriciated

relm923 commented 3 years ago

@ChristianThingKnudsen are you able to locate the logs for the module?

ChristianThingKnudsen commented 3 years ago

@relm923 Yes. But the only thing I can see in the log when running in dev mode is the: "Starting module: MMM-Roomba". I also placed a console.log(self) in the getDom() function. This function looks like it's only being called once and retruns an object where the property loaded is false

relm923 commented 3 years ago

I can improve the error logging in the future but for now can you try adding

self.sendSocketNotification(
  'ERROR',
  `Failed to connect to robot. IP: ${ipAddress}. Error: ${err}`
);

here - https://github.com/relm923/MMM-Roomba/blob/master/node_helper.js#L73

ChristianThingKnudsen commented 3 years ago

Thank you @relm923 for the suggestion. Unfortunately it doesn't seem like the function updateStats is getting called when i look in my log

relm923 commented 3 years ago

@ChristianThingKnudsen lets first ensure we can talk to your Roomba at all (without MagicMirror)

In the MMM-Roomba directory create a new file called debug.js and add:

const Dorita980 = require('dorita980');

// Copied from your config
const username = '__YOUR_USERNAME__';
const password = '__YOUR_PASSWORD__';
const ipAddress = '__YOUR_ADDRESS__';

const test = async () => {
  console.log(`Connecting`);
  const roomba = new Dorita980.Local(username, password, ipAddress);

  console.log(`Fetching Robot State`);
  const { name } = await roomba.getRobotState(['name']);

  console.log(`Name: ${name}`);

  console.log(`Disconnecting`);
  roomba.end();
};

test();

then run node debug.js.

This should print out the name of your Roomba. If that works we can debug MagicMirror. If not we can debug the Roomba

ChristianThingKnudsen commented 3 years ago

@relm923 I'm stuck on Fetching Robot State. I am also using a homebridge plugin for my roomba, which is using the dorita980 repo. Before i was able to get my username and pw using the npm run getpassword <robotIP> but now i just get a connection error. So maybe the error is caused by having two instances of dorita980 trying to fetch data from the same robot?

relm923 commented 3 years ago

@ChristianThingKnudsen that will likely be the problem. Can you try disabling the Homebridge plugin for a bit to verify?

Unfortunately Roomba doesn't seem to support multiple connections to a robot at the same time. My module attempts to work around this by only connecting (and disconnecting) when it's actively polling for new information. If the Homebridge plugin maintains a constant connection nothing else will be able to ping the robot

ChristianThingKnudsen commented 3 years ago

Homebridge seems to be the issue, so you are welcome to close this issue

fischbear commented 1 year ago

Hey :-) I got the same problem, but no homebridge! I startet your debu.js an get the following message:

Connecting Fetching Robot State /home/pi/MagicMirror/modules/MMM-Roomba/node_modules/dorita980/lib/v2/local.js:33 throw e; ^

Error: Connection refused: Not authorized at MqttClient._handleConnack (/home/pi/MagicMirror/modules/MMM-Roomba/node_modules/mqtt/lib/client.js:920:15) at MqttClient._handlePacket (/home/pi/MagicMirror/modules/MMM-Roomba/node_modules/mqtt/lib/client.js:350:12) at work (/home/pi/MagicMirror/modules/MMM-Roomba/node_modules/mqtt/lib/client.js:292:12) at Writable.writable._write (/home/pi/MagicMirror/modules/MMM-Roomba/node_modules/mqtt/lib/client.js:302:5) at doWrite (/home/pi/MagicMirror/modules/MMM-Roomba/node_modules/readable-stream/lib/_stream_writable.js:428:64) at writeOrBuffer (/home/pi/MagicMirror/modules/MMM-Roomba/node_modules/readable-stream/lib/_stream_writable.js:417:5) at Writable.write (/home/pi/MagicMirror/modules/MMM-Roomba/node_modules/readable-stream/lib/_stream_writable.js:334:11) at TLSSocket.ondata (node:internal/streams/readable:754:22) at TLSSocket.emit (node:events:513:28) at addChunk (node:internal/streams/readable:315:12) at readableAddChunk (node:internal/streams/readable:289:9) at TLSSocket.Readable.push (node:internal/streams/readable:228:10) at TLSWrap.onStreamRead (node:internal/stream_base_commons:190:23) { code: 5

fischbear commented 1 year ago

ahhh with the blid as USername i get:

Connecting Fetching Robot State Name: Roomba Disconnecting

But at the display still "Loading"