Skip to content

Commit

Permalink
Merge branch 'master' into v1.1-prep
Browse files Browse the repository at this point in the history
  • Loading branch information
qJake authored Aug 11, 2020
2 parents 215d8d1 + 69bc6a3 commit dbe7620
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Docker/BuildHaccContainers.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$version = '1.0.18'
$version = '1.0.19'

function Test-ExitCode ([int] $Expected = 0)
{
Expand Down
9 changes: 8 additions & 1 deletion HADotNet.CommandCenter/Models/Config/Tiles/SwitchTile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ public class SwitchTile : BaseEntityTile
/// <remarks>Switches are weird... some of them don't like the homeassistant.toggle service. So we do our own logic.</remarks>
public override async Task OnClick(ServiceClient serviceClient)
{
var serviceDomain = EntityId.Split('.')[0].ToLower();
if (serviceDomain.ToUpper() == "GROUP")
{
serviceDomain = "homeassistant";
}

var stateClient = ClientFactory.GetClient<StatesClient>();
var state = await stateClient.GetState(EntityId);
var serviceName =
Expand All @@ -54,7 +60,8 @@ public override async Task OnClick(ServiceClient serviceClient)
|| state.State.ToUpper() == "STANDBY"
|| state.State.ToUpper() == "IDLE"
? "turn_on" : "turn_off";
await serviceClient.CallService(EntityId.Split('.')[0].ToLower(), serviceName, new { entity_id = EntityId });

await serviceClient.CallService(serviceDomain, serviceName, new { entity_id = EntityId });
}
}
}

0 comments on commit dbe7620

Please sign in to comment.