JSON to YAML Conversion for GE Opal

I’m trying to use the following ESP32 MQTT code I found:

To allow home assistant to control my GE Opal Ice Maker over BLE. The two problems I’m having as a super noob to this is how do I convert this code from JSON to the YAML needed for ESPHome and how do I find the MAC Address of my BLE since it only broadcasts a UUID?

Thanks in advance!

It doesn’t work that way. ble2mqtt is it’s own program and not compatible with esphome.

Got it, thank you. I wish I could get this to work in esphome because I’m having a ridiculous time trying to flash this now.

So you would start here:

From the JSON linked:

"characteristics" : {
        "definitions": {
           "79994230-4b04-40cd-85c9-02dd1a8d4dd0": {
            "name": "make-ice",
            "types": ["uint8"]
           },
           "097a2751-ca0d-432f-87b5-7d2f31e45551": {
            "name": "make-state",
            "types": ["uint8"]
           },
           "5bcbf6b1-de80-94b6-0f4b-99fb984707b6": {
            "name": "ice-bin-state",
            "types": ["uint8"]
           },
           "37988f00-ea39-4a2d-9983-afad6535c02e": {
            "name": "night-light",
            "types": ["uint8"]
           }

These are various functions that have been decoded from the ice maker. So 097a2751-ca0d-432f-87b5-7d2f31e45551 is the make-state.

You can see here: BLE Client Sensor — ESPHome how you would use these.

So an example using the data from the JSON would be:

esp32_ble_tracker:

ble_client:
  - mac_address: MACADDRESS
    id: ice_maker

sensor:
  - platform: ble_client
    ble_client_id: ice_maker
    name: "Make State"
    service_uuid: '3e6763c5-9429-40cc-909e-bebf8c7487be'
    characteristic_uuid: '097a2751-ca0d-432f-87b5-7d2f31e45551'
  - platform: ble_client
    ble_client_id: ice_maker
    name: "Ice Bin State"
    service_uuid: '3e6763c5-9429-40cc-909e-bebf8c7487be'
    characteristic_uuid: '5bcbf6b1-de80-94b6-0f4b-99fb984707b6'
  - platform: ble_client
    ble_client_id: ice_maker
    name: "Night Light Status"
    service_uuid: '3e6763c5-9429-40cc-909e-bebf8c7487be'
    characteristic_uuid: '37988f00-ea39-4a2d-9983-afad6535c02e'

That should get you going along the right path.

I got this working! Thank you. Is there anyway to send the “make-ice” command, or only poll the sensor states?

This is what I have now:

esp32_ble_tracker:

ble_client:
  - mac_address: 'D8:28:C9:10:34:75'
    id: ice_maker
    on_connect:
      then:
        - lambda: |-
            ESP_LOGD("ble_client_lambda", "Connected to Opal Ice Maker");
    on_disconnect:
      then:
        - lambda: |-
            ESP_LOGD("ble_client_lambda", "Disconnected from Opal Ice Maker");

sensor:
  - platform: ble_client
    ble_client_id: ice_maker
    name: "Make State"
    service_uuid: '3e6763c5-9429-40cc-909e-bebf8c7487be'
    characteristic_uuid: '097a2751-ca0d-432f-87b5-7d2f31e45551'
  - platform: ble_client
    ble_client_id: ice_maker
    name: "Ice Bin State"
    service_uuid: '3e6763c5-9429-40cc-909e-bebf8c7487be'
    characteristic_uuid: '5bcbf6b1-de80-94b6-0f4b-99fb984707b6'
  - platform: ble_client
    ble_client_id: ice_maker
    name: "Night Light Status"
    service_uuid: '3e6763c5-9429-40cc-909e-bebf8c7487be'
    characteristic_uuid: '37988f00-ea39-4a2d-9983-afad6535c02e'
    
output:
  - platform: ble_client
    ble_client_id: ice_maker
    id: make_ice
    service_uuid: '3e6763c5-9429-40cc-909e-bebf8c7487be'
    characteristic_uuid: '79994230-4b04-40cd-85c9-02dd1a8d4dd0'
    require_response: false
    
switch:
  - platform: output
    name: "Make Ice"
    output: make_ice

It works fine until I add the “output” and “switch” blocks. Then it can’t even seem to connect. This is the log dump I get:

[18:53:16][D][esp32_ble_tracker:217]: Starting scan...
[18:53:16][D][ble_client:047]: Found device at MAC address [D8:28:C9:10:34:75]
[18:53:17][I][ble_client:085]: Attempting BLE connection to d8:28:c9:10:34:75
[18:53:17][D][ble_client_lambda:035]: Connected to Opal Ice Maker
[18:53:17][I][ble_sensor:031]: [Make State] Connected successfully!
[18:53:17][I][ble_sensor:031]: [Ice Bin State] Connected successfully!
[18:53:17][I][ble_sensor:031]: [Night Light Status] Connected successfully!
[18:53:17][W][ble_binary_output:024]: [79994230-4B04-40CD-85C9-02DD1A8D4DD0] Connected successfully!
[18:53:20][I][ble_client:170]: Service UUID: 0x1800
[18:53:20][I][ble_client:171]:   start_handle: 0x100  end_handle: 0x121
[18:53:20][I][ble_client:383]:  characteristic 0x2A00, handle 0x111, properties 0x2
[18:53:20][I][ble_client:383]:  characteristic 0x2A01, handle 0x121, properties 0x2
[18:53:20][I][ble_client:170]: Service UUID: 0x1801
[18:53:20][I][ble_client:171]:   start_handle: 0x200  end_handle: 0x200
[18:53:20][I][ble_client:170]: Service UUID: 0x180A
[18:53:20][I][ble_client:171]:   start_handle: 0x300  end_handle: 0x341
[18:53:20][I][ble_client:383]:  characteristic 0x2A29, handle 0x311, properties 0x2
[18:53:20][I][ble_client:383]:  characteristic 0x2A27, handle 0x341, properties 0x2
[18:53:20][I][ble_client:170]: Service UUID: 3E6763C5-9429-40CC-909E-BEBF8C7487BE
[18:53:20][I][ble_client:171]:   start_handle: 0x500  end_handle: 0xe03
[18:53:20][I][ble_client:383]:  characteristic 097A2751-CA0D-432F-87B5-7D2F31E45551, handle 0x601, properties 0x12
[18:53:20][I][ble_client:383]:  characteristic 79994230-4B04-40CD-85C9-02DD1A8D4DD0, handle 0x611, properties 0x1a
[18:53:20][I][ble_client:383]:  characteristic 37988F00-EA39-4A2D-9983-AFAD6535C02E, handle 0x621, properties 0x1a
[18:53:20][I][ble_client:383]:  characteristic EFE4BD77-0600-47D7-B3F6-DC81AF0D9AAF, handle 0x631, properties 0x12
[18:53:20][I][ble_client:383]:  characteristic BD205030-B5CE-4847-B78D-83BFF1450A6B, handle 0x641, properties 0x12
[18:53:20][I][ble_client:383]:  characteristic ED9E0784-FBF1-47F4-AFE2-D439A6C207FC, handle 0x701, properties 0xa
[18:53:20][I][ble_client:383]:  characteristic 9E1AE873-CB5E-4485-9884-5C5A3AD60E47, handle 0x711, properties 0xa
[18:53:20][I][ble_client:383]:  characteristic B45163B3-1092-4725-95DC-1A43AC4A9B88, handle 0x721, properties 0xa
[18:53:21][I][ble_client:383]:  characteristic 9BFDF2DD-E92C-468C-996B-F2EB95AA9325, handle 0x731, properties 0xa
[18:53:21][I][ble_client:383]:  characteristic 6AF78DF8-629C-490E-9D42-100E84915753, handle 0x741, properties 0x12
[18:53:21][I][ble_client:383]:  characteristic 1F122C31-D1EA-447D-8409-56196DF130D2, handle 0x7f1, properties 0x2
[18:53:21][I][ble_client:383]:  characteristic 1CE417B2-5BE0-4D4F-99C6-4086F49AE901, handle 0x801, properties 0x2
[18:53:21][I][ble_client:383]:  characteristic 3E2D48C7-0336-40D7-B281-E5C5F70366B8, handle 0x811, properties 0x2
[18:53:21][I][ble_client:383]:  characteristic 21959717-F8D2-46ED-925E-FCDFEB666F65, handle 0x821, properties 0x2
[18:53:21][I][ble_client:383]:  characteristic EC780A17-1E86-4633-8BB7-4AD614413942, handle 0x831, properties 0x2
[18:53:21][I][ble_client:383]:  characteristic 06124193-F87C-49F3-AB44-59AA1DBA82F1, handle 0x841, properties 0x2
[18:53:21][I][ble_client:383]:  characteristic 21D3FDBB-5C1D-4ACE-9578-7D3D3CEBA147, handle 0x851, properties 0x2
[18:53:21][I][ble_client:383]:  characteristic 352DDEA3-79F7-410F-B5B5-4D3F96DC510D, handle 0x861, properties 0x2
[18:53:21][I][ble_client:383]:  characteristic 5EA370C7-2059-41DB-9999-36527B43A4B4, handle 0xa01, properties 0xa
[18:53:21][I][ble_client:383]:  characteristic CF88A5B6-6687-4F14-8E21-BB9E78A40ECC, handle 0xa11, properties 0x2
[18:53:21][I][ble_client:383]:  characteristic 14FF6DFB-36FA-4456-927D-759E1A9A8446, handle 0xa21, properties 0x12
[18:53:21][I][ble_client:383]:  characteristic 5BCBF6B1-DE80-94B6-0F4B-99FB984707B6, handle 0xe01, properties 0x12
[18:53:21][I][ble_client:170]: Service UUID: E936877A-8DD0-FAA7-B648-F46ACDA1F27B
[18:53:21][I][ble_client:171]:   start_handle: 0xff00  end_handle: 0xff07
[18:53:21][I][ble_client:383]:  characteristic 4FB34AB1-6207-E5A0-484F-E24A7F638FFF, handle 0xff02, properties 0x38
[18:53:21][I][ble_client:383]:  characteristic 78282AE5-3060-C3B6-7D49-EC74702414E5, handle 0xff05, properties 0x8
[18:53:21][I][ble_client:383]:  characteristic 318DB1F5-67F1-119B-6A41-1EECA0C744CE, handle 0xff07, properties 0x2

Thanks for getting this started over a year ago. I think I got it working, with switches for the light and maybe the ice making function. The problem is the Opal wants to pair, so I needed to figure out a way to force it to pair on connect. It can only be paired with one device at a time. Maybe I’ll try to make a proxy version of this, but below is my YAML.Not sure if the passkey is required, but I left it in. I think the pair() command during the connect was the missing link.

esphome:
  name: esphome-web-XXXXX
  friendly_name: ESP32ProxyKitchen

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

logger:
  level: DEBUG

# Enable Home Assistant API
api:
  encryption:
    key: XXXXXXXX
    
ota:

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

esp32_ble_tracker:
  scan_parameters:
    active: True

bluetooth_proxy:
  active: True

ble_client:
  - mac_address: 'XX:XX:XX:XX:XX:XX'
    id: ice_maker
    on_passkey_request:
      then:
        - ble_client.passkey_reply:
            id: ice_maker
            passkey: 000000
    on_connect:
      then:
        - lambda: |-
            ESP_LOGD("ble_client_lambda", "Connected to Opal Ice Maker");
            id(ice_maker)->pair();
    on_disconnect:
      then:
        - lambda: |-
            ESP_LOGD("ble_client_lambda", "Disconnected from Opal Ice Maker");

sensor:
  - platform: ble_client
    ble_client_id: ice_maker
    name: "Make State"
    id: make_state
    service_uuid: '3e6763c5-9429-40cc-909e-bebf8c7487be'
    characteristic_uuid: '097a2751-ca0d-432f-87b5-7d2f31e45551'
    type: characteristic
  - platform: ble_client
    ble_client_id: ice_maker
    name: "Ice Bin State"
    service_uuid: '3e6763c5-9429-40cc-909e-bebf8c7487be'
    characteristic_uuid: '5bcbf6b1-de80-94b6-0f4b-99fb984707b6'
    type: characteristic
  - platform: ble_client
    ble_client_id: ice_maker
    name: "Night Mode"
    id: night_mode
    service_uuid: '3e6763c5-9429-40cc-909e-bebf8c7487be'
    characteristic_uuid: '37988f00-ea39-4a2d-9983-afad6535c02e'
    type: characteristic

switch:
  - platform: template
    name: "Night Mode Switch"
    lambda: |-
      if (id(night_mode).state) {
        return true;
      } else {
        return false;
      }
    turn_on_action:
      - ble_client.ble_write:
          id: ice_maker
          service_uuid: '3e6763c5-9429-40cc-909e-bebf8c7487be'
          characteristic_uuid: '37988f00-ea39-4a2d-9983-afad6535c02e'
          # List of bytes to write.
          value: [0x01]
    turn_off_action:
      - ble_client.ble_write:
          id: ice_maker
          service_uuid: '3e6763c5-9429-40cc-909e-bebf8c7487be'
          characteristic_uuid: '37988f00-ea39-4a2d-9983-afad6535c02e'
          # List of bytes to write.
          value: [0x00]
  - platform: template
    name: "Make Ice Switch"
    lambda: |-
      if (id(make_state).state == 1 ) {
        return true;
      } else {
        return false;
      }
    turn_on_action:
      - ble_client.ble_write:
          id: ice_maker
          service_uuid: '3e6763c5-9429-40cc-909e-bebf8c7487be'
          characteristic_uuid: '79994230-4b04-40cd-85c9-02dd1a8d4dd0'
          # List of bytes to write.
          value: [0x01]
    turn_off_action:
      - ble_client.ble_write:
          id: ice_maker
          service_uuid: '3e6763c5-9429-40cc-909e-bebf8c7487be'
          characteristic_uuid: '79994230-4b04-40cd-85c9-02dd1a8d4dd0'
          # List of bytes to write.
          value: [0x00]        
1 Like

Working on a native home assistant integration as well.

https://github.com/jdeath/Opal_NuggetIce_ble/
1 Like