Open bubez81 opened 1 year ago
Hello, it's doesn't work with latest versions of ESPHome, something was changed with ble_client text_sensor. Last working version of ESPHome was 2022.11.5. If you know how to compile it in ESPHome 2022.11.5, you can try.
You can check if it's communicate with machine if in the log you see >>>
requests and <<<
replies.
Sometimes machine BT is stuck, you can try to fully power off machine (unplug the cable) and power on it again. BT module of machine working even it's powered off. If communication is OK, you should also see BT sign on the screen of machine sure if it's exists.
Update: After I back to 2022.11.5 it's start working, then I update again to 2023.2.2 it's keep working, so probably the problem was with machine itself and complete powering off/on helps.
[13:13:25][D][coffee_machine:048]: >>> 0D.05.75.0F.DA.25 (6)
[13:13:25][D][text_sensor:067]: 'text_sensor_coffee_machine': Sending state '\xd0'
[13:13:25][D][coffee_machine:162]: D0
[13:13:25][D][text_sensor:067]: 'text_sensor_coffee_machine': Sending state 'u'
[13:13:25][D][coffee_machine:162]: 12.75.0F
[13:13:25][D][text_sensor:067]: 'text_sensor_coffee_machine': Sending state ''
[13:13:25][D][coffee_machine:162]: 01.01.00.00.00.00 (6)
[13:13:25][D][text_sensor:067]: 'text_sensor_coffee_machine': Sending state ''
[13:13:25][D][coffee_machine:162]: 02.00.00.00.00.00 (6)
[13:13:25][D][text_sensor:067]: 'text_sensor_coffee_machine': Sending state ''
[13:13:25][D][coffee_machine:162]: 00.37.4E
[13:13:25][D][coffee_machine:171]: <<< D0.12.75.0F.01.01.00.00.00.00.02.00.00.00.00.00.00.37.4E (19)
Hello! Yes I can see the BT sign on the screen...let's try to downgrade and see
nothing, not even changing the version seems to work:
I also unplugged the power but nothing to do not even with the plugin in hacs for homeassistant it works even if it used to work
It's like something has changed lately....
Which model of Delonghi do you have? Can you try to turn off machine and turn it on using switch?
The Dinamica Plus Sure..:
I used the hacs plugin for a while https://github.com/Arbuzov/home_assistant_delonghi_primadonna it worked for months then suddenly stopped working and that's why i tried this system
This HACS plugin works same way, so probably something was changed in machine side :(
Yes, I think so too, I was hoping it was something common to all models but I'm starting to think it's only on my model
the very strange thing is that with this https://github.com/mmastrac/longshot the machine works...can't understand
ok i think i understand the problem. The machine doesn't accept more than one command simultaneously so if I monitor the status I can't launch the command to make a coffee so I can't connect to the machine continuously but only when I start the command
Hi, I noticed your example for the delonghi. I compiled the code without problems adapting it to my machine and it seems to connect correctly. None of the switches seem to work though:
logs_cucina_logs.txt
Could it be a machine setting? Or did something change with a firmware update? Does it work without problems for you?
and thus is my configuration: `substitutions: name: "cucina" delonghi_mac: !secret delonghi_mac delonghi_name_prefix: Coffee Machine delonghi_id_prefix: coffee_machine delonghi_service_uuid: 00035b03-58e6-07dd-021a-08123a000300 delonghi_characteristic_uuid: 00035b03-58e6-07dd-021a-08123a000301 delonghi_update_interval: '5000'
packages: esphome.bluetooth-proxy: github://esphome/bluetooth-proxies/esp32-generic.yaml@main
globals:
wifi: ssid: !secret wifi_ssid password: !secret wifi_password
esphome: name: ${name} name_add_mac_suffix: false on_loop: then:
mqtt: topic_prefix: dinamica discovery: false broker: 192.168.1.2 port: 1883 username: michele password: hd0806681
ble_client:
binary_sensor:
platform: template id: binarysensor${delonghi_id_prefix}_connected name: ${delonghi_name_prefix} device_class: connectivity entity_category: diagnostic
platform: template id: binarysensor${delonghi_id_prefix} internal: true
sensor:
switch:
platform: bleclient id: switch${delonghi_id_prefix}_enable name: ${delonghi_name_prefix} Enable ble_client_id: bleclient${delonghi_id_prefix} disabled_by_default: true entity_category: config
platform: template id: switch_${delonghi_id_prefix} name: ${delonghi_name_prefix} icon: mdi:coffee lambda: return id(binarysensor${delonghi_id_prefix}).state; turn_on_action:
platform: template id: button_${delonghi_id_prefix}_americano name: ${delonghi_name_prefix} Americano icon: mdi:coffee-to-go-outline on_press: then:
platform: template id: button_${delonghi_id_prefix}_coffe name: ${delonghi_name_prefix} Coffe icon: mdi:coffee-to-go-outline on_press: then:
platform: template id: button_${delonghi_id_prefix}_espresso name: ${delonghi_name_prefix} Espresso icon: mdi:coffee-to-go-outline on_press: then:
platform: ble_client id: textsensor${delonghi_id_prefix} internal: true ble_client_id: bleclient${delonghi_id_prefix} service_uuid: ${delonghi_service_uuid} characteristic_uuid: ${delonghi_characteristic_uuid} notify: true update_interval: never on_notify: then: lambda: |- static unsigned char packet[19]; static uint8_t index = 0; id(delonghi_millis) = millis(); ESP_LOGD("${delonghi_id_prefix}", "%s", format_hex_pretty((uint8_t *) x.c_str(), x.size()).c_str()); if (index + x.size() > sizeof(packet)) ESP_LOGE("${delonghi_id_prefix}", "Packet longer than (%d) bytes", sizeof(packet)); else { memcpy(&packet[index], x.c_str(), x.size()); index += x.size(); if (index > 0 && packet[0] != 0xD0) ESP_LOGE("${delonghi_id_prefix}", "Packet has wrong signature (0x%02X)", packet[0]); else if (index >= 2 && index >= packet[1] + 1) { ESP_LOGD("${delonghi_id_prefix}", "<<< %s", format_hex_pretty(packet, index).c_str()); uint16_t deviser = 0x1D0F, i3, i4, i5, crc = packet[index - 2] << 8 | packet[index - 1]; for (int i = 0; i < index - 2; i++) { i3 = (((deviser << 8) | (deviser >> 8)) & 0x0000FFFF) ^ packet[i]; i4 = i3 ^ ((i3 & 0xFF) >> 4); i5 = i4 ^ ((i4 << 12) & 0x0000FFFF); deviser = i5 ^ (((i5 & 0xFF) << 5) & 0x0000FFFF); } if (deviser != crc) ESP_LOGE("${delonghi_id_prefix}", "CRC error, expected (0x%04X) received (0x%04X)", deviser, crc); else { switch (packet[2]) { case 0x75: id(binarysensor${delonghi_id_prefix}).publishstate(packet[9] != 0); id(sensor${delonghi_id_prefix}_alarm).publish_state((int32_t) packet[7] + (int32_t)(packet[8] << 8) + (int32_t)(packet[12] << 16) + (int32_t)(packet[13] << 24)); break; default: ESP_LOGW("${delonghi_id_prefix}", "Unknown packet type (0x%02X)", packet[2]); } } } else return; } index = 0;`