Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cgateweb goes to sleep #29

Open
garethcook opened this issue Jan 8, 2022 · 5 comments
Open

cgateweb goes to sleep #29

garethcook opened this issue Jan 8, 2022 · 5 comments

Comments

@garethcook
Copy link

garethcook commented Jan 8, 2022

I'm running cgate and cgateweb on a Pi 3, nothing else, to surface mqtt to Home Assistant on another Pi. When it works, it works very well and responsive.

What we're seeing tho is that it's an unreliable solution, and I'm trying to understand why, and testing would suggest it's cgateweb not talking to cgate on the same machine. The address is listed as 127.0.0.1

When the system is unresponsive, I'm seeing no read MQTT traffic using mqttexplorer from cgateweb. At the same time, I can from a Windows PC happily talk to cgate on the Pi so we know the transport from the CNI to cgate is working as expected. A quick restart of cgateweb gets things going again. I can write MQTT traffic back.

In summary : more often than not, cgateweb isn't reporting CBUS changes (such as a light being turned on), but can continue to write changes (so it can tell a light to turn on).

Is there a way of debugging the link between cgateweb and cgate better to understand where the break happens? Thanks

@the1laz
Copy link
Owner

the1laz commented Jan 9, 2022

Probably the way to start would be to change logging to true in settings.J's, then check the output on journalctl -u cgateweb.service

You should be able to see the commands you're sending and the feedback from cgate.

@garethcook
Copy link
Author

garethcook commented Jan 19, 2022

So I stopped using that Pi, it was also running Home Bridge. Having started with a fresh blank Pi, I'm finding that the mqtt code isn't being found.

Steps are:
Install Raspbian Lite
Apt get update and upgrade
Sudo su
curl -fsSL https://deb.nodesource.com/setup_17.x | bash -
sudo apt install nodejs
(it's not installed by default)
sudo apt install git
sudo npm install
sudo npm audit fix --force

Then test cgateweb can even run before we configure setting.js:
cd /usr/local/bin/cgateweb
node index.js
(Complains mqtt isn’t a function at this point - node index.js won’t run) TypeError: mqtt.createClient is not a function
So something's missing. I've tried installing npm mqtt, installing different versions of node and npm, but not getting very far :-(

@garethcook
Copy link
Author

I think the culprit is actually cgate. I'll be back with more.

@awonglk
Copy link

awonglk commented Mar 18, 2022

I get that "TypeError: mqtt.createClient" when I use a newer version of MQTT. This "upgrade" of MQTT version happened as NPM was warning about "severe vulnerability".
So i guess for that error to go away, you'll need to downgrade MQTT version to the one expected in package.json

@rbswift
Copy link

rbswift commented Jul 11, 2022

I get that "TypeError: mqtt.createClient" when I use a newer version of MQTT. This "upgrade" of MQTT version happened as NPM was warning about "severe vulnerability".
So i guess for that error to go away, you'll need to downgrade MQTT version to the one expected in package.json

This is fixed in my branch / PR.

There's also a PR to periodically send a heartbeat NoOp which I've added to my branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants