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

YAML Example for Esphome? #1

Open
Oakman-Dev opened this issue Oct 24, 2023 · 8 comments
Open

YAML Example for Esphome? #1

Oakman-Dev opened this issue Oct 24, 2023 · 8 comments

Comments

@Oakman-Dev
Copy link

Would it be possible for you to share an example YAML on how to use this? I'm designing a open-source PCB to work inside a Jura with an EPS32 and this would pair perfectly.

@Oakman-Dev
Copy link
Author

Oakman-Dev commented Oct 24, 2023

I've tried the below with no success:

  external_components:
  - source: github://xdecock/esphome-jura
    components: [jura]
    refresh: 1s
    
  uart:
    tx_pin: GPIO22
    rx_pin: GPIO21
    baud_rate: 9600
    id: uart_bus

    sensor:
  - platform: jura
    ristretto:
      name: "Ristretto Count"
  - platform: jura
    ristretti:
      name: "Ristretti Count"
  - platform: jura
    espresso:
      name: "Espresso Count"
  - platform: jura
    espressi:
      name: "Espressi Count"
  - platform: jura
    coffee:
      name: "Coffee Count"
  - platform: jura
    double_coffee:
      name: "Double Coffee Count"
  - platform: jura
    powder_coffee:
      name: "Powder Coffee Count"
  - platform: jura
    cappuccino:
      name: "Cappuccino Count"
  - platform: jura
    latte_machiato:
      name: "Latte Macchiato Count"
  - platform: jura
    milk:
      name: "Milk Count"
  - platform: jura
    water:
      name: "Water Count"
  - platform: jura
    cleaning:
      name: "Cleaning Status"
  - platform: jura
    cappuccino_cleaning:
      name: "Cappuccino Cleaning Status"
  - platform: jura
    water_filter:
      name: "Water Filter Status"```

@xdecock
Copy link
Owner

xdecock commented Oct 25, 2023

what jura do you have? i have a J6, and it was a mess to get all the commands, I'd probably need to add a way to provide the mapping

@Oakman-Dev
Copy link
Author

@xdecock I've got the XJ9, so should be the same commands/structure from what I've gathered. I'm happy to do some testing and provide a PR for anything I discover.

The main issue I'm facing right now is just how to get the Esphome portion working as I can't seem to build it properly. Is the YAML example above close to your implementation, or how did you craft yours?

@xdecock
Copy link
Owner

xdecock commented Oct 25, 2023

Impressa J9 here, sorry

esphome:
  name: "coffee"
  friendly_name: "coffee"
  platformio_options:
    board_build.flash_mode: dio

external_components:
  - source: github://xdecock/esphome-jura@main

esp32:
  board: lolin_c3_mini
  framework:
    type: esp-idf

# Enable Home Assistant API
api:
  encryption:
    key: "random="

ota:
  password: "random"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  output_power: 8.5


# Enable logging
logger:
  level: DEBUG
  hardware_uart: USB_SERIAL_JTAG
#  level: INFO

uart:
  tx_pin: GPIO7 # D3
  rx_pin: GPIO8 # D2
  baud_rate: 9600
  rx_buffer_size: 256
  id: uart_bus

#debug:

# Example configuration entry
time:
  - platform: homeassistant
    id: homeassistant_time
    update_interval: 600s

sensor:
  # Uptime sensor.
  - platform: uptime
    name:  Uptime
  - platform: jura
    id: num_espresso
    espresso:
      name: Espresso
    espressi:
      name: Espressi
    ristretto:
      name: Ristretto
    ristretti:
      name: Ristretti
    coffee:
      name: Coffee
    double_coffee:
      name: Double Coffee
    powder_coffee:
      name: Powder Coffee
    cappuccino:
      name: Cappuccino
    
    
switch:
  # Example configuration entry
  - platform: gpio
    pin: GPIO10 #D1
    id: power_on
    name: "Power On"
    on_turn_on:
    - delay: 200ms
    - switch.turn_off: power_on
    restore_mode: ALWAYS_OFF

#custom_component:
#- lambda: |-
#    auto my_jura = new JuraCoffee(id(uart_bus),id(num_espresso), id(num_double_espressi), id(num_ristretto), id(num_double_ristretti), id(num_big_coffee), id(num_double_coffee), id(num_cappuccino), id(num_latte_machiato), id(num_powder_coffee), id(num_milk), id(num_water), id(num_cleaning), id(num_cappuccino_cleaning), id(num_filters), id(power_status), id(err_tray), id(err_tank), id(err_grounds), id(rinsing_status));
#    App.register_component(my_jura);
#    return {my_jura};

Here is my yaml slightly pruned.

The tricky part is finding the correct numbers and offset for the counters i initialy implemented a custom uart component, and it was tricky to get the records.

@Oakman-Dev
Copy link
Author

Thank you, I'll give this a shot and see what I can get working. I saw in your code that you've made some room for stuff like actually pressing buttons/actions and sensors for power, tray, water etc. Is that something you're working on implementing as well, and would you want help discovering those commands?

@xdecock
Copy link
Owner

xdecock commented Oct 25, 2023

no, i got all the commands, but they're exposed as service, i just need to document how you can call them, but i got home assistant automations on those.

i call : esphome: coffee_press_coffee (which presses the coffee button) for double coffee you need double call with a 400ms delay) and in my experience a 80s is a good delay after a double coffee to do a quad coffee, but ymmv

@Oakman-Dev
Copy link
Author

I've been playing around with this for a few weeks now and I've gotten the buttons to work (make a espresso etc), but for the life of me I can't get the sensors/water/tray/number of cups to work with the YAML above. Any chance you could give a pointer on how to call those or check if the YAML you posted above is correct?

@xdecock
Copy link
Owner

xdecock commented Nov 10, 2023 via email

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

2 participants