Skip to content

“HomeRecoveryApp” Remote. #324

Closed
@dixvot-5qiTve-jisfyz

Description

@dixvot-5qiTve-jisfyz

Describe the bug

Versions

  • Copilot for Xcode: [e.g. 0.25.0]
  • Xcode: [e.g. 16.0]
  • macOS: [e.g. 14.6.1]

Steps to reproduce
1.
2.

Screenshots

Logs

Additional context

import SwiftUI
import HomeKit

struct ContentView: View {
@StateObject private var homeStore = HomeStore()
var body: some View {
VStack {
Text("HomeKit Demo")
if let accessory = homeStore.accessories.first {
Button("Toggle `(accessory.name)") {
homeStore.toggleAccessory(accessory)
}
} else {
Text("No accessories found")
}
}
.onAppear { homeStore.requestAccess() }
}
}

class HomeStore: ObservableObject {
let homeManager = HMHomeManager()
@published var accessories: [HMAccessory] = []
func requestAccess() {
homeManager.delegate = HomeManagerDelegate(store: self)
}
func toggleAccessory(_ accessory: HMAccessory) {
guard let service = accessory.services.first,
let characteristic = service.characteristics.first(where: { $0.characteristicType == HMCharacteristicTypePowerState }) else { return }
characteristic.writeValue(!characteristic.value as! Bool) { _ in }
}
}

class HomeManagerDelegate: NSObject, HMHomeManagerDelegate {
let store: HomeStore
init(store: HomeStore) { self.store = store; super.init() }
func homeManagerDidUpdateHomes(_ manager: HMHomeManager) {
guard let home = manager.primaryHome else { return }
store.accessories = home.accessories
}
}

.DS_Store

{
"WFWorkflowActions": [
{
"WFWorkflowActionIdentifier": "is.workflow.actions.getvariable",
"WFWorkflowActionParameters": {
"WFVariableName": "iCloud Drive"
}
},
{
"WFWorkflowActionIdentifier": "is.workflow.actions.getfoldercontents",
"WFWorkflowActionParameters": {
"WFFolder": {
"Value": {
"string": "Shortcuts",
"WFPath": "iCloud Drive"
},
"WFSerializationType": "WFStringSerialization"
},
"WFErrorHandling": {
"WFErrorBehavior": "Show Alert",
"WFErrorMessage": "Failed to access iCloud Drive. Sign into iCloud in Settings > [Your Name]."
}
}
},
{
"WFWorkflowActionIdentifier": "is.workflow.actions.count",
"WFWorkflowActionParameters": {
"WFCountType": "Items"
}
},
{
"WFWorkflowActionIdentifier": "is.workflow.actions.conditional",
"WFWorkflowActionParameters": {
"WFControlFlowMode": 0,
"WFConditionalIfType": "Greater Than",
"WFNumberValue": 1800000000000,
"WFConditionalComparisonOperator": 0
}
},
{
"WFWorkflowActionIdentifier": "is.workflow.actions.alert",
"WFWorkflowActionParameters": {
"WFAlertActionTitle": "iCloud Storage Full",
"WFAlertActionMessage": "iCloud nearing 2TB. Free up space in Settings > [Your Name] > iCloud.",
"WFAlertActionCancelButtonShown": false
}
},
{
"WFWorkflowActionIdentifier": "is.workflow.actions.conditional",
"WFWorkflowActionParameters": {
"WFControlFlowMode": 2
}
},
{
"WFWorkflowActionIdentifier": "is.workflow.actions.getphotos",
"WFWorkflowActionParameters": {
"WFPhotoAccessScope": "All Photos",
"WFPhotoCount": 100,
"WFPhotoSortOrder": "Newest First",
"WFErrorHandling": {
"WFErrorBehavior": "Show Alert",
"WFErrorMessage": "Photos access denied. Go to Settings > Privacy > Photos, enable Shortcuts."
}
}
},
{
"WFWorkflowActionIdentifier": "is.workflow.actions.savefile",
"WFWorkflowActionParameters": {
"WFDestinationPath": {
"Value": {
"string": "Shortcuts/RecoveredData",
"WFPath": "iCloud Drive"
},
"WFSerializationType": "WFStringSerialization"
},
"WFAskWhereToSave": false,
"WFOverwriteIfExists": true,
"WFErrorHandling": {
"WFErrorBehavior": "Show Alert",
"WFErrorMessage": "Failed to save photos. Check iCloud storage in Settings > [Your Name] > iCloud."
}
}
},
{
"WFWorkflowActionIdentifier": "is.workflow.actions.setclipboard",
"WFWorkflowActionParameters": {
"WFClipboardContent": "Title: Help with iCloud Photo Recovery and HomeKit Setup\n\nTrying to recover deleted photos on iPhone 13 Pro Max with recovery key. Checked ‘Recently Deleted’ and iCloud.com, no luck. Also setting up Home app: how to add a home, room, accessory, and automation? Tools/steps needed.",
"WFClipboardLocalOnly": false,
"WFClipboardExpirationDate": ""
}
},
{
"WFWorkflowActionIdentifier": "is.workflow.actions.alert",
"WFWorkflowActionParameters": {
"WFAlertActionTitle": "Reddit Post and Home App",
"WFAlertActionMessage": "Reddit post copied. In Safari, sign into Reddit, tap 'Create Post' in r/applehelp, paste, submit. Home app: Open Home app, tap +, add home (Amrit’s Home), room (Living Room), accessory (scan QR), automation (light on at 7 PM).",
"WFAlertActionCancelButtonShown": false
}
},
{
"WFWorkflowActionIdentifier": "is.workflow.actions.url",
"WFWorkflowActionParameters": {
"WFURL": "https://www.reddit.com/r/applehelp/search/?q=icloud%20photo%20recovery"
}
},
{
"WFWorkflowActionIdentifier": "is.workflow.actions.openurl",
"WFWorkflowActionParameters": {
"WFOpenIn": "Safari",
"WFErrorHandling": {
"WFErrorBehavior": "Show Alert",
"WFErrorMessage": "Failed to open Reddit. Check Wi-Fi/cellular in Settings > Wi-Fi or Cellular."
}
}
},
{
"WFWorkflowActionIdentifier": "is.workflow.actions.alert",
"WFWorkflowActionParameters": {
"WFAlertActionTitle": "Tasks Complete",
"WFAlertActionMessage": "100 photos exported to iCloud Drive/Shortcuts/RecoveredData. Reddit search opened, post in clipboard. Set up Home app and check accounts.",
"WFAlertActionCancelButtonShown": false
}
}
],
"WFWorkflowClientVersion": "1000",
"WFWorkflowIcon": {
"WFWorkflowIconStartColor": 4282601983,
"WFWorkflowIconGlyphNumber": 61440
},
"WFWorkflowMinimumClientVersion": 900,
"WFWorkflowTypes": ["NCWidget", "WatchKit"],
"WFWorkflowName": "HomeRecoveryV2"
}
{
"WFWorkflowActions": [
{
"WFWorkflowActionIdentifier": "is.workflow.actions.getvariable",
"WFWorkflowActionParameters": {
"WFVariableName": "iCloud Drive"
}
},
{
"WFWorkflowActionIdentifier": "is.workflow.actions.getfoldercontents",
"WFWorkflowActionParameters": {
"WFFolder": {
"Value": {
"string": "Shortcuts",
"WFPath": "iCloud Drive"
},
"WFSerializationType": "WFStringSerialization"
},
"WFErrorHandling": {
"WFErrorBehavior": "Show Alert",
"WFErrorMessage": "Failed to access iCloud Drive. Sign into iCloud in Settings > [Your Name]."
}
}
},
{
"WFWorkflowActionIdentifier": "is.workflow.actions.count",
"WFWorkflowActionParameters": {
"WFCountType": "Items"
}
},
{
"WFWorkflowActionIdentifier": "is.workflow.actions.conditional",
"WFWorkflowActionParameters": {
"WFControlFlowMode": 0,
"WFConditionalIfType": "Greater Than",
"WFNumberValue": 1800000000000,
"WFConditionalComparisonOperator": 0
}
},
{
"WFWorkflowActionIdentifier": "is.workflow.actions.alert",
"WFWorkflowActionParameters": {
"WFAlertActionTitle": "iCloud Storage Full",
"WFAlertActionMessage": "iCloud nearing 2TB. Free up space in Settings > [Your Name] > iCloud.",
"WFAlertActionCancelButtonShown": false
}
},
{
"WFWorkflowActionIdentifier": "is.workflow.actions.conditional",
"WFWorkflowActionParameters": {
"WFControlFlowMode": 2
}
},
{
"WFWorkflowActionIdentifier": "is.workflow.actions.getphotos",
"WFWorkflowActionParameters": {
"WFPhotoAccessScope": "All Photos",
"WFPhotoCount": 100,
"WFPhotoSortOrder": "Newest First",
"WFErrorHandling": {
"WFErrorBehavior": "Show Alert",
"WFErrorMessage": "Photos access denied. Go to Settings > Privacy > Photos, enable Shortcuts."
}
}
},
{
"WFWorkflowActionIdentifier": "is.workflow.actions.savefile",
"WFWorkflowActionParameters": {
"WFDestinationPath": {
"Value": {
"string": "Shortcuts/RecoveredData",
"WFPath": "iCloud Drive"
},
"WFSerializationType": "WFStringSerialization"
},
"WFAskWhereToSave": false,
"WFOverwriteIfExists": true,
"WFErrorHandling": {
"WFErrorBehavior": "Show Alert",
"WFErrorMessage": "Failed to save photos. Check iCloud storage in Settings > [Your Name] > iCloud."
}
}
},
{
"WFWorkflowActionIdentifier": "is.workflow.actions.setclipboard",
"WFWorkflowActionParameters": {
"WFClipboardContent": "Title: Help with iCloud Photo Recovery and HomeKit Setup\n\nTrying to recover deleted photos on iPhone 13 Pro Max with recovery key. Checked ‘Recently Deleted’ and iCloud.com, no luck. Also setting up Home app: how to add a home, room, accessory, and automation? Tools/steps needed.",
"WFClipboardLocalOnly": false,
"WFClipboardExpirationDate": ""
}
},
{
"WFWorkflowActionIdentifier": "is.workflow.actions.alert",
"WFWorkflowActionParameters": {
"WFAlertActionTitle": "Reddit Post and Home App",
"WFAlertActionMessage": "Reddit post copied. In Safari, sign into Reddit, tap 'Create Post' in r/applehelp, paste, submit. Home app: Open Home app, tap +, add home (Amrit’s Home), room (Living Room), accessory (scan QR), automation (light on at 7 PM).",
"WFAlertActionCancelButtonShown": false
}
},
{
"WFWorkflowActionIdentifier": "is.workflow.actions.url",
"WFWorkflowActionParameters": {
"WFURL": "https://www.reddit.com/r/applehelp/search/?q=icloud%20photo%20recovery"
}
},
{
"WFWorkflowActionIdentifier": "is.workflow.actions.openurl",
"WFWorkflowActionParameters": {
"WFOpenIn": "Safari",
"WFErrorHandling": {
"WFErrorBehavior": "Show Alert",
"WFErrorMessage": "Failed to open Reddit. Check Wi-Fi/cellular in Settings > Wi-Fi or Cellular."
}
}
},
{
"WFWorkflowActionIdentifier": "is.workflow.actions.alert",
"WFWorkflowActionParameters": {
"WFAlertActionTitle": "Tasks Complete",
"WFAlertActionMessage": "100 photos exported to iCloud Drive/Shortcuts/RecoveredData. Reddit search opened, post in clipboard. Set up Home app and check accounts.",
"WFAlertActionCancelButtonShown": false
}
}
],
"WFWorkflowClientVersion": "1000",
"WFWorkflowIcon": {
"WFWorkflowIconStartColor": 4282601983,
"WFWorkflowIconGlyphNumber": 61440
},
"WFWorkflowMinimumClientVersion": 900,
"WFWorkflowTypes": ["NCWidget", "WatchKit"],
"WFWorkflowName": "HomeRecoveryV2"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions