在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:maddox/harmony-api开源软件地址:https://github.com/maddox/harmony-api开源编程语言:JavaScript 75.3%开源软件介绍:Harmony API!!Harmony API is a simple server allowing you to query/control multiple local Harmony Home Hubs and their devices over HTTP or MQTT. With HTTP, you can simply turn on and off activities, check hub status, and send commands to individual devices with simple HTTP requests from almost any other project. With MQTT, you can easily monitor the state of your devices as well as set the current activity of your hub or send specific commands per device. This makes it super easy to integrate into your existing home automation setup. Features
Setup
SettingsHarmony API discovers your hubs automatically. You can optionally add your MQTT broker's host to connect to it. {
"mqtt_host": "mqtt://192.168.1.106",
"mqtt_options": {
"port": 1883,
"username": "someuser",
"password": "somepassword",
"rejectUnauthorized": false
},
"topic_namespace": "home/harmony"
}
Running ItGet up and running immediately with Note:On some distros, you might get an error when running it:
That can probably be fixed by creating a symlink:
Harmony API will run on port Foreverharmony-api has support for Forever. It uses
DevelopmentYou can simply run it by calling Install as Service on OS X
Install as systemd unit on Linux
DockerInstallation with Docker is straightforward. Adjust the following command so that
This will launch Harmony API and serve the web interface from port 8282 on your Docker host. Hub
discovery requires host networking ( LoggingHarmony API logs all of its requests. In How to Upgrade to 2.0Simply run You are then going to have to change anything you integrate with Harmony API to reflect the change in HTTP endpoints and MQTT topics. Read the docs in this README to see how they have changed. DevelopmentLaunch the app via MQTT Docsharmony-api can report its state changes to your MQTT broker. Just edit your
config file in By default harmony-api publishes topics with the namespace of: State TopicsWhen the state changes on your harmony hub, state topics will be immediately broadcasted over your broker. There's quite a few topics that are broadcasted. State topics are namespaced by your Harmony hub's name, as a slug. You can rename your hub in the Harmony app. Here's a list: Current StateThis topic describes the current power state. Message is
Current ActivityThis topic describes what the current activity of the hub is. The message is the slug of an activity name.
Activity StatesThese topics describe the state of each activity that the hub has. The message
is
Command TopicsYou can also command harmony-api to change activities, and issue device and acivity commands by publishing topics. harmony-api listens to these topics and will change to the activity, or issue the command when it sees it. Switching activitiesJust provide the slug of the hub and activity you want to switch to and
Device commandsJust provide the slug of the hub and the device to control with the command you want to execute.
To optionally repeat the command any number of times, provide an optional repeat integer.
Current activity commandsJust provide the slug of the hub and the command you want to execute.
To optionally repeat the command any number of times, provide an optional repeat integer.
HTTP API DocsThis is a quick overview of the HTTP service. Read app.js if you need more info. ResourcesHere's a list of resources that may be returned in a response. Activity ResourceThe Activity resource returns all the information you really need for an Activity set up in your Harmony Hub. {
"id": "15233552",
"slug": "watch-tv",
"label": "Watch TV",
"isAVActivity": true
} Device ResourceThe Device resource returns all the information you need to know about the devices set up for the hub. {
"id": "38343689",
"slug": "tivo-premiere",
"label": "TiVo Premiere"
} Command ResourceThe Command resource returns all the information you really need for a Command to let you execute it. {
"name": "ChannelDown",
"slug": "channel-down",
"label":"Channel Down"
} Status ResourceThe Status resource returns the current state of your Harmony Hub. {
"off": false,
"current_activity": {
"id": "15233552",
"slug": "watch-tv",
"label": "Watch TV",
"isAVActivity": true
}
} MethodsThese are the endpoints you can hit to do things. InfoUse these endpoints to query the current state of your Harmony Hub.
ControlUse these endpoints to control your devices through your Harmony Hub.
Contributions
|
2022-08-15
2022-08-17
2022-09-23
2023-10-27
2022-08-18
请发表评论