在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:cflurin/homebridge-mvc开源软件地址:https://github.com/cflurin/homebridge-mvc开源编程语言:JavaScript 100.0%开源软件介绍:homebridge-mvcHomebridge-mvc is a Plugin for Homebridge. This Example-plugin is based on MVC (Model-View-Controller) pattern. Have a look at homebridge-mqtt for a practical implementation. InstallationIf you are new to homebridge, please follow the instructions in homebridge for the homebridge server installation. Install homebridge-mvc: sudo npm install -g homebridge-mvc ConfigurationAdd the platform in config.json in your home directory inside {
"platform": "mvc",
"name": "mvc"
}
API
Howto examples
var platform_name = "myPlatform"; Note: remeber to change
add accessoryaccessory = {"name": "flex_lamp", "service_name": "light", "service": "Switch"};
result = addAccessory(accessory); add serviceNote: an accessory with the same name must be added before. accessory = {"name": "multi_sensor", "service_name": "Humidity", "service": "HumiditySensor"};
result = addService(accessory); remove accessoryaccessory = {"name": "flex_lamp"};
result = removeAccessory(accessory); remove serviceaccessory = {"name": "multi_sensor", "service_name": "Humidity"};
result = removeService(accessory); get accessory/accessoriesThe purpose of this function is to retrieve accessory definitions. accessory = {"name": "outdoor_temp"};
result = getAccessories(accessory); accessory = {"name": "*"};
result = getAccessories(accessory); set valueaccessory = {"name": "flex_lamp", "service_name": "light", "characteristic": "On", "value": true};
result = setValue(accessory); update reachabilityaccessory = {"name": "flex_lamp", "reachable": true};
or
accessory = {"name": "flex_lamp", "reachable": false};
result = updateReachability(accessory);
set accessory informationaccessory = {"name": "flex_lamp", "manufacturer": "espressif", "model": "esp8266-12", "serialnumber": "4711"};
result = setAccessoryInformation(accessory); get (from homebridge)Model.prototype.get = function(name, service_name, characteristic) {...} set (from homebridge)Model.prototype.set = function(name, service_name, characteristic, value, callback) {...} identify (from homebridge)Model.prototype.identify = function (name, manufacturer, model, serialnumber) {...} define charactersticThe required characteristics are added with the default properties. If you need to change the default, define the characteristic-name with the properties. e.g.: accessory =
{
"name": "living_temp",
"service": "TemperatureSensor",
"CurrentTemperature": {"minValue": -20, "maxValue": 60, "minStep": 1}
};
result = addAccessory(accessory); To add an optional charachteristic define the characteristic-name with "default" or with the properties. e.g.: accessory =
{
"name": "living_lamp",
"service": "Lightbulb",
"Brightness": "default"
};
result = addAccessory(accessory); accessory =
{
"name": "bathroom_blind",
"service": "WindowCovering",
"CurrentPosition": {"minStep": 5},
"TargetPosition": {"minStep": 5},
"CurrentHorizontalTiltAngle": {"minValue": 0, "minStep": 5},
"TargetHorizontalTiltAngle": {"minValue": 0, "minStep": 5}
};
result = addAccessory(accessory); HomeKitTypes.js describes all the predifined Services, Characteristcs, format and properties for the
Derived from this:
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论