tritter / homebridge-brewer

Coffee brewer home bridge plugin
Apache License 2.0
22 stars 1 forks source link

Capsule count #1

Closed bubez81 closed 3 years ago

bubez81 commented 3 years ago

Superb idea, would it be possible to implement the capsule count?

tritter commented 3 years ago

Hi @bubez81, Yes I think it is possible, I just don't know hot to expose it into a valueble info in homekit. Do you have any ideas? Battery level? 🤗

DJay-X commented 3 years ago

@tritter Great project. Thanks for sharing with the community. Unfortunately I don't own a Nespresso but maybe you want to join our community on SmartApfel.de forum? https://forum.smartapfel.de/forum/thread/8205-homebridge-brewer-nespresso-kaffeemaschine/?postID=114134#post114134

People are always happy to help and share. Would love to see you there. 👍 Thanks again and have a good time.

bubez81 commented 3 years ago

Hi! The battery level could be perfect...and the descaling count...maybe alarm sensor for water and descaling? Like a smoke sensor

bubez81 commented 3 years ago

Ah and I want inform you that I have a "prodigio" and it works perfectly...only one thing, I haven't the americano and only water option, it's possible to select only the types of coffee that I can do?

tritter commented 3 years ago

Amazing! Great to hear that it works :) Yes I thought already about that feature! Will be much easier for now. Maybe switches for "no water" / "descaling" / "no cup" is an idea I need to try in a beta. I just wanted to get the initial version stable. I will let you know when something new is ready to test!

bubez81 commented 3 years ago

Perfect! Thank you!

tritter commented 3 years ago

@bubez81 Just added support to disable beverages (v1.1.0)! I'm working on the other updates too.

bubez81 commented 3 years ago

you are the best! Thank you, now I have to offer you an espresso ;)

tritter commented 3 years ago

Hi @bubez81,

I added a bit more than just the capsule count 😇 The new sensors are: Brewing Descealing Needed No Capsules No Water Slider Tray Error

Please try the beta, if everything is fine I will publish to master!

Just add the suffix to install: sudo npm install -g homebridge-brewer@beta

I use it already for some days, some fun use cases: Turn lights to blue when 'No Water opens' Turn lights on above the machine when 'Slider opens' Turn 'coffee ready sound' on when 'Brewing closes'

Ah the battery is also added too! Please make sure to set the capsule count beforehand by app. Because I need to be connected all day the App won't be able to connect whenever home bridge is running... Inside the home bridge config you need to define the 'max_capsule_count' (default 1000) Battery percentage is calculated by that, let's say you set in the app you still have 950 capsules (setup in the app), and you define max_capsule_count 1000, battery percentage will be 95% The no capsule sensor is only triggered when capsules are 0, but there is a battery warning too if less than 10%.

Have fun testing, Thom

bubez81 commented 3 years ago

Hi @tritter, awesome!! unfortunately i recieve this error: `==================== [5/27/2021, 8:08:59 AM] ERROR LOADING PLUGIN homebridge-brewer: [5/27/2021, 8:08:59 AM] Error: Cannot find module './native/binding' Require stack:

with the beta

tritter commented 3 years ago

@bubez81 Please try to remove your old plugin:

rm -rf /usr/local/lib/node_modules/homebridge-brewer

After that run: sudo npm install -g homebridge-brewer@beta

bubez81 commented 3 years ago

mmm strange, same error...

tritter commented 3 years ago

Hmm strange, I just checked on my homebridge Mac. Maybe your home bridge runs under your user so you shouldn't install it with sudo? So just npm install -g homebridge-brewer@beta? And how does your installation log look like? Any errors?

bubez81 commented 3 years ago

ok found the problem, npm install -g --unsafe-perm homebridge-brewer@beta is the right command to give, perfect!

bubez81 commented 3 years ago

ok think there are some problems, can't brew anymore and recieve this error? noble: unknown peripheral fcd4512b5b1440738381002dddc269cc, 06aa1920f22a11e39daa0002a5d5c51b, 06aa3a22f22a11e39daa0002a5d5c51b read!

tritter commented 3 years ago

Hmm could you try to toggle bluetooth? Could you send me the debug logs? enable -D in homebridge? Do you have more than one machine?? Homebridge Settings > Homebridge Debug Mode -D

bubez81 commented 3 years ago

no only one, ok let's try debugging

bubez81 commented 3 years ago

[5/27/2021, 9:34:13 AM] [Brewer] Set Characteristic On -> true [5/27/2021, 9:34:13 AM] [Brewer] Temperature is 0 [5/27/2021, 9:34:38 AM] [Brewer] [WATCH] Connected [5/27/2021, 9:35:38 AM] [Brewer] [WATCH] Connected [5/27/2021, 9:35:44 AM] [Brewer] Machine did disconnect! [5/27/2021, 9:35:54 AM] [Brewer] Disconnecting... [5/27/2021, 9:35:54 AM] [Brewer] Disconnecting... [5/27/2021, 9:35:54 AM] [Brewer] Bluetooth state:poweredOn [5/27/2021, 9:35:54 AM] [Brewer] Start scan... [5/27/2021, 9:35:57 AM] [Brewer] Connected to Prodigio_C385818C9BD7 [5/27/2021, 9:35:59 AM] [Brewer] Request reading states [5/27/2021, 9:35:59 AM] [Brewer] Start Authentication [5/27/2021, 9:35:59 AM] [Brewer] Token: 8e03f7136349c4fc [5/27/2021, 9:35:59 AM] [Brewer] Token buffer: 8e03f7136349c4fc [5/27/2021, 9:35:59 AM] [Brewer] Start subscribe status [5/27/2021, 9:35:59 AM] [Brewer] Found notify status characteristic {"uuid":"06aa3a12f22a11e39daa0002a5d5c51b","name":null,"type":null,"properties":["read","notify"]} [5/27/2021, 9:36:38 AM] [Brewer] [WATCH] Connected [5/27/2021, 9:37:38 AM] [Brewer] [WATCH] Connected [5/27/2021, 9:37:57 AM] [Brewer] Machine did disconnect! [5/27/2021, 9:38:07 AM] [Brewer] Disconnecting... [5/27/2021, 9:38:07 AM] [Brewer] Disconnecting... [5/27/2021, 9:38:07 AM] [Brewer] Bluetooth state:poweredOn [5/27/2021, 9:38:07 AM] [Brewer] Start scan... [5/27/2021, 9:38:07 AM] [Brewer] Connected to Prodigio_C385818C9BD7 [5/27/2021, 9:38:09 AM] [Brewer] Request reading states [5/27/2021, 9:38:09 AM] [Brewer] Start Authentication [5/27/2021, 9:38:09 AM] [Brewer] Token: 8e03f7136349c4fc [5/27/2021, 9:38:09 AM] [Brewer] Token buffer: 8e03f7136349c4fc [5/27/2021, 9:38:09 AM] [Brewer] Start subscribe status [5/27/2021, 9:38:09 AM] [Brewer] Found notify status characteristic {"uuid":"06aa3a12f22a11e39daa0002a5d5c51b","name":null,"type":null,"properties":["read","notify"]} [5/27/2021, 9:38:38 AM] [Brewer] [WATCH] Connected [5/27/2021, 9:39:38 AM] [Brewer] [WATCH] Connected [5/27/2021, 9:40:07 AM] [Brewer] Machine did disconnect! [5/27/2021, 9:40:17 AM] [Brewer] Disconnecting... [5/27/2021, 9:40:17 AM] [Brewer] Disconnecting... [5/27/2021, 9:40:17 AM] [Brewer] Bluetooth state:poweredOn [5/27/2021, 9:40:17 AM] [Brewer] Start scan... [5/27/2021, 9:40:18 AM] [Brewer] Connected to Prodigio_C385818C9BD7 [5/27/2021, 9:40:20 AM] [Brewer] Request reading states [5/27/2021, 9:40:20 AM] [Brewer] Start Authentication [5/27/2021, 9:40:20 AM] [Brewer] Token: 8e03f7136349c4fc [5/27/2021, 9:40:20 AM] [Brewer] Token buffer: 8e03f7136349c4fc [5/27/2021, 9:40:20 AM] [Brewer] Start subscribe status [5/27/2021, 9:40:20 AM] [Brewer] Found notify status characteristic {"uuid":"06aa3a12f22a11e39daa0002a5d5c51b","name":null,"type":null,"properties":["read","notify"]} [5/27/2021, 9:40:38 AM] [Brewer] [WATCH] Connected [5/27/2021, 9:41:39 AM] [Brewer] [WATCH] Connected [5/27/2021, 9:42:19 AM] [Brewer] Machine did disconnect! [5/27/2021, 9:42:29 AM] [Brewer] Disconnecting... [5/27/2021, 9:42:29 AM] [Brewer] Disconnecting... [5/27/2021, 9:42:29 AM] [Brewer] Bluetooth state:poweredOn [5/27/2021, 9:42:29 AM] [Brewer] Start scan... [5/27/2021, 9:42:34 AM] [Brewer] Connected to Prodigio_C385818C9BD7 [5/27/2021, 9:42:36 AM] [Brewer] Request reading states [5/27/2021, 9:42:36 AM] [Brewer] Start Authentication [5/27/2021, 9:42:36 AM] [Brewer] Token: 8e03f7136349c4fc [5/27/2021, 9:42:36 AM] [Brewer] Token buffer: 8e03f7136349c4fc [5/27/2021, 9:42:36 AM] [Brewer] Start subscribe status [5/27/2021, 9:42:36 AM] [Brewer] Found notify status characteristic {"uuid":"06aa3a12f22a11e39daa0002a5d5c51b","name":null,"type":null,"properties":["read","notify"]} [5/27/2021, 9:42:39 AM] [Brewer] [WATCH] Connected [5/27/2021, 9:42:49 AM] [Brewer] Received machine status change!, [5/27/2021, 9:42:49 AM] [Brewer] Ready:false, brewing:false, no water:false, tray error:false [5/27/2021, 9:43:17 AM] [Brewer] Machine did disconnect! [5/27/2021, 9:43:27 AM] [Brewer] Disconnecting... [5/27/2021, 9:43:27 AM] [Brewer] Disconnecting... [5/27/2021, 9:43:27 AM] [Brewer] Bluetooth state:poweredOn [5/27/2021, 9:43:27 AM] [Brewer] Start scan... [5/27/2021, 9:43:28 AM] [Brewer] Connected to Prodigio_C385818C9BD7 [5/27/2021, 9:43:30 AM] [Brewer] Request reading states [5/27/2021, 9:43:30 AM] [Brewer] Start Authentication [5/27/2021, 9:43:30 AM] [Brewer] Token: 8e03f7136349c4fc [5/27/2021, 9:43:30 AM] [Brewer] Token buffer: 8e03f7136349c4fc [5/27/2021, 9:43:30 AM] [Brewer] Start subscribe status [5/27/2021, 9:43:30 AM] [Brewer] Found notify status characteristic {"uuid":"06aa3a12f22a11e39daa0002a5d5c51b","name":null,"type":null,"properties":["read","notify"]} [5/27/2021, 9:43:39 AM] [Brewer] [WATCH] Connected [5/27/2021, 9:44:39 AM] [Brewer] [WATCH] Connected [5/27/2021, 9:45:28 AM] [Brewer] Machine did disconnect! [5/27/2021, 9:45:38 AM] [Brewer] Disconnecting... [5/27/2021, 9:45:38 AM] [Brewer] Disconnecting... [5/27/2021, 9:45:38 AM] [Brewer] Bluetooth state:poweredOn [5/27/2021, 9:45:38 AM] [Brewer] Start scan... [5/27/2021, 9:45:39 AM] [Brewer] [WATCH] Machine Prodigio_C385818C9BD7 disconnected, but reachable [5/27/2021, 9:45:42 AM] [Brewer] Connected to Prodigio_C385818C9BD7 [5/27/2021, 9:45:43 AM] [Brewer] Request reading states [5/27/2021, 9:45:43 AM] [Brewer] Start Authentication [5/27/2021, 9:45:43 AM] [Brewer] Token: 8e03f7136349c4fc [5/27/2021, 9:45:43 AM] [Brewer] Token buffer: 8e03f7136349c4fc [5/27/2021, 9:45:43 AM] [Brewer] Start subscribe status [5/27/2021, 9:45:43 AM] [Brewer] Found notify status characteristic {"uuid":"06aa3a12f22a11e39daa0002a5d5c51b","name":null,"type":null,"properties":["read","notify"]} [5/27/2021, 9:46:39 AM] [Brewer] [WATCH] Connected [5/27/2021, 9:47:39 AM] [Brewer] [WATCH] Connected [5/27/2021, 9:47:41 AM] [Brewer] Machine did disconnect! [5/27/2021, 9:47:51 AM] [Brewer] Disconnecting... [5/27/2021, 9:47:51 AM] [Brewer] Disconnecting... [5/27/2021, 9:47:51 AM] [Brewer] Bluetooth state:poweredOn [5/27/2021, 9:47:51 AM] [Brewer] Start scan... [5/27/2021, 9:48:38 AM] [Brewer] Get Characteristic On -> Promise { false } [5/27/2021, 9:48:38 AM] [Brewer] Get Characteristic On -> Promise { false } [5/27/2021, 9:48:38 AM] [Brewer] Get Characteristic On -> Promise { false } [5/27/2021, 9:48:39 AM] [Brewer] [WATCH] Machine Prodigio_C385818C9BD7 disconnected, but reachable

bubez81 commented 3 years ago

now the accessory doesn't respond

bubez81 commented 3 years ago

argh can't connect to the machine anymore: [Brewer] Device not connected! [5/27/2021, 10:06:48 AM] [Brewer] Device not connected! [5/27/2021, 10:06:48 AM] [Brewer] Device not connected! [Brewer] [WATCH] Machine Prodigio_C385818C9BD7 unreachable, still scanning

tritter commented 3 years ago

@bubez81 run again beta install, you should get homebridge-brewer@2.0.3-beta.0 I found the problem, because I fixed it for Raspberry I broke it on the Mac. Should work now, sorry for the cumbersome... And again every 2 min the machine disconnects this is by design, also after brewing it will disconnect by design. Thats why I also put those logs only in DEBUG. There is a new "reachability" feature which shows in HomeKit the unreachable state now too, whenever the machine is not discovered within 5min...

bubez81 commented 3 years ago

Sorry can't understand, now I receive this

[Brewer] [WATCH] Machine Prodigio_C385818C9BD7 unreachable, still scanning

And the accessory isn't reachable, have to wait 5?

tritter commented 3 years ago

Yes it may take some time... Sometimes it needs a second run but it should work now!

bubez81 commented 3 years ago

same message: [Brewer] [WATCH] Machine Prodigio_C385818C9BD7 unreachable, still scanning could be a bluetooth problem? from the Mac mini I can reach the machine I'm sure Schermata 2021-05-27 alle 11 25 21

tritter commented 3 years ago

Could you send a complete log? So it never connects again?

bubez81 commented 3 years ago

unbelievable, it no longer even connects with the stable version WTF??? Ok what log do you need?

bubez81 commented 3 years ago

[5/27/2021, 3:12:22 PM] [Brewer] Adding coffee type 0 [5/27/2021, 3:12:22 PM] [Brewer] Adding coffee type 1 [5/27/2021, 3:12:22 PM] [Brewer] Adding coffee type 2 [5/27/2021, 3:12:22 PM] [Brewer] Removing coffee type 5 [5/27/2021, 3:12:22 PM] [Brewer] Removing coffee type 4 [5/27/2021, 3:12:23 PM] [Brewer] Get Characteristic On -> Promise { false } [5/27/2021, 3:12:23 PM] [Brewer] Get Characteristic On -> Promise { false } [5/27/2021, 3:12:23 PM] [Brewer] Get Characteristic On -> Promise { false } [5/27/2021, 3:14:26 PM] [Brewer] Get Characteristic On -> Promise { false } [5/27/2021, 3:14:26 PM] [Brewer] Get Characteristic On -> Promise { false } [5/27/2021, 3:14:26 PM] [Brewer] Get Characteristic On -> Promise { false } [5/27/2021, 3:14:32 PM] [Brewer] Set Characteristic On -> true [5/27/2021, 3:14:32 PM] [Brewer] Temperature is 0 [5/27/2021, 3:14:32 PM] [Brewer] Start scan...

an idea..could be a permission problem? recently there was a macos update

bubez81 commented 3 years ago

ok solved with the latest version....in Preferences---Bluetooth I had to delete the Prodigio device, now:

Writing brew Espresso - Medium command [5/27/2021, 3:43:28 PM] [Brewer] Write characteristics:{"uuid":"06aa3a42f22a11e39daa0002a5d5c51b","name":null,"type":null,"properties":["write"]} [5/27/2021, 3:43:28 PM] [Brewer] Sending buffer: 03050704000000000001 [5/27/2021, 3:43:28 PM] [Brewer] Received response: 8305012080800000000000000000000000000000 true [5/27/2021, 3:43:28 PM] [Brewer] Response [object Object] [5/27/2021, 3:43:28 PM] [Brewer] Received response! [5/27/2021, 3:43:28 PM] [Brewer] Received response true [5/27/2021, 3:43:28 PM] [Brewer] Successfully brewed!

let's try with the beta

bubez81 commented 3 years ago

yatta! [5/27/2021, 3:46:13 PM] [Brewer] Found notify slider characteristic {"uuid":"06aa3a22f22a11e39daa0002a5d5c51b","name":null,"type":null,"properties":["read","write","notify"]} [5/27/2021, 3:46:13 PM] [Brewer] New notify true [5/27/2021, 3:46:13 PM] [Brewer] Start subscribe capsule counter [5/27/2021, 3:46:13 PM] [Brewer] Found capsule count characteristic {"uuid":"06aa3a15f22a11e39daa0002a5d5c51b","name":null,"type":null,"properties":["read","write","notify"]} [5/27/2021, 3:46:13 PM] [Brewer] New notify true [5/27/2021, 3:46:13 PM] [Brewer] Start subscribe response [5/27/2021, 3:46:13 PM] [Brewer] Found response characteristic {"uuid":"06aa3a52f22a11e39daa0002a5d5c51b","name":null,"type":null,"properties":["read","notify"]} [5/27/2021, 3:46:14 PM] [Brewer] New notify true [5/27/2021, 3:46:14 PM] [Brewer] Request reading states [5/27/2021, 3:46:14 PM] [Brewer] Received machine status change!, 4002068b00000ed0 [5/27/2021, 3:46:14 PM] [Brewer] Ready:true, brewing:false, no water:false, tray error:false [5/27/2021, 3:46:14 PM] [Brewer] Received capsule count change! 0034 [5/27/2021, 3:46:14 PM] [Brewer] Capsule counter:enabled capsules left:52 [5/27/2021, 3:46:14 PM] [Brewer] max_capsule_count not configured using 1000 [5/27/2021, 3:46:14 PM] [Brewer] Percentage 5 [5/27/2021, 3:46:14 PM] [Brewer] Received slider status change! 02 [5/27/2021, 3:46:14 PM] [Brewer] Slider:closed [5/27/2021, 3:46:23 PM] [Brewer] [WATCH] Connected

bubez81 commented 3 years ago

ok seems to work very well, but the tray error sensor I think refers to a full capsule container

tritter commented 3 years ago

@bubez81 Good to hear after the initial problems 👍 Yes it is tray == container, it can be an error or full. So Tray Error was the shortest description I came up with. Do you have any name suggestion? I think its called a "drip tray" officially https://www.nespresso.com/us/en/machine-assistance#!/Expert/instructions/emptying-the-system/guide

bubez81 commented 3 years ago

The drip tray is the container for drops, the name is fine for me then...could the plug-in be faster now? it seems like a flash to me

tritter commented 3 years ago

Yes because it's constantly connected. That was the difficult part... In v1.0 it only connects to brew. Now it's connected all the time to get change of states like slider and if the coffee is ready etc.

bubez81 commented 3 years ago

Excellent work

tritter commented 3 years ago

Thanks a lot! :) Merged to master now! Will close this ticket for now. Dreaming of 'custom recipes' as next feature ;-)