Skip to content

Commit

Permalink
Merge pull request #66 from ToBiDi0410/master
Browse files Browse the repository at this point in the history
Domain fixes | Added general Homeassistant Domain
  • Loading branch information
cgiesche committed Dec 28, 2021
2 parents 7b66fa8 + 3eda592 commit e365faa
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 3 additions & 1 deletion src/Pi.vue
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ export default {
domainEntities: function () {
return this.availableEntities
.filter((entityInfo) => entityInfo.value.domain === this.domain)
.filter((entityInfo) => entityInfo.value.domain === this.domain || this.domain == "homeassistant")
},
entityAttributes: function () {
Expand Down Expand Up @@ -356,6 +356,8 @@ export default {
(acc, curr) => acc.add(curr), new Set()
));
this.availableDomains.push("homeassistant");
this.availableEntities = states
.map((state) => {
return {
Expand Down
2 changes: 1 addition & 1 deletion src/Plugin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export default {
if (!serviceData.entity_id) {
serviceData.entity_id = entity.entityId;
}
this.$HA.callService(serviceToCall.id, entity, serviceData)
this.$HA.callService(serviceToCall.id, settings.domain, serviceData)
} catch (e) {
console.error(e)
this.$SD.showAlert(context);
Expand Down
8 changes: 4 additions & 4 deletions src/modules/common/homeassistant.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ export class Homeassistant {
this.sendCommand(subscribeEventCommand, callback);
}

callService(service, entity, serviceData, callback = null) {
let callServiceCommand = new CallServiceCommand(this.nextRequestId(), service, entity, serviceData);
callService(service, domain, serviceData, callback = null) {
let callServiceCommand = new CallServiceCommand(this.nextRequestId(), service, domain, serviceData);
this.sendCommand(callServiceCommand, callback)
}

Expand Down Expand Up @@ -125,9 +125,9 @@ class GetServicesCommand extends Command {
}

class CallServiceCommand extends Command {
constructor(iterationCount, service, entity, serviceData) {
constructor(iterationCount, service, domain, serviceData) {
super(iterationCount, "call_service");
this.domain = entity.domain;
this.domain = domain;
this.service = service;
if (serviceData) {
this.service_data = serviceData;
Expand Down

0 comments on commit e365faa

Please sign in to comment.