norman-thomas / homebridge-particle-io Goto Github PK
View Code? Open in Web Editor NEWHomebridge plugin for Particle Devices
Homebridge plugin for Particle Devices
Hey there,
I was wondering if there’s any way to set up a device that doesn’t perform any sort of state check, like a toggle. My function needs to run on-demand and then return, and it seems that this integration causes HomeKit to run my device’s function every time it checks the device’s state (on/off) and not just when the user toggles it.
Or perhaps I’m misunderstanding the config and there’s some way to specify the device’s state checking function?
This plugin currently only supports lightbulbs and temperature/humidity/light sensors.
HomeKit offers my more Services
and Characteristics
useful for Particle.io IoT projects.
Consider implementing some of the following Services
:
The changes in the v0.0.9 changes related to Hue and Dimmable lightbulbs appear to break the ability to use custom function names for devices.
As of v0.0.8, the function_name
value could be set in config.json to specify the Particle function to call for getting/setting state. In my particular use case, I have a single Particle controlling two different lights (via a relay board), so I was using a different function name value for each to allow independent control.
In v0.0.9, the calls to the Particle function have been changed to a static string and the function_name
config.json value has no effect. There is probably a workaround on the "set" side (by giving the args
config value a unique prefix), but on the "get" side the call will always be to the "power" function with an argument of "?" - meaning Particle hosting multiple devices can't distinguish which device is being queried.
This may be something @jakeholland wants to check out too, since the changes were mostly brought on by the RGB/dimmable implementation. I haven't yet spent the time to fully comprehend the code flow, but I'd think a solution might be to prefix or suffix the static strings used for hue, power, saturation, etc. with the config.json-specified function_name
value?
Awesome project! Exactly what I was looking for, thanks.
I'm looking to automate my motor driven sunscreens. Would it be possible for you to add blinds/shades support to the plugin?
Cheers
Some time ago I created speaker accessory support. I'm successfully controlling volume with a particle hooked on to my non-smart speaker, I will add my PR to this issue.
The plugin is constantly sending data to the particle cloud, it causes my lights to go on/off and stuff. Any idea what could be causing this please?
Hi guys, looking for some guidance here... I am attempting to use the plug-in to power a hardware hack.
simple particle function/API called "power" to control the pins on my particle.
json file is as follows and error at the bottom.
Looks like it cannot interpret the "name" string, which I am assuming is the devices name but???
Also I cannot figure out who the args are supposed to work. If I want to feed it a simple strong of on or off.. how do I go about that?
Thanks
"platform": "ParticleIO",
"name": "Particle Devices",
"access_token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"cloudurl": "https://api.spark.io/v1/devices/",
"devices": [
{
"name": "Coffee Machine",
"type": "lightbulb",
"device_id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"function_name": "power",
"args": "on={STATE}"
type: 'lightbulb',
device_id: 'xxxxxxxxxxxxxxxxxxxxxx',
function_name: 'power',
args: 'on={STATE}' }
�[37m[2017-12-13 12:59:57]�[39m �[36m[Particle Devices]�[39m Initializing platform accessory 'Coffee Machine'...
�[37m[2017-12-13 12:59:57]�[39m Loading 1 accessories...
/usr/local/share/.config/yarn/global/node_modules/homebridge/lib/api.js:50
if (name.indexOf('.') == -1) {
^
TypeError: Cannot read property 'indexOf' of undefined
How would one be able to have two different lightbulb accessories running on the same Particle device?
For an on/off device this would not be a problem because a different function name could be specified I think. But how could that work for two dimmablelightbulbs?
Thanks!
Problem:
The current plugin requires it's own syntax of how data is published to particle (key=value):
Particle.publish("tvalue", "temperature=20.7");
Proposal:
It's a common approach to group multiple values together in a single event with JSON format in order to limit the number of messages to the particle cloud.
https://www.w3schools.com/js/js_json_objects.asp
JSON objects are surrounded by curly braces {}.
JSON objects are written in key/value pairs.
Keys must be strings, and values must be a valid JSON data type (string, number, object, array, boolean or null).
Keys and values are separated by a colon.
Each key/value pair is separated by a comma.
As an example, an indoor room sensor might transfer the following values:
The corresponding particle event would look like this (data is limited to 255 byte):
Particle.publish("airquality", "{\"temp\":20.7,\"humid\":45,\"voc\":98,\"co2\":410\"}");
Consider using Particle's Javascript SDK instead of direct request.post
and request.get
calls.
The code is not covered by tests yet.
Not sure why this showed up.
Hi,
Thanks for the plugin. I was wondering whether the additional characteristics for the lightbulb could be added to the existing lightbulb accessory, (from https://github.com/KhaosT/HAP-NodeJS/blob/master/lib/gen/HomeKitTypes.js, i.e.)
this.addOptionalCharacteristic(Characteristic.Brightness);
this.addOptionalCharacteristic(Characteristic.Hue);
this.addOptionalCharacteristic(Characteristic.Saturation);
this.addOptionalCharacteristic(Characteristic.Name);
Hi,
I just started tinkering with Homebridge and after I found your plugin I played around a little with my photon.
After trying out a few things with it I have two questions.
Is there a way to tell Homebridge wich state the "ParticleLamp" is in?
The HomeKit Screen and Siri seem not to be able to know the state of the lamp.
When I ask Siri if the Lamp is on she always tells me its off and Homebrige logs this:
Calling function: " https://api.particle.io/v1/devices/DEVICEID/onoff " with arg: ?
Is the plugin expecting a certain return value from the onoff-function when using "?" as the state parameter?
Are you planning to implement RGB-Accessory?
Instead of on/off it would be really cool if RGB would work.
Here is a Fake/Dummy-RGB accessory.
I will look into that a little closer the next days. I just thought you might be interestet.
I was wondering, the sensor accessories work by listening to events published to the Particle Cloud. When changing the state of an actor accessory, everything in Homekit goes fine. However, when the Particle changes the accessory state (in any other way than through Homekit), the state in Homekit isn't updated.
Would it be an option to also let actor accessories listen to events? This way Particle can update the state in Homekit. If I'm mistaken, and this already is a feature, could you please let me know?
Thanks
I understand from the code that the latest version supports dimmable and colour light accessories.
Can you please provide configuration examples as well as code examples on the Particle side? Or point us to external examples?
The current version of this plugin does not seem to run the particle functions and arguments as defined in the config.json. It only seems to run a function call "power". Is there a way to bring back the functionality that allows you to name the particle function and arguments you would like to call?
ESLint is quite unsatisfied with index.js
.
Fix the complaints from ESLint and make index.js
pass.
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.