mirror of
https://github.com/home-assistant/iOS.git
synced 2026-04-21 16:52:30 -05:00
Fix control scene id when calling to activate scene (#3007)
<!-- Thank you for submitting a Pull Request and helping to improve Home Assistant. Please complete the following sections to help the processing and review of your changes. Please do not delete anything from this template. --> ## Summary <!-- Provide a brief summary of the changes you have made and most importantly what they aim to achieve --> ## Screenshots <!-- If this is a user-facing change not in the frontend, please include screenshots in light and dark mode. --> ## Link to pull request in Documentation repository <!-- Pull requests that add, change or remove functionality must have a corresponding pull request in the Companion App Documentation repository (https://github.com/home-assistant/companion.home-assistant). Please add the number of this pull request after the "#" --> Documentation: home-assistant/companion.home-assistant# ## Any other notes <!-- If there is any other information of note, like if this Pull Request is part of a bigger change, please include it here. -->
This commit is contained in:
committed by
GitHub
parent
b90ab532f1
commit
4f2f2e4195
@@ -13,19 +13,6 @@ final class ScriptAppIntent: AppIntent {
|
||||
@Parameter(title: LocalizedStringResource("app_intents.scripts.script.title", defaultValue: "Run Script"))
|
||||
var script: IntentScriptEntity
|
||||
|
||||
@Parameter(
|
||||
title: LocalizedStringResource(
|
||||
"app_intents.scripts.requires_confirmation_before_run.title",
|
||||
defaultValue: "Confirm before run"
|
||||
),
|
||||
description: LocalizedStringResource(
|
||||
"app_intents.scripts.requires_confirmation_before_run.description",
|
||||
defaultValue: "Requires manual confirmation before running the script."
|
||||
),
|
||||
default: true
|
||||
)
|
||||
var requiresConfirmationBeforeRun: Bool
|
||||
|
||||
@Parameter(
|
||||
title: LocalizedStringResource(
|
||||
"app_intents.scripts.show_confirmation_dialog.title",
|
||||
@@ -49,10 +36,6 @@ final class ScriptAppIntent: AppIntent {
|
||||
var hapticConfirmation: Bool
|
||||
|
||||
func perform() async throws -> some IntentResult & ReturnsValue<Bool> {
|
||||
if requiresConfirmationBeforeRun {
|
||||
try await requestConfirmation()
|
||||
}
|
||||
|
||||
if hapticConfirmation {
|
||||
// Unfortunately this is the only 'haptics' that work with widgets
|
||||
// ideally in the future this should use CoreHaptics for a better experience
|
||||
@@ -65,7 +48,7 @@ final class ScriptAppIntent: AppIntent {
|
||||
return
|
||||
}
|
||||
let domain = Domain.script.rawValue
|
||||
let service = script.id.replacingOccurrences(of: "\(domain).", with: "")
|
||||
let service = script.entityId.replacingOccurrences(of: "\(domain).", with: "")
|
||||
Current.api(for: server).CallService(domain: domain, service: service, serviceData: [:])
|
||||
.pipe { [weak self] result in
|
||||
switch result {
|
||||
@@ -98,6 +81,7 @@ struct IntentScriptEntity: AppEntity {
|
||||
static let defaultQuery = IntentScriptAppEntityQuery()
|
||||
|
||||
var id: String
|
||||
var entityId: String
|
||||
var serverId: String
|
||||
var serverName: String
|
||||
var displayString: String
|
||||
@@ -108,12 +92,14 @@ struct IntentScriptEntity: AppEntity {
|
||||
|
||||
init(
|
||||
id: String,
|
||||
entityId: String,
|
||||
serverId: String,
|
||||
serverName: String,
|
||||
displayString: String,
|
||||
iconName: String
|
||||
) {
|
||||
self.id = id
|
||||
self.entityId = entityId
|
||||
self.serverId = serverId
|
||||
self.serverName = serverName
|
||||
self.displayString = displayString
|
||||
@@ -161,6 +147,7 @@ struct IntentScriptAppEntityQuery: EntityQuery, EntityStringQuery {
|
||||
entities[server] = scripts.map({ entity in
|
||||
.init(
|
||||
id: entity.id,
|
||||
entityId: entity.entityId,
|
||||
serverId: server.identifier.rawValue,
|
||||
serverName: server.info.name,
|
||||
displayString: entity.name,
|
||||
|
||||
Reference in New Issue
Block a user