gleeds / cloudbbq

A Bluetooth to MQTT bridge for the Tenergy Solis Digital Meat Thermometer and other similar devices.
MIT License
45 stars 12 forks source link

project won't start as it complains that it needs notifications property #7

Closed mph070770 closed 4 years ago

mph070770 commented 4 years ago

Thanks for the code. I'm having difficulty running it on OSX, with the following:

node -v v8.17.0

npm -v 6.13.4

I don't have a notifications section in my config file (as I don't want google integration) but it seems to be expecting it? This is the error:

iMac-Pro--Home:cloudbbq mh$ npm start

cloudbbq@1.0.0 start /Users/mh/cloudbbq/cloudbbq node app.js

/Users/mh/cloudbbq/cloudbbq/node_modules/config/lib/config.js:203 throw new Error('Configuration property "' + property + '" is not defined'); ^

Error: Configuration property "notifications" is not defined at Config.get (/Users/mh/cloudbbq/cloudbbq/node_modules/config/lib/config.js:203:11) at Object. (/Users/mh/cloudbbq/cloudbbq/app.js:11:33) at Module._compile (module.js:653:30) at Object.Module._extensions..js (module.js:664:10) at Module.load (module.js:566:32) at tryModuleLoad (module.js:506:12) at Function.Module._load (module.js:498:3) at Function.Module.runMain (module.js:694:10) at startup (bootstrap_node.js:204:16) at bootstrap_node.js:625:3 npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! cloudbbq@1.0.0 start: node app.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the cloudbbq@1.0.0 start script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! /Users/mh/.npm/_logs/2020-03-14T23_46_43_209Z-debug.log

Any ideas?

gleeds commented 4 years ago

I think it's expecting your config file to have the notification section, but if you don't want them, you just leave "enabled":false in there like in the sample config https://github.com/gleeds/cloudbbq/blob/master/config/default.json

If it doesn't work with that section there, let me know.

mph070770 commented 4 years ago

Thanks Greg. I think the code may be ignoring the false flag. I've taken the default file (without my adafruit edits) and tried that, and it complains that I don't have a client_secret_abcd.json module even though it shouldn't need one.

iMac-Pro--Home:cloudbbq mh$ npm start

> cloudbbq@1.0.0 start /Users/mh/cloudbbq/cloudbbq
> node app.js

module.js:550
    throw err;
    ^

Error: Cannot find module '/Users/mh/cloudbbq/cloudbbq/config/client_secret_abcd.json'
    at Function.Module._resolveFilename (module.js:548:15)
    at Function.Module._load (module.js:475:25)
    at Module.require (module.js:597:17)
    at require (internal/module.js:11:18)
    at new Auth (/Users/mh/cloudbbq/cloudbbq/node_modules/google-assistant/components/auth.js:26:15)
    at new GoogleAssistant (/Users/mh/cloudbbq/cloudbbq/node_modules/google-assistant/index.js:21:16)
    at Object.<anonymous> (/Users/mh/cloudbbq/cloudbbq/app.js:43:19)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)

I don't know node but I'll try and work out why. Any help would be appreciated!

gleeds commented 4 years ago

Out of curiosity, what version of MacOS are you on? I've not tried to run this on Mac since upgrading to Catalina (I run it on a raspberry pi for my personal use) and now I'm having weird bluetooth issues on Mac that seem to be related to the bluetooth library for node, noble and it is abandoned without great replacements.

I fixed your particularly issue, but can't successfully test it on MacOS. I'll continue to poke around and see if I can get this working.

mph070770 commented 4 years ago

Yes - catalina - and I experienced the same problem as you - the BT wouldn't connect.

I swapped to a Rpi (my chosen platform too) and after taking all reference to Google out of your app.js, I managed to get it working! The io.adafruit dashboard and your SW works really well - thanks for posting this code.

My last query - the range of the BLE on the Pi to the thermostat seems poor. I get frequent lost connections. Do you experience this?

Thanks

gleeds commented 4 years ago

For me, it's so-so. I keep my Pi 3 right inside the back door, and my smoker is about 18' away and goes through an exterior wall. I do sometimes have connection problems initially, which can be helped by repositioning the probe module. But once it connects, I find it usually stays connected.

Another oddity is that if I leave it running indefinitely, but disconnected, the app eventually crashes for no clear reason. I think there might be some memory leak in the bluetooth stack somewhere, but it takes days, not hours to do so, so it's not really a worry, it just means I can't have the app be an always on server.

nate922 commented 4 years ago

Yes - catalina - and I experienced the same problem as you - the BT wouldn't connect.

I swapped to a Rpi (my chosen platform too) and after taking all reference to Google out of your app.js, I managed to get it working! The io.adafruit dashboard and your SW works really well - thanks for posting this code.

My last query - the range of the BLE on the Pi to the thermostat seems poor. I get frequent lost connections. Do you experience this?

Thanks

Hi guys,

What BT adapters are you guys using ? I'm thinking of getting one with an antenna to help out with the range.

Also, I have also been trying to get it to work but i'm getting errors in reference to google. Any chance you could share the apps.js?

Thanks

gleeds commented 4 years ago

I've got a fix for the no google settings errors that I can push tonight.

I've had luck with the Pi3's built in Bluetooth, but occasionally I have to reposition the probe box to get it to connect initially, then I can move the box and it seems to stay connected. Also, I've found that it seems to work better if the box is magnet stuck to the side of my smoker's pellet hopper, with the screen facing the Pi, rather than resting flat on top.

gleeds commented 4 years ago

If anyone tries an external antenna, I'd caution to make sure you buy one that supports Bluetooth LE, because I think some of the cheaper ones might not. Also, I think some of those no name bluetooth usb dongles have fake antennas.

gleeds commented 4 years ago

Or this hardcore solution: https://dorkbotpdx.org/blog/wramsdell/external_antenna_modifications_for_the_raspberry_pi_3/

nate922 commented 4 years ago

Wow, thanks so much Greg.

Really liking that external mod to the Pi, will look into it.

Just a quick question, does the syntax below look right for a local mqtt connection?

"mqtt": {
    "username" : "xx",
    "password":"xx",
    "protocol":"mqtt",
    "url":"192.168.1.1:1883",
nate922 commented 4 years ago

Also, are you aware of the igrill code? It's doesn't support our thermostat but we could modify it by adding in the autoPairKey keys etc.

https://github.com/bendikwa/igrill

Thank you.

gleeds commented 4 years ago

@nate922 , your config looks almost right except it's "key" not "password". Also, at least for Adafruit, it's expecting mqtts, but that's up to the service you are using. See the Adafruit snipit on the Readme.

I've not looked at the igrill before now, but a cursory look seems to be doing the same initial handshake. I got my key by decompiling the Android APK for the tenergy.

I'm going to close this ticket but feel free to reopen if the code I just pushed into master doesn't fix it.