brutella / hc Goto Github PK
View Code? Open in Web Editor NEWhc is a lightweight framework to develop HomeKit accessories in Go.
License: Apache License 2.0
hc is a lightweight framework to develop HomeKit accessories in Go.
License: Apache License 2.0
Q: Did somebody create a Dockerfile for Homecontrol already? n/t
Hi Matthias,
First, this is not an issue as such :-)
Second, great work you have done here. Now then, I'm working on an "HomeKit to MQTT Server" that allow bidirectional communication between HomeKit (using your HomeControl) and devices communicating via the MQTT protocol. So far I've made a new transport based on
'ip_transport.go' and a few additions/modifications here and there (including adding new accessories).
So the question is: are you willing to accept PRs (if the code is ok of course)?
If I commit/sync to github you can have a look - any interest?
/michael
I am trying to extend the thermometer to support additional sensors such as a carbon dioxide sensor and an humidity sensor. It is not really clear to me how to integrate those additional services. Might be due to my very limited golang experience. Could you provide some example on how to add an additional service to an accessory?
Given the license does not comply with OSI definition, Its probably disingenuous to advertise it as opensource given its constraints.
Hi,
I built this for OSX but when I run it I get..
[Maelstrom 16:45] ~/projects/go/src/hklight >./hklightd
2016/12/16 16:45:26 [INFO] Accessory IP is 192.168.1.29
2016/12/16 16:45:26 [ERR] bonjour: Failed to unpack packet: dns: failed to unpack truncated message
2016/12/16 16:45:26 [ERR] bonjour: Failed to handle query: dns: failed to unpack truncated message
2016/12/16 16:45:26 [ERR] bonjour: Failed to unpack packet: dns: failed to unpack truncated message
2016/12/16 16:45:26 [ERR] bonjour: Failed to handle query: dns: failed to unpack truncated message
etc..
I ran wireshark looking for traffic but couldn't find anything (so.. maybe I looked in the wrong place :)
Characteristics have a specific type (string, float, ...) and may have a min and max. We should prevent invalid values; e.g. 24
for values which have a max of 20
.
@eaigner What would be a better way to implement log levels?
iOS uses the mDNS service name as host header field value – whitespaces are encoded as \032.
Go1.6 validates the host header field value as reported in #48 and will fail on any backslash character ("").
There is now a radar for Apple to fix that.
Until then we should remove whitespaces from mDNS services names.
Use the characteristic type HMCharacteristicTypeLogs
to provide the accessory logs.
Replicate status codes from https://github.com/KhaosT/HAP-NodeJS/blob/master/lib/HAPServer.js#L134-L144
This should eliminate the getter and setter methods.
It would be nice to be able to control which ip address HC binds to instead of it just choosing one as it does now. I run HC on my linux gateway/firewall system and it was grabbing the outside interface address when I prefer it to keep its traffic on my internal net.
I've got a diff for the GetFirstLocalIPAddress func in mdns.go that first attempts to use the hostname ip address before falling back to just blindly grabbing the first available IP address.
An even better solution would be to be able to specify the address to bind to, perhaps as an additional variable in hap.Config? I don't "know" go but have figured it out enough for this diff. If hap.Config would be an approved method, I could work on implementing that.
Is there an easy way to have hc started after a reboot? I can use the following script to start hc from the command line:
export GOPATH=~/go/
cd ~/go/src/hklight/
go run ~/go/src/hklight/home.go
But I can't execute it via cron after a reboot. Any suggestions on how to start hc after a reboot?
Cannot pair if model.Info.Name contains a space.
Steps:
Use Go's testing
package instead
Such complex things as this in a language that is not supposed to be available for embedded development calls for a rewrite in C.
How can you enable the MFi compatibility? Is there stub functions to fill?
Any has seen this error on macos?
iOS 9 connects and findes products in home app, after connection is lost (wifi | flight mode toggle on/off) and products remains disconnected..
Philips hue bridge connects right away (so no ios9/ iPhone problem)
The current implementation of POST /identify
does nothing other than responding with HTTP status code 204
(no content).
Things to do
400
(bad request) when accessory is already paired with a device204
(no content) when accessory is not paired. Provide method for developers to let the accessory identify itself.How would one add multiple devices at once?
When I run hap.NewIPTransport("00102003", sw.Accessory)
for every device, I get:
2015/07/15 21:49:18 [ERR] bonjour: Failed to bind to udp6 port: listen udp6 :5353: bind: address already in use
When I start up my app that runs two accessories, I get the following right at startup:
2016/08/16 22:26:09 [ERR] bonjour: Failed to handle query:
write udp4 0.0.0.0:5353->192.168.0.16:5353:
sendto: operation not permitted
I am running on Ubuntu 16.04 and I have stopped avahi-daemon
to make sure port 5353
is available.
Is the problem here that it is trying to send a UDP packet from 0.0.0.0
?
Use good wiki as a reference https://github.com/showcases/projects-with-great-wikis
Is there a simple way to reset the state information. For example reset all bulbs to off. Or would just restarting the program be enough to do this?
If an accessory is already paired with a device, new pairing requests should fail.
Could you provide some documentation on how to update an existing hc installation?
I am a bit puzzled, since the installation guide only clones the hklight repo. How does the hc code get updated to the latest version of the repo?
Thanks!
Currently all connected clients get the event notifications.
I'm the guy on twitter who asked for the netamo integration :)
I'm trying to integrate a temperature sensor. I can access the temperature via simple http requests. Can I adapt the thermometer class for this?
https://github.com/brutella/hc/blob/master/model/accessory/thermometer.go
I tried adding the temperature sensor to my devices like follows:
thermometer_info := model.Info{
Name: "Netatmo",
SerialNumber: "001",
Manufacturer: "Netatmo",
Model: "Thermostaty",
}
model_thermometer := accessory.NewTemperatureSensor(thermometer_info, 10, 0, 100, 1)
But this will obviously give me 10°C as the temperature. Is there a func called when I access the sensor device via homekit? I would put the http call there. Thanks!
When I attempt to use HomeKit + hk from outside my home network I see the following warning: No characteristic found with aid 0 and iid 0
. This appears to be preventing me from getting details about the device behind hk as well.
Most sub-packages (if not all) can be consolidated into one package (preferably at the top level). For instance packages like util
are not really required and can just be private package methods.
Thanks for your work!
You plan to add new accessories?
Very interested in the camera and doorbell.
I've got a thermostat that I'm driving with your Home app. Using iOS 9 it's regularly unreachable, unless I restart the Go application. Can I help provide any diagnostics, Wireshark traces, etc?
Hi - this looks like a great project, thanks for working on it so far. I'd really like to expose my Raspberry Pi driven thermostat using HomeKit, and I'm not quite sure how to get started.
I can see the example with the switch, but the thermostat structs don't seem to have the same callback functions - I can't see how to bind up something that will trigger when the user changes the target temperature.
Am I missing something, or has this not been implemented yet?
This makes it easier to checkout the project at a later time when the some packages may have changed their APIs.
package http://godoc.org/golang.org/x/net/context
post http://blog.golang.org/context
If I have other HomeKit enabled devices, would it be possible to query the state of those, and build new aggregated services from those devices?
Say I want to create a thermostat using the the already HomeKit connected temperature sensor in Elgato Eve Room, would that be possible via HomeKit or would I have to get data from the Bluetooth transfer directly?
i
instead of integer
svc
instead of service
iOS 10 has support for setting temperature (Kelvin). But I noticed that service/lightbulb.go doesn't include temperature characteristic.
Hi, folks,
i try to start the example from the tutorial of brutella but i receive an error:
antonkluev.pi ~/go/src/hklight $ go run hklightd.go
2015/10/26 21:18:07 [INFO] Accessory IP is 192.168.1.8
2015/10/26 21:18:07 [ERR] bonjour: Failed to bind to udp6 port: listen udp6 :5353: address family not supported by protocol
the homekit apps don't see my virtual accessoire..
can anyone help me?
and i have one more question: can i use my raspberry pi to control multiple accessoires?
thx guys!
If the client is under enough packet loss or experiencing high enough latency, the following happens to me:
2015/07/18 19:28:44 [ERRO] Decryption failed: read tcp 192.168.1.104:65302: operation timed out
2015/07/18 19:28:44 [ERRO] Decryption failed: use of closed network connection
2015/07/18 19:28:44 [INFO] Close connection and remove session
The server is then dead and must be halted and resumed. If this is a fatal error, it should be handled as such and the program should terminate. If not, the connection should be retried. I haven't gotten deep enough into netio to see where to handle this better, and this is my first real foray into reading someone else's go.
Issue is discussed here
It's not clear yet when the s# and c# fields in the TXT records are updated.
Hi,
I just wanted to dip my toes into this project by playing with hklight. But after starting it my iPhone does not see the accessory. Before I investigate further, is this known?
regards
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.