Skip to content

Commit

Permalink
Merge pull request #359 from Barma-lej/dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Barma-lej authored May 2, 2024
2 parents b31fd4b + a15ff70 commit 5366b40
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/landroid-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class LandroidCard extends LitElement {
.filter((entity) => entity.device_id === deviceId)
.map((entity) => entity.entity_id);

// Получиение объекта сущностей из this.hass.states для указанных entity_id
// Получение объекта сущностей из this.hass.states для указанных entity_id
const entities = entitiesForDevice.reduce((acc, entityId) => {
acc[entityId] = this.hass.states[entityId];
return acc;
Expand Down Expand Up @@ -260,7 +260,7 @@ class LandroidCard extends LitElement {
callService(e, service, params = {}) {
if (!service) return undefined;

const {isRequest = false, } = params;
const {isRequest = false, entity = this.entity, service_data = {}} = params;

let serviceObject = this.getServiceObject(service);

Expand All @@ -275,10 +275,10 @@ class LandroidCard extends LitElement {
if (isObject(serviceObject)) {
const options = serviceObject.field
? { [serviceObject.field]: e.target.value }
: {};
: {...service_data};

this.hass.callService(serviceObject.domain, serviceObject.service, {
entity_id: params.entity && params.entity.entity_id ? [params.entity.entity_id] : [this.config.entity],
entity_id: [entity.entity_id],
...options,
});

Expand Down

0 comments on commit 5366b40

Please sign in to comment.