Home automation system based on Homebridge.
It includes a web interface for controlling accessories, activating and configuring scenes, automations andcustom controls. Configuring accessories in the web interface and storing historical data is not supported yet.
It includes a plugin system to add accessories, accessory configuration, authentication and options for automations.All Homebridge plugins are supported.
--experimental-history
flag. Currently only stores changes already visible to hap-server(when plugins (usually incorrectly) update without any subscribed clients, when controlled in hap-serveror when a controller is subscribed to changes) and from all accessories.npm install -g @hap-server/hap-server
# Or if that doesn't work
sudo npm install -g @hap-server/hap-server
This will install hap-server and link the hap-server
executable.
You can now run hap-server with your configuration. Once you've tested your configuration you'll probably want toset it up as a system service with systemd
(Debian), launchd
(macOS) or whatever service manager you haveinstalled.
hap-server requires a plugin to authenticate access to the web interface. You can use theauthenticate-pam plugin to allow local users on theserver to access the web interface. If you don't install an authentication handler you won't be able to access theweb interface, but you'll still be able to configure hap-server using it's configuration file.
npm install -g @hap-server/authenticate-pam
By default users with the IDs root
and cli-token
(the user used when running CLI commands) are administrators.When using the authenticate-pam plugin you'll need to assign your user an ID the first time you use it. (A propersetup workflow will be added soon.) Once you have an account setup you can make your account an administrator.
hap-server make-admin {user-id}
# Or with the path to the configuration file
hap-server make-admin {user-id} --config data/config.yaml
By default npm
will install from https://npmjs.com. You can configure npm
to install hap-server fromGitHub Package Registry by adding this to your npmrc
:
@hap-server:registry=https://npm.pkg.github.com
Run this to configure npm
to use GitHub Package Registry for @hap-server
scoped packages globally:
echo "@hap-server:registry=https://npm.pkg.github.com" >> `npm --global prefix`/etc/npmrc
You can also configure npm
to install hap-server from GitLab Package Registry by adding this to yournpmrc
:
@hap-server:registry=https://gitlab.com/api/v4/packages/npm/
Run this to configure npm
to use GitLab Package Registry for @hap-server
scoped packages globally:
echo "@hap-server:registry=https://gitlab.com/api/v4/packages/npm/" >> `npm --global prefix`/etc/npmrc
You can also configure npm
to install hap-server from GitLab Package Registry by adding this to yournpmrc
:
@hap-server:registry=https://gitlab.fancy.org.uk/api/v4/packages/npm/
Run this to configure npm
to use GitLab Package Registry for @hap-server
scoped packages globally:
echo "@hap-server:registry=https://gitlab.fancy.org.uk/api/v4/packages/npm/" >> `npm --global prefix`/etc/npmrc
Every change to the main
branch is published to the next
tag on GitLab Package Registry(on https://gitlab.com and https://gitlab.fancy.org.uk). After configuring npm
to install from one ofthose registries, you can install from main
with this:
npm install -g @hap-server/hap-server@next
To switch back to the latest stable version specify the latest
tag:
npm install -g @hap-server/hap-server@latest
Alternatively you can install from the git repository (or a mirror). When installing from git npm
will buildhap-server locally.
npm install -g git+https://gitlab.fancy.org.uk/hap-server/hap-server.git
# Or from GitHub
npm install -g git+https://github.com/hap-server/hap-server.git
# Or from gitlab.com
npm install -g git+https://gitlab.com/hap-server/hap-server.git
To run hap-server, just run hap-server
.
Samuels-MacBook-Air:~ samuel$ hap-server
[28/02/2019, 01:56:01] Starting hap-server with configuration file /Users/samuel/.homebridge/config.json
...
hap-server will exit with an error if the configuration file doesn't exist. To use a custom configuration file pathpass it as the first argument. hap-server allows you to write your configuration file in either JSON or YAML.
Samuels-MacBook-Air:~ samuel$ hap-server data/config.yaml
[28/02/2019, 01:56:01] Starting hap-server with configuration file /Users/samuel/Documents/Projects/hap-server/data/config.yaml
...
hap-server can automatically setup HTTPS with a self signed certificate and advertise the web interface with Bonjour.To use this add the --advertise-web-interface
flag.
Samuels-MacBook-Air:~ samuel$ hap-server data/config.yaml --advertise-web-interface
...
[27/07/2019, 01:00:03] You can access the web interface on your local network at https://hap-server-12b083b6-dd04-49a7-abac-171388e99db2.local:51820/,
[27/07/2019, 01:00:03] (remember to install the TLS certificate at /Users/samuel/Documents/Projects/hap-server/data/certificates/12b083b6-dd04-49a7-abac-171388e99db2.pem,
[27/07/2019, 01:00:03] fingerprint: c9:01:0c:f7:54:80:3d:b4:57:fd:33:27:c0:2f:f2:d2����b8:22����9a:ef:9e:56����7f:c9:05:c9:72:34:a4)
...
All Homebridge command line flags work with hap-server.
Samuels-MacBook-Air:~ samuel$ hap-server help
hap-server [config]
Run the HAP and web server
Commands:
hap-server [config] Run the HAP and web server [default]
hap-server make-admin <user> Promote a user to administrator
hap-server get-characteristics <config> Get characteristics
<characteristics>
hap-server set-characteristic <config> Set a characteristic
<characteristic> <value>
hap-server validate-configuration Validates a configuration file
<config>
hap-server version Show version number
Positionals:
config The configuration file to use [string] [default:
"/Users/samuel/Documents/Projects/hap-server/data/config.yaml"]
Options:
--debug, -D Enable debug level logging
[boolean] [default: false]
--timestamps, -T Add timestamps to logs
[boolean] [default: true]
--force-colour, -C Force colour in logs[boolean] [default: false]
--help Show help [boolean]
--advertise-web-interface Automatically setup a HTTP server with a self
signed TLS certificate for the web interface
and advertise it through Bonjour
[boolean] [default: false]
--advertise-web-interface-port Port to listen on for the automatically
advertised web interface
[number] [default: 51820]
--data-path, -U Path to store data [string]
--plugin-path, -P Additional paths to look for plugins at as
well as the default location ([path] can also
point to a single plugin) [array]
--print-setup, -Q Print setup information
[boolean] [default: false]
--allow-unauthenticated, -I Allow unauthenticated requests (for easier
hacking) [boolean] [default: false]
--user, -u User to run as after starting
--group, -g Group to run as after starting
To show the version number run hap-server version
.
Samuels-MacBook-Air:~ samuel$ hap-server version
hap-server version 0.11.0 release
homebridge version 0.4.50, API 2.4
hap-nodejs version 0.4.51
Node.js version 12.10.0, v8 7.6.303.29-node.16, native modules 72
npm version 6.11.3
hap-server stores data in a platform-specific default location (falling back to the same location as Homebridge) andsupports the same configuration format as Homebridge, as well as YAML. Using the same configuration as Homebridge,hap-server will behave exactly like Homebridge but will have a web interface for controlling accessories. UsingHomebridge and hap-server plugins at the same time are supported, however you shouldn't run multiple instances ofhap-server/Homebridge using the same data location.
Platform | Directory |
---|---|
macOS | ~/Library/Application Support/hap-server , ~/.homebridge , /Library/Application Support/hap-server |
Linux | ~/.config/hap-server , ~/.homebridge , /var/lib/hap-server |
For other platforms ~/.homebridge
is used.
You can also use hap-server programmatically with Server.createServer
.
import {Server} from '@hap-server/hap-server';
const server = await Server.createServer({
config: ...,
data_path: ...,
});
// See src/cli/server.ts to see what you can do with the Server object
# Clone the git repository
git clone https://gitlab.fancy.org.uk/hap-server/hap-server.git
cd hap-server
# Install dependencies
npm install
# Build/watch the backend and example plugins
npx gulp build-backend watch-backend build-example-plugins watch-example-plugins &
# Copy the example configuration
mkdir -p data
cp example-config/config.yaml data
# Run the server (this will build the frontend)
bin/hap-server data/config.yaml
To build the frontend in Gulp instead of the hap-server process (and disable webpack hot module replacement) addwatch-frontend
to the Gulp command and add the --no-webpack-hot
flag to the hap-server command.
To use the standalone Vue devtoolsrun npx vue-devtools
and pass the --vue-devtools-port
flag to hap-server
.
npx vue-devtools &
bin/hap-server data/config.yaml --vue-devtools-port 8098
# Also pass --vue-devtools-host if you want to use the Vue devtools to work on other devices
bin/hap-server data/config.yaml --vue-devtools-host samuels-macbook-air.local --vue-devtools-port 8098
hap-server supports all Homebridge plugins, but also has it's own plugin API that allows plugins to use hap-serverfeatures.
hap-server is built on Apple HomeKit/HAP,HAP-NodeJS and Homebridge.
hap-server is released under the MIT license.
If you'd like to contribute to hap-server pleasecreate an account on my GitLab server andcontact me (Tor).
类似APK的解压
我已经用HarmonyOS SDK建立了华为DevEco Studio,但未能启动新创建的项目: 我想,这可能是一个电话模块,但我有平板电脑硬件。 我该如何改变这一点--或者哪些模块适合“大屏幕”?
问题内容: 我想将 DataDable 传递给 存储过程作为 以下各列的 参数 : 现在,我想在存储过程中使用此数据表,并要在其上声明一个游标。然后使用该光标将值顺序插入数据库表中。 请告诉我如何在存储过程中 声明datatable参数* ,然后在该 参数 上使用 游标 ? * 问题答案: 首先,您需要创建一个类型: 现在,您的存储过程可以将其声明为只读输入参数: 我不确定为什么要在这里使用游标,
问题内容: 好的,问题是需要在2个表上进行合并或联接。一个文件的内容存储为[image]类型或varbinary(max),另一个文件的内容存储为十六进制字符串。如果我将相同的内容上传到两个表中 内容为字符串(从bytearray到字符串)看起来像这样… 图像的内容看起来像(这最终就是我想要的样子) 如果我选择我得到 看起来转换似乎已达到目标,但在每个之间放置了两个零(00),由于缺少更好的字词,
问题内容: 我的SQL Reporting Services报表有问题。我为报表标题使用了自定义字体,并且在部署到服务器时,当我打印或导出为PDF /TIFF时,它无法正确呈现。我已经在服务器上安装了字体。为了使用自定义字体,我还有什么需要做的吗? 在浏览器中查看字体时,它看起来是正确的-因为所有客户端计算机都安装了字体… 感谢Ryan,您在FAQ上的帖子解决了该问题。在服务器上安装字体可以解决打
问题内容: 我正在尝试使用try-catch捕获SQL查询(而不是存储过程)中的错误。 由于某种原因,这无法处理我的错误,但我仍然得到: 消息213,级别16,状态1,第29行列名或提供的值数与表定义不匹配。 有什么帮助吗? 问题答案: 您有一个编译时错误,无法在try-catch中捕获。 BooksOnline: 编译和语句级重新编译错误 如果错误在与TRY-ATCH构造相同的执行级别中发生,则