Nespresso Integration

For android method, you sometimes need to restart your phone to get BT log created (was my case). If ios and android does not work for you I’m sorry but won’t be able to help you at all.
Try to find how to debug BT on your specific device.

Well after 2 hour sleep and many changes in android I was able to retreive the key.

lets see how the component works. One thing I noticed. When starting home assistant i need to have the nespresso really close to raspberry pi in order not to get errors.

Good and bad news on this case.
At least you can start how it works and hope a morning coffee automations.

Hi,

Just to give you feedback. The component works, never the less I have a problem related to the distance between my raspberry and nespresso. Maybe this is not the perfect solution for me!.
I will try to investigate a solution based on ans ESP32.

I get a lot of these errors: Timed out connecting to d3:5b:af:9d:f7:a2 after 5.0 seconds

@tikismoke Would it be possible to increase the timeout let’s say to 15 seconds?

Will look but I think it’s in pygatt.
Look at the brewbutton project on GitHub that is what I’m based on. It’s esp made.

Also note that I use a BT dongle and a nearer pi for this one Wich is just <1.5m of the machine.

This one looks more promissing:

Just don’t know where to start!

Hello, a little update… the component works on hassos too (see GitHub).
this is my card:

elements:
  - icon: 'mdi:home'
    service: nespresso.coffee
    service_data:
      mac: 'c3:85:81:8c:9b:d7'
    show_icon: true
    show_name: false
    style:
      icon: 'mdi:coffee-maker'
      left: 50%
      top: 95%
    title: Prepara il caffè
    type: service-button
  - entity: sensor.prodigio_c385818c9b_caps_number
    style:
      color: 'rgba(255,255,255,1)'
      font-size: 12px
      line-height: 32px
      margin: 1px 35px
      pointer-events: none
      right: 0
      text-shadow: 'rgba(0, 0, 0, 0.8) 0px 0px 2px'
      top: 0
      transform: initial
    type: state-label
  - entity: sensor.prodigio_c385818c9b_caps_number
    icon: 'mdi:pill'
    style:
      '--paper-item-icon-color': 'rgb(255,255,255)'
      color: 'rgba(255,255,255,1)'
      line-height: 32px
      margin: 3px 5px 0 0
      pointer-events: none
      right: 0
      top: 0
      transform: scale(0.8)
    type: state-icon
  - entity: sensor.prodigio_c385818c9b_tray_open_tray_sensor_full
    style:
      color: 'rgba(255,255,255,1)'
      font-size: 12px
      line-height: 32px
      margin: 35px 35px
      pointer-events: none
      right: 0
      text-shadow: 'rgba(0, 0, 0, 0.8) 0px 0px 2px'
      top: 0
      transform: initial
    type: state-label
  - entity: sensor.prodigio_c385818c9b_tray_open_tray_sensor_full
    style:
      color: 'rgba(255,255,255,1)'
      line-height: 32px
      margin: 36px 5px 0 0
      pointer-events: none
      right: 0
      top: 0
      transform: scale(0.8)
    type: state-icon
  - entity: sensor.prodigio_c385818c9b_water_is_empty
    style:
      color: 'rgba(255,255,255,1)'
      font-size: 12px
      line-height: 32px
      margin: 67px 35px
      pointer-events: none
      right: 0
      text-shadow: 'rgba(0, 0, 0, 0.8) 0px 0px 2px'
      top: 0
      transform: initial
    type: state-label
  - entity: sensor.prodigio_c385818c9b_water_is_empty
    style:
      color: 'rgba(255,255,255,1)'
      line-height: 32px
      margin: 69px 5px 0 0
      pointer-events: none
      right: 0
      top: 0
      transform: scale(0.8)
    type: state-icon
  - entity: sensor.prodigio_c385818c9b_water_hardness
    style:
      color: 'rgba(255,255,255,1)'
      font-size: 12px
      line-height: 32px
      margin: 99px 35px
      pointer-events: none
      right: 0
      text-shadow: 'rgba(0, 0, 0, 0.8) 0px 0px 2px'
      top: 0
      transform: initial
    type: state-label
  - entity: sensor.prodigio_c385818c9b_water_hardness
    style:
      color: 'rgba(255,255,255,1)'
      line-height: 32px
      margin: 100px 5px 0 0
      pointer-events: none
      right: 0
      top: 0
      transform: scale(0.8)
    type: state-icon
image: /local/img/nespresso.jpg
type: picture-elements

another tip for homekit users, with this in your scripts.yaml:

prepara_caffe:
  alias: "Prepara il caffè"
  icon: "mdi:coffee-maker"
  description: 'Fa un caffè lungo'
  sequence:
      # This is Home Assistant Script Syntax
      - service: nespresso.coffee
#        service_data:
        data:  
          mac: 'c3:85:81:8c:9b:d7'

you can export with the homekit: option in homeassistant a switch that you can use to create automations in the app “Home”

homekit:
  filter:
    include_entities:
      - script.prepara_caffe

So it also work with SIRI? ‘hey siri make me a cofee!’ ?

This is really nice, thank’s for sharing it.

So im struggeling to get this to work on a rp4 with home assistant installed on hassOS. I`ve found the mac adress and the key, but it seems like i cant connect to it via bluetooth in home assistant. It works well on the test page: https://rawgit.com/petergullberg/brewbutton/master/brewbutton.html

my errors are:

2020-07-05 15:51:08 ERROR (SyncWorker_16) [custom_components.nespresso.nespresso] Failed to read characteristic
Traceback (most recent call last):
File “/config/custom_components/nespresso/nespresso.py”, line 300, in get_sensor_data
data = dev.char_read_handle(“0x{:04x}”.format(characteristic.handle))
File “/usr/local/lib/python3.7/site-packages/pygatt/backends/gatttool/device.py”, line 17, in wrapper
return func(self, *args, **kwargs)
File “/usr/local/lib/python3.7/site-packages/pygatt/backends/gatttool/device.py”, line 44, in char_read_handle
return self._backend.char_read_handle(self, handle, *args, **kwargs)
File “/usr/local/lib/python3.7/site-packages/pygatt/backends/gatttool/gatttool.py”, line 49, in wrapper
raise NotConnectedError()

2020-07-05 15:51:08 ERROR (SyncWorker_16) [custom_components.nespresso.nespresso] Failed to connect
Traceback (most recent call last):
File “/config/custom_components/nespresso/nespresso.py”, line 313, in get_sensor_data
dev.disconnect()
File “/usr/local/lib/python3.7/site-packages/pygatt/backends/gatttool/device.py”, line 17, in wrapper
return func(self, *args, **kwargs)
File “/usr/local/lib/python3.7/site-packages/pygatt/backends/gatttool/device.py”, line 52, in disconnect
self._backend.disconnect(self)
File “/usr/local/lib/python3.7/site-packages/pygatt/backends/gatttool/gatttool.py”, line 49, in wrapper
raise NotConnectedError()
pygatt.exceptions.NotConnectedError

Im very new to home assistant, so any help would be much appriciated! :slight_smile:

Remember the Nespresso machine didn’t accept two or more BT connection at the same time.
The authkey must respect the syntax in example.

If it works with brewbutton it’s a good start it means you have the right auth key.

Maybe your pi to far from the machine.
For me this error message means that it can not connect at all so BT seems already occupied.

Thank you for responding tikismoke :slight_smile:

I`ve disconnected all other bluetooth devices that can interact with the Nespresso.
When i run bluetoothhctl > connect (mac-adress to Nespresso) in the terminal addon it connects to it, but after a second or two it says “Failed to connect: org.bluez.Error.Failed”

I have moved the Nespresso 30cm away from the pi :stuck_out_tongue:

Could you try the Nespresso 2 mqtt script available in my repo?
Need some part to be adapt as it’s my own Mac and code, and need also a mqtt broker.

I suspect a BT issue. Either on python part or directly in your os.

I can sure do. I havent set up a mqtt broker yet, but i can give it a try with a bit of guide if its possible :slight_smile:

If you use hassOS, you might have access to add-ons. I’m sure the mosquito mqtt broker is available in it. Start this way and then we will find what’s wrong.

Good morning please could someone help me with this integration as I get the authentication code?

Did you find the auth key or not?

how do i find?