As you all know in the new version of Homebridge, the plugin architecture is changed. In new Homebridge, plugins are published through NPM with name starts with homebridge-. Users can install the plugin using NPM.
You can install it using NPM like all other modules, using:
npm install -g homebridge-particle-io
.
In this version, I have made some changes from the older version. Mainly the plugin is now a Homebridge Platform. Also in this version accessories are defined in config.json
file. The plugin loads the accessories from the config.json
file and create accessory dynamically. A sample configuration file is like:
{
"bridge": {
"name": "Homebridge",
"username": "CC:22:3D:E3:CE:39",
"port": 51826,
"pin": "031-45-154"
},
"description": "This is an example configuration file with one Particle platform and 3 accessories, two lights and a temperature sensor. You should replace the access token and device id placeholder with your access token and device id",
"platforms": [
{
"platform": "ParticleIO",
"name": "Particle Devices",
"access_token": "<<access token>>",
"cloud_url": "https://api.particle.io/v1/devices/",
"devices": [
{
"name": "Bedroom Light",
"type": "lightbulb",
"device_id": "<<device id>>",
"function_name": "onoff",
"args": "0={STATE}"
},
{
"name": "Kitchen Light",
"type": "lightbulb",
"device_id": "<<device id>>",
"function_name": "onoff",
"args": "1={STATE}"
},
{
"name": "Kitchen Temperature",
"type": "temperaturesensor",
"device_id": "<<device id>>",
"event_name": "tvalue",
"split_character": ":"
}
]
}
]
}
As you can see from the above example this config.json
file defines 3 accessories. 2 Lights and one Temperature Sensor. The access_token defines the Particle Access Token and cloud_url defines the base Particle API url. If you are using the Particle Cloud, then the value of cloud_url should be https://api.particle.io/v1/devices/. If you are using local cloud, then replace with your sensor address.
The devices
array contains all the accessories. You can see the accessory object defines following string objects:
lightbulb
, temperaturesensor
and humiditysensor
.temperaturesensor
or humiditysensor
). The plugin listens for events published from a Particle Device (using Particle.publish
). The device firmware should publish the sensor values as a raw number.power
will be used. This is only valid if the accessory is an actor (i.e. lightbulb
or switchaccessory
).By default it expects the event data as "key=value".
Particle.publish("tvalue", "temperature=20.7")
In order to parse JSON format, a custom split_character
can be configured.
Particle Jekyll Theme This is a simple and minimalist template for Jekyll designed for developers that want to show of their portfolio. The Theme features: Gulp SASS Sweet Scroll Particle.js BrowserSy
NativeScript Particle plugin Prerequisites Hop on over to the Particle.io store and order any or all of their cool devices. While developing this plugin and the demo app I used a Photon Kit and it was
简介 react-particle-effect-button 的 Vue 实现,零依赖(除 Vue 外)。 可以在 Vue 中实现粒子特效。 演示地址 Vue Particle Effect Buttons 安装教程 将 particle-effect.vue 复制到你的项目目录中,自行修改适配。 下载项目所有文件后,如果想在本地调试代码,请执行以下命令: yarn installyarn de
在本章开始时,我们已经介绍过粒子组了,默认下,粒子都属于空组("")。使用GroupGoal控制器可以改变粒子组。为了实现可视化,我们创建了一个烟花示例,火箭进入,在空中爆炸形成壮观的烟火。 这个例子分为两部分。第一部分叫做“发射时间(Launch Time)”连接场景,加入粒子组,第二部分叫做“爆炸烟花(Let there be firework)”,专注于粒子组的变化。 让我们看看这两部分。
Particles are essentially 2D images rendered in 3D space. They are primarily used for effects such as smoke, fire, water droplets, or leaves. A Particle System is made up of three separate Components:
到目前为止我们只使用了基于粒子画笔的图像来实现粒子可视化。Qt也提供了一些其它的粒子画笔: 粒子项(ItemParticle):基于粒子画笔的代理 自定义粒子(CustomParticle):基于粒子画笔的着色器 粒子项可以将QML元素项作为粒子发射。你需要制定自己的粒子代理。 ItemParticle { id: particle system: part