homekit

Swift在HomeKit向用户的住宅添加房间(HMRoom)(三)

笑着哭i 提交于 2020-01-15 22:23:26
查询HMHome的房间列表 import UIKit import HomeKit class RoomsVC: UIViewController,UITableViewDataSource,UITableViewDelegate ,HMHomeDelegate{ @IBOutlet weak var tableView: UITableView? var home:HMHome!{ didSet{ home.delegate = self; } } override func viewDidLoad() { super.viewDidLoad() self.title = "rooms" self.navigationItem.rightBarButtonItem = UIBarButtonItem.init(barButtonSystemItem: .add, target: self, action: #selector(addRooms)) self.tableView?.register(UITableViewCell.self, forCellReuseIdentifier: "cell") } @objc func addRooms(){ let addRoomVC = AddRoomsVC.init(nibName: "AddRoomsVC", bundle:

群晖docker安装 homeassistant homebridge homekit 基础入门

安稳与你 提交于 2020-01-02 10:36:14
很久之前就看到可以用苹果手机控制物联网设备,但一直心动没有行动。年底该做的事都完成了,正在计划明年的工作,突然想试试 homeassistant + homekit 。家里有群晖docker,于是决定使用群晖docker安装 homeassistant homebridge homekit玩玩。看了几遍相关的文章心里有了底,非常感谢前辈无私的奉献,有了前辈们的贡献才使得咱们能有机会玩玩HA+HB。跟着前辈们的文章安装也走了不少弯路,主要原因有文章撰写时间比较久远,大多数文章是17年写的,到19年底很多套件有了较大的变化,有的组件去除了、有组件整合了,造成安装配置方法变了,跟着老方法肯定调不通。另外就是我认为应该写的必要细节省略了,造成调不通。写这篇文章的目的是记录我走过的弯路,也让最近想入坑的少走弯路。我大概花了2天的时间有了一个基本的样子,希望看了我这篇文章可以半天跳出水坑。下面是做好的苹果手机home主页截图,用mqtt模拟了房间温度、灯、开关,另外还有群晖上的PT下载软件Transmission。 一、homeassistant安装 homeassistant是一个可以接入、管理、控制智能设备的平台,所有智能设备都可以在这完成对接。小米、MQTT设备都可以。好了话不多说开始干。基本条件: 有一个蜗牛星际的黑群晖,可以装docker。 有一个苹果手机。

In HomeKit, can I set the code that enables the accessory programmatically?

别来无恙 提交于 2019-12-24 11:52:41
问题 I would like to know if you can set the code that enables the accessory programmatically? I in this moment use: import UIKit import Foundation import HomeKit let homeManager = HMHomeManager() func addAccessory () { if let home = homeManager.primaryHome { for room in home.rooms { if room.name == "Kitchen" { homeManager.primaryHome?.addAccessory(accessory, completionHandler: { (error) -> Void in if error != nil { print("ERROR 1 \(error?.localizedDescription)") }else { self.homeManager

HMLocationEvent Sample

吃可爱长大的小学妹 提交于 2019-12-23 20:32:04
问题 I am implementing HMLocatinEvent in my HMHome. I am trying the below code but one thing I didn't get is I don't know how to execute functionality like incase if I left home have to switch off all the lights. I didn't find any method related to the actionset. Please correct me if I am wrong. Requirement: I want to switch off all the HMAccessories incase if I left home. Questions : To achieve the requirement Do I need to use HMLocationEvent and HMEventTrigger? or is there any alternate? Incase

开源homekit adk 测试

旧城冷巷雨未停 提交于 2019-12-23 02:39:47
开源homekit adk 测试 摘要 :本文尝试体验苹果新鲜开源的 homekit adk ,实现在ubuntu成功编译运行后在iPhone 家 实现设备的添加、控制,以及siri的语音控制。 由amazon、apple、google、zigbee alliance牵头的 project connected home over ip 项目成立了,旨在统一智能硬件在应用层的通信协议,多年智能家居从业,从早期私有协议,再到各家所谓的data models、tls(things language specification)、物模型、miot-spec,甚是知道在上层应用的通信语言的不统一,带来的设备模型重影映射是多么繁琐。 mazon’s Alexa Smart Home Apple’s HomeKit Google’s Weave Zigbee Alliance’s Dotdot data models 巧的是第二天zigbee 联盟就来公司就行了宣讲。很多人会觉得很别扭,上层的应用通信语言的统一为什么会有zigbee联盟的加入,熟悉zigbee协议的应该知道,发展了10多年的zigbee在zigbee3.0后才逐渐进入人们视野。很大程度上是得益于zigbee3.0设备的zcl revision7,基于硬件属性统一了硬件之间的通信语言,打通不同硬件厂商的设备的通信

HMHomeManager didAddHome not returned

一世执手 提交于 2019-12-13 01:15:15
问题 I am having a problem with adding homes with HMHomeManager. I can call the function add well, but HMHomeManager does not return func homeManager(manager: HMHomeManager!, didAddHome home: HMHome!) { println("\(__FUNCTION__)") } I am sure I already assigned the delegate of homeManager. Below is my code: class ViewController: UIViewController, HMHomeManagerDelegate { var manager: HMHomeManager required init(coder aDecoder: NSCoder) { manager = HMHomeManager() super.init(coder: aDecoder) }

HomeKit show no homes in WatchOS 2

走远了吗. 提交于 2019-12-12 03:59:19
问题 WatchKit app using WatchOS2 with HomeKit capabilities, but HMHomeManager return with no homes (after homeManagerDidUpdateHomes is called). The corresponding iOS app works fine, and show the homes. 回答1: It does work on real watch but not in simulator 来源: https://stackoverflow.com/questions/32129849/homekit-show-no-homes-in-watchos-2

Swift在HomeKit向用户的住宅添加房间(HMZone)(四)

人盡茶涼 提交于 2019-12-10 15:13:37
向HMHome中添加HMZone home.addZone(withName: "一楼") { (zone, error) in if error == nil{ print("创建一楼区域成功"); }else{ print("创建一楼区域失败"); } } 删除HMZone home.removeZone(home.zones[indexPath.row]) { [weak self] (Error) in if Error == nil{ self?.tableView?.deleteRows(at: [indexPath], with: .fade) } } 给区域添加rooms let room = self.home.rooms[0] let zone = self.home.zones[0] zone.addRoom(room) { (error) in if error == nil{ print("添加成功") for rooms in zone.rooms{//获取添加成功的房间 print("----------------\(rooms.name)") } }else{ print("添加失败") } } 给区域删除room zone.removeRoom(room) { (error) in if error == nil{ print("删除成功")

swift 4 - HMCharacteristicTypeSerialNumber deprecated

浪子不回头ぞ 提交于 2019-12-10 14:58:30
问题 I want to read information of an accessory, typed HMAccessory , such as Serial number ( HMCharacteristicTypeSerialNumber ), manufacturer ( HMCharacteristicTypeManufacturer ), model ( HMCharacteristicTypeModel ) but they all are deprecated in iOS11, according to this Apple doc here. I know I can instead use the characteristicType string directly, like below: HMCharacteristicTypeSerialNumber -> 00000030-0000-1000-8000-0026BB765291 HMCharacteristicTypeManufacturer -> 00000020-0000-1000-8000

HomeKit simulator: Adding human readable description to custom service characteristic

谁说我不能喝 提交于 2019-12-10 11:08:12
问题 I have added a custom characteristic to a service using the HomeKit Simulator. However when I add it, despite I include the manufactorer description, a UUID is shown instead of the description. How can I display the description instead? The first characteristic is a standard one ("On/Off": boolean). The other ones are custom. 回答1: Until now the HomeKit Accessory Simulator (1.1) cannot be configured to show manufacturer description, as you want to. At least in version 1.1 custom services can