Skip to content

Commit

Permalink
Merge pull request #629 from kasitoru/master
Browse files Browse the repository at this point in the history
more_info action for shortcuts
  • Loading branch information
AlexxIT authored Dec 28, 2023
2 parents f5c0c80 + b026cc9 commit 141ccea
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions custom_components/webrtc/www/webrtc-camera.js
Original file line number Diff line number Diff line change
Expand Up @@ -605,8 +605,19 @@ class WebRTCCamera extends VideoRTC {
const shortcuts = this.querySelector('.shortcuts');
shortcuts.addEventListener('click', ev => {
const value = services[ev.target.dataset.index];
const [domain, name] = value.service.split('.');
this.hass.callService(domain, name, value.service_data || {});
if(value.more_info !== undefined) {
const event = new Event('hass-more-info', {
bubbles: true,
cancelable: true,
composed: true,
});
event.detail = { entityId: value.more_info };
ev.target.dispatchEvent(event);
}
if(value.service !== undefined) {
const [domain, name] = value.service.split('.');
this.hass.callService(domain, name, value.service_data || {});
}
});
}

Expand Down

0 comments on commit 141ccea

Please sign in to comment.