Popup confirmation through javascript

Hello,

I used this code with HA Core 0.116 and it worked well:
https://github.com/SigmaPic/custom-cover-confirmation/blob/7e06292430dfa553291a6b817dff4a45c8c011d3/custom-cover-confirmation.js

I just upgraded to the last version of HA core and it doesn’t work any more.

The onOpenTap seems to be replaced by _onOpenTap.

  // Replace onOpenTap and onCloseTap in the base class
  HaCoverControls2.prototype.onOpenTap = onOpenTap2;
  HaCoverControls2.prototype.onCloseTap = onCloseTap2;

But By biggest issue is that entityObj doesn’t exist any more leading to an exception:

function onOpenTap2(ev) {
  displayMessage("Open", () => {
    ev.stopPropagation();
    this.entityObj.openCover();
  });
}

May someone help me to update that ?

Thanks

I found the solution

  // Replace onOpenTap and onCloseTap in the base class
  HaCoverControls2.prototype._onOpenTap = onOpenTap2;
  HaCoverControls2.prototype._onCloseTap = onCloseTap2;
// Redefine onOpenTap(ev) function of ha-cover-controls
function onOpenTap2(ev) {
  displayMessage("Open", () => {
    ev.stopPropagation();
    //this.entityObj.openCover();
    this.hass.callService("cover", "open_cover", {entity_id: this.stateObj.entity_id,});
  });
}

// Redefine onCloseTap(ev) function of ha-cover-controls
function onCloseTap2(ev) {
  displayMessage("Close", () => {
    ev.stopPropagation();
    //this.entityObj.closeCover();
    this.hass.callService("cover", "close_cover", {entity_id: this.stateObj.entity_id,});
  });
}

I will update the code in the github within next days.

FYI, I found it just by looking the diff of ha-cover-controls.ts. I saw that