GithubHelp home page GithubHelp logo

homebridge-mqtt's People

Contributors

cflurin avatar emes avatar frankiboy1 avatar ihatemyisp avatar mriksman avatar noodom avatar ragacs avatar roscoe81 avatar yuyi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

homebridge-mqtt's Issues

STRING characteristic type not handled correctly + Fix Howto

Due to the lack of custom characteristics I added an "InputSource" Service and a Source Characteristic in HomeKitTypes.js of HAB_Node as a workaround.

/**
  * Characteristic "Source"
  */

Characteristic.Source = function() {
  Characteristic.call(this, 'Source', '00000001-0000-2000-8000-0026BB765291');
  this.setProps({
    format: Characteristic.Formats.STRING,
    perms: [Characteristic.Perms.READ, Characteristic.Perms.WRITE, Characteristic.Perms.NOTIFY]
  });
  this.value = this.getDefaultValue();
};

inherits(Characteristic.Source, Characteristic);

Characteristic.Source.UUID = '00000001-0000-2000-8000-0026BB765291';

/**
 * Service "InputSource"
 */

Service.InputSource = function(displayName, subtype) {
  Service.call(this, displayName, '00000002-0000-2000-8000-0026BB765291', subtype);

  // Required Characteristics
  this.addCharacteristic(Characteristic.Source);

  // Optional Characteristics
  this.addOptionalCharacteristic(Characteristic.Name);
};

inherits(Service.InputSource, Service);

Service.InputSource.UUID = '00000002-0000-2000-8000-0026BB765291';

I have a python deamon running at the other mqqt end. I had success with two switches (AMP and TV) where I was able to alter the Source of both AMP and TV.

However there was a problem with getting the value into HomeKit over homebridge-mqqt.
after enabling some debug statements and starting with "home bridge -D" it turned out to be a simple fix.

in /lib/accessory.js - Accessory.prototype.parseValue

in

switch(sc.props.format)( { // Added by me case "string": break; // End of Fix

in the default: section, change the line // string, tlv8 accordingly.

Helmsman35

Connect error

HI,

I'm getting the following connection error when I try run homebridge-mqtt

[1/3/2018, 7:42:25 PM] [mqtt] connect error! (url = wss://m12.cloudmqtt.com:30149)
[1/3/2018, 7:42:50 PM] [mqtt] on.offline
[1/3/2018, 7:42:50 PM] [mqtt] on.close
[1/3/2018, 7:42:51 PM] [mqtt] on.reconnect
[1/3/2018, 7:43:21 PM] [mqtt] on.close
[1/3/2018, 7:43:22 PM] [mqtt] on.reconnect

This is how my config.json looks:
{
"platform": "mqtt",
"name": "mqtt",
"url": "wss://m12.cloudmqtt.com:30149",
"topic_type": "multiple",
"topic_prefix": "homebridge",
"username": "username",
"password": "password"
},

I've tried changing the url protocol to mqtt, mqtts, etc. I've also tried removing the port (mqtt://m12.cloudmqtt.com) but everything gives the same "Connect error!" message. This seems like it could have a simple fix but I'm not sure where to focus my debugging anymore. I've got an ESP8266 and a node-red successfully connecting to the same cloudmqtt broker so I think the broker is configured correctly.

Any ideas?

Set Accessory Status?

If I reply to getAccessory even with "false" i.e. outlet status it still show as on. Same with contact sensors and switches. How do I correctly respond to the get queries? Or should I only respond if its "On", but then how do I set a false status if the control happens outside of homekit? I'm replying on "homebridge/to/set" with the current values. I just can't seem to get it to work.

How to correctly set "lockables"

Hi, I have tried to set Security System, Lock Mechanism, Garage Door Opener, Blinds etc. and all these always stay in Arming..., Locking..., Opening... or so states and never finishes the job. How to correctly do the job and then tell Home.app (Homebridge) to finally set the status.

I'm using Node-RED so please possibly reply with solution for NR as it would be easiest way anyway. Thank you in advance for your time.

Handling of negative temperature values

Perhaps a beginners question but I have a problem with handling negative temperature values. Sending a command with the following payload works: {payload:{"name": "outdoor_temp", "characteristic": "CurrentTemperature", "value": "7"}}

But if I instead issue the command {payload:{"name": "outdoor_temp", "characteristic": "CurrentTemperature", "value": "-7"}} I get the following error: [mqtt] Accessory.parse outdoor_temp CurrentTemperature value '-7' outside range.

Is there any way to work around negative values?

dimming a light....

If I have a lamp, which is off, by siri dimme to 10%, is sent by mqtt following:

{"Name": "Living room light one", "service_name": "", "characteristic": "On", "value": true}

And immediately after that:

{"Name": "living room light one", "service_name": "", "characteristic": "Brightness", "value": 20}

Why is the first info sent that light is on?

Can one change the only dimm value comes?

update homekit UI when event happens outside homekit

I've been hunting through your code to figure out how you ended up getting around the issue where someone changes state, but not from within the homekit UI (say someone presses a button on the wall). Right now all is well with my plugin so long as everyone uses homekit to toggle the lights, once a wall button is pressed everything is out of sync. My code (for CBus) very closely models this plugin https://github.com/YahavGB/homebridge-mox

[feature request] ack from device

Hello.

Firstly, I want to thank you for this excellent plugin.

It would be perfect if there were optional some kind of requirement of “ack” from device that subscribed to homebridge/from/set. It is very important because user should know if the device isn’t responding.

Timeout -> device reachability state will be changed to “not available”.

When user acts with real HomeKit accessory, for example, taps the “Lamp” icon to turn it on, but it has somehow hung up, the spinning wheel appears, and after some time timeout and error happens, so user knows that there’s some problem with the Lamp accessory.

Now the spinning wheel (pending state) appears only for the time of publishing, and there’s no feedback except reachability status set by publishing it into topic homebridge/to/set/reachability.

Thank you in advance!

Sorry for my English.

Best wishes,
Fedor Zhuromsky

No Response Issue

Hi

On my network i have to raspberry pi`s running Homebridge number one is running Mqtt and the other is running other platforms.

On the one running your mqtt i have an issue where suddenly after a few days all devices are not responding. I get a "No response" message on the devices.
Checking the log file devices continue to be updated from mqtt and the Bridge running mqtt is responding in homekit.

I think something is triggering the no response but can not find what

Support for mqtts and client certificates.

I've set up my broker to require client sertificates, which homebridge-mqtt does not support. I'm not too familiar with javascript, but made an attempt to add this support. (Also, I'm not familiar with github, so I don't have a proper patch.)

Making the change below to enable the new support:

diff model.js.orig model.js

4a5

var fs = require('fs');
43a45
options.port = this.config.port || 1883;
47a50,58
if(this.config.cert != null) {
options.cert = fs.readFileSync(this.config.cert);
}
if(this.config.key != null) {
options.key = fs.readFileSync(this.config.key);
}
if(this.config.ca != null) {
options.ca = fs.readFileSync(this.config.ca);
}

This will add the following configuration options:

"platforms": [
    {
        "platform": "mqtt",
        "name": "mqtt",
        "url": "mqtts://mqtt.example.com",
        "port": 8883,
        "topic_prefix": "homebridge",
        "username": "username",
        "password": "password",
        "cert": "/path/to/certificate.pem",
        "key":  "/path/to/key.pem",
        "ca":   "/path/to/ca_certificate.pem"
    },

I've made some basic testing and it did not break anything in my setup. Hope this can be added so I don't have to maintain my own patch.

Frank

Set the retained flag

Hello and thanks for this work, I am having great success with it.
I wonder if there is a way to set the publish "retained" flag to true with homebridge-mqtt ?
I am building an esp8266 pushbutton that goes to sleep, but needs to be aware of the last status of the controlled device when it wakes up.
Many thanks.

Feature Request: Enable HomeKit accessory History

Elgato Eve supports viewing HomeKit accessory device history (like temperature over time). I have a temperature/humidity accessory setup and am updating the values via MQTT. It would be great if we could also view the history of accessories created with the MQTT plugin.

I'm not sure if other accessory types support history, but I could see it being useful for things like motion sensors.

See this plugin for an example: https://github.com/simont77/fakegato-history

And here's a screenshot of what it looks like in Eve

Thermostat: i can't set the current temperature :-(

I have add a Thermostat and i can set the target Temp and the current Heatingstae, but it dosen't work to set the currentTemperature, it came not a erro message but the currentTemperature value is allways n.v. or 0.0°C 👎

Can you please help my ?

Device "jump" back to Default Room

If I move a device to a particular room but an error occurs such as sending an unknown service_name, the device is not longer in the room and I find it back in the Default Room.

no_responce --> no_response

In case of not reachable, the callback is called with "no_responce". Shouldn't that read "no_response" instead. Thanks for the great plugin.
Franz

Controlling Devices

Heyy,

maybe Im just too stupid.
i can connect to the Homebridge and im able to add or remove stuff via homebridge/to/add or /remove.
If I do so, i can change work with them; of course.
But I really dont know, how to deal with existing switchs, bulbs etc.
If I try to use homebridge/to/set or homebridge/from/set nothing happens.
Using homebridge/to/set receives an error of the undefined name, of course.

thanks

Not an issue, just wanted to say thanks.

I just started playing with homekit and was wondering if there is a way to use node-red as the "backend". Till I saw your post just now on a homebridge issue I had no idea how this can be done. Thank you so much! Hopefully the notes on your homebridge-mqtt repo will help me move towards this very fast.

Thank you!

ContactSensor not able to set ContactState

Hi @cflurin,

could you please help me out?

I have created door sensor (ServiceTypeContactSensor) like so:

{"name":"Door Sensor","service":"ContactSensor"}

and trying to set ContactState characteristic like so:

{"name": "Door Sensor","characteristic": "ContactState","value": 1}

but I get:

{"ack":false,"message":"characteristic 'ContactState' undefined."}

Maybe I'm just doing something wrong again.

I have also tried to add it like:

{"name":"Door Sensor","service":"ContactSensor","ContactState":"default"}

and set like:

{"name":"Door Sensor","ContactState":1}

with response:

{"ack":false,"message":"characteristic 'undefined' undefined."}

So no luck at all ;)

Thank you in advance.

Elgato Eve Weather

Is it possible to publish the temperature, humidity and pressure from an Elgato Eve Weather Sensor via MQTT? I have this nice little sensor and want to log the data of the sensor and make it available not only in the EVE-App (which is pretty nice) but also in some other applications, like my MagicMirror. Any Ideas of how to do that?

Thank you!
Markus

Reachability

I've added homebridge/to/set/reachability

topic: homebridge/to/set/reachability
payload: {"name": "flex_lamp", "reachable": true}
or
payload: {"name": "flex_lamp", "reachable": false}

Please install from GitHub:

sudo npm install -g cflurin/homebridge-mqtt

[Feature Request] add name to Topic to reduce the IoT processing power usage

Hi cflurin,
Thank you for making this excellent plugin!

If we add the device name to the topic, we can reduce IoT CPU power usage and network usage.
(the IoT can just subscription topic about itself)

Sorry for my English.
Thank you very much😃

yuyi

Example

add accessory

topic: homebridge/to/add/flex_lamp
payload: {"name": "flex_lamp", "service_name": "light", "service": "Switch"}

response

topic: homebridge/from/response/flex_lamp
payload: {"ack": true, "message": "accessory 'flex_lamp' service_name 'light' is added."}

Multi-Services

It's not clear to me how to handle multi-service devices. The simplest example being a humidity/temperature sensor (although a thermostat would have many more services and characteristics).

Intuitively, I'd pass a list to add like:
{'services': [{'service_name': 'Temperature', 'service': 'TemperatureSensor'}, {'service_name': 'Humidity', 'service': 'HumiditySensor'}], 'name': 'Master Bath'}
then update values similarly but the plug-in throws an "invalid JSON format" error. So now I currently have to send each payload separately.

Can you document how to handle adding and sending values for this simple example? Then I can figure out more complicated devices like my thermostats.

How to retain the status of accessory when restart Homebridge?

Hi,
When I restart Homebridge the value and status of accessories are reset. Is there a way to retain it? For example I set my thermostat TargetHeatingCoolingState to 2, but it changes back to 0 after restart. I'm using Mosquitto btw.

Thanks and appreciate you help,

Motion detection

Hello,

Could you please help me with payload for motion detection event?
I'm trying to send following to homebridge/to/set topic:
{"name":"MotionSensor1","service_name":"Motion 1","service":"MotionSensor","characteristic":"MotionDetected","value":true}

but it does not work for some reason

receive all the connected devices

topic: homebridge/to/get
payload: {"name": "*"}

this will only work when your topic_type is on multiple.

if my topic_type is on single i don't receive the data on the following topic: 'homebridge/from/response'

Any suggestions?

Documentation update

@cflurin homebridge-mqtt has come a long way and it is getting more popular on npm as well :-)
There are a few points I would like to point out for the documentation:

get accessoy/accessories should read get accessory/accessories (missing 'r')

The response for get accessory/accessories is not correctly described.
Instead of the described response in the documentation for homebridge/to/get {"name":"outdoor_temp"}

topic: homebridge/from/response
payload:
{
	"outdoor_temp": {
   	    "services": {"Temperature": "TemperatureSensor"}, 
   	    "characteristics": {"CurrentTemperature": "13.4"}
    }
}

it should read

topic: homebridge/from/response
payload:
{
    "outdoor_temp": {
        "services": {"Temperature": "TemperatureSensor"}, 
        "characteristics": {
            "Temperature": {CurrentTemperature": 13.4}
        }
    }
}

and for the response of all accessories

topic: homebridge/from/response
payload:
{
    "node_switch":{
        "services":{"light":"Switch"},
        "characteristics": {
            "light": {"On":true}
        }
    },
    "office_lamp":{
        "services":{"office_light":"Lightbulb"},
        "characteristics":{
            "office_light": {
                "On":"blank",
                "Brightness":65
            }
        }
    },
    "living_temp":{
        "services":{"living_temperature":"TemperatureSensor"},
        "characteristics":{
            "living_temperature": {"CurrentTemperature":19.6}
        }
    }
}

homebridge-websocket or homebridge-mqtt?

Hi,
Sorry not really an issue but I don't know where to ask instead.
I'm new to Raspberry PI, homebridge and everything so I'm not really sure what plugin to use to realize my project.

Projet goal:

  • Control RF sockets, Wifi Lights, Temperature sensors via Apple Home (Homebridge), and via Web UI (node-red), later Amazon Echo (Alexa).

What I did so far:

  • Set up Raspberry PI 3 as a server in my home
  • install node-red and get my china no-name wifi led strip controller to work
  • RF 433mhz sensor connected to the GPIOs with n8henrie/homebridge-rcswitch-gpiomem integrated in Apple Home / Siri

What I still want to do:
1: Control the RCSwitch stuff from node-red over a web surface
2. Controll the wifi led strips that I currently only control with node-red with Siri

What is the best of your plugins to use for that?
How does it work? Do I setup all my devices and stuff in node-red and your plugins "automatically" add them to the homebridge config and make it visible for Apple Home?

Thanks for help, suggestions and tips :)

Identify Accessory

Am I missing this or does the identify accessory not get passed through?

Bug in accessory.js save_and_setValue

@cflurin I upgraded to version 0.3 and removed/added all my accessories.
My accessories are confirming homebridge/from/set by sending a homebridge/to/set once the
accessory reported that the new value was set. This worked for 0.2.4 but cause an infinite loop with homebride-mqtt sending a homebridge/from/set after the homebridge/to/set message and so on.

The change was caused by a bug in accessory.js. Line 313 should read
var context = this.i_label[service_name][c];
instead of
var context = this.i_label[c];

firmwarerevision cannot be empty

I'm not sure if it is in homebridge or mqtt this is an error, but it seems like it crashes when the firmwarerevision is empty. This is when I reset the whole configuration and add a bridge and then each accessory (they add automatically in iOS 11, one at a time. It think it is here it asks for the firmwarerevision)
18:04:20 - [mqtt] identify name 'fönsterbadrum' manufacturer 'homebridge-mqtt' model 'v0.4.5' serialnumber '2017-10-19T05:41' firmwarerevision '' 18:04:20 - TypeError: Cannot read property 'value' of undefined at Controller.identify (/usr/local/lib/node_modules/homebridge-mqtt/lib/controller.js:389:132) at Accessory.identify (/usr/local/lib/node_modules/homebridge-mqtt/lib/accessory.js:302:3) at Accessory.<anonymous> (/usr/local/lib/node_modules/homebridge-mqtt/lib/accessory.js:219:61) at emitTwo (events.js:87:13) at PlatformAccessory.emit (events.js:172:7) at PlatformAccessory.<anonymous> (/usr/local/lib/node_modules/homebridge/lib/platformAccessory.js:155:12) at emitTwo (events.js:87:13) at Accessory.emit (events.js:172:7) at Accessory._identificationRequest (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/Accessory.js:121:10) at Accessory.<anonymous> (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/Accessory.js:940:14) at emitMany (events.js:108:13) at Characteristic.emit (events.js:182:7) at Characteristic.setValue (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/Characteristic.js:292:10) at Bridge.<anonymous> (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/Accessory.js:812:22) at Array.forEach (native) at Bridge.Accessory._handleSetCharacteristics (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/Accessory.js:757:8) at emitMany (events.js:108:13) at HAPServer.emit (events.js:182:7) at HAPServer._handleCharacteristics (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/HAPServer.js:972:10) at HAPServer.<anonymous> (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/HAPServer.js:209:39) at emitNone (events.js:67:13) at IncomingMessage.emit (events.js:166:7) at endReadableNT (_stream_readable.js:893:12) at doNTCallback2 (node.js:429:9) at process._tickDomainCallback (node.js:384:17) 18:04:21 - Unhandled Error Detected : TypeError: Cannot read property 'value' of undefined at Controller.identify (/usr/local/lib/node_modules/homebridge-mqtt/lib/controller.js:389:132) at Accessory.identify (/usr/local/lib/node_modules/homebridge-mqtt/lib/accessory.js:302:3) at Accessory.<anonymous> (/usr/local/lib/node_modules/homebridge-mqtt/lib/accessory.js:219:61) at emitTwo (events.js:87:13) at PlatformAccessory.emit (events.js:172:7) at PlatformAccessory.<anonymous> (/usr/local/lib/node_modules/homebridge/lib/platformAccessory.js:155:12) at emitTwo (events.js:87:13) at Accessory.emit (events.js:172:7) at Accessory._identificationRequest (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/Accessory.js:121:10) at Accessory.<anonymous> (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/Accessory.js:940:14) at emitMany (events.js:108:13) at Characteristic.emit (events.js:182:7) at Characteristic.setValue (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/Characteristic.js:292:10) at Bridge.<anonymous> (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/Accessory.js:812:22) at Array.forEach (native) at Bridge.Accessory._handleSetCharacteristics (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/Accessory.js:757:8) at emitMany (events.js:108:13) at HAPServer.emit (events.js:182:7) at HAPServer._handleCharacteristics (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/HAPServer.js:972:10) at HAPServer.<anonymous> (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/HAPServer.js:209:39) at emitNone (events.js:67:13) at IncomingMessage.emit (events.js:166:7) at endReadableNT (_stream_readable.js:893:12) at doNTCallback2 (node.js:429:9) at process._tickDomainCallback (node.js:384:17)

multiple services on a single accessory

As far as i can see, it is currently not possible to add an accessory with multiple service. I think this should be possible, at least HAP-NodeJS supports this, and so i think homebridge will also do. But when an accessory is added through homebridge-mqtt, i see no way to do this.

topic: homebridge/to/add
payload: {"name":"office_lamp","service":"Switch"}

I would suggest something like this (if possible):

topic: homebridge/to/add
payload: {"name":"office_lamp","services":{"myfirstservice":"Switch","mysecondservice":"Switch"}}

What payload to send for camera configuration?

I've been playing around with the homebridge-camera-ffmpeg and have gotten a pi3 with the camera module working with this plugin. All the other accessories I have I added through homebridge-mqtt and I would prefer to just stick with it. Can you provide any clue as to what I need to pass to homebridge to set up a camera video/audio feed? It already streams in rtp/rtsp. I tried to pass the rtp stream url to the "supported configs" but just got invalid payload.

Connect error

I get a connect error when trying to connect to my mqtt broker:

[10/26/2016, 12:32:19 PM] [mqtt] connect error! (url = mqtt://192.168.1.100:1883)

my config file is:
"platforms": [
{
"platform": "mqtt",
"name": "mqtt",
"url": "mqtt://192.168.1.100:1883"
}
],
"accessories": []

}

I have also tried excluding the port at the end. running this off a raspberry pi B+

apologies my firewall was blocking it. this can be cancelled

Multiple added devices Indistinguishable

I got one sensor working through my tests so I added 5 DHT/Temperature/Humidty sensors. Each had a unique "name" and unique "service_name" (not sure how each of these attributes are used internally) but when I opened up the Home App, there was no way to determine which device was which name.

I ended up one-by-one sending arbitrary data to identify the home app device and move it to a Room but the room change didn't stick - it was gone when I moved the next device.

Note: for this test I was not responding to any homebridge/from/get topics - just sending homebridge/to/set topics.

I ended up just removing all and will try again later. Any thoughts?

Problem when homekit updates two or more identical characteristics on different accessories at the same time

Environment:

  • Setup 2 accessories that could set characteristics (ex: 2 Thermostat or 2 WindowCovering)
  • If you are using Siri, you can control both accessories at once: "Hey Siri, set the temperature to 20°"

Symptom:

  • Homebridge receive 1 request from HomeKit to set 2 characteristics on 2 different accessory:
  Accessory [HomeBridge] Processing characteristic set: [{"aid":50,"iid":10,"value":25},{"aid":51,"iid":10,"value":25}] +1ms
  Accessory [HomeBridge] Setting Characteristic "Target Position" to value 25 +0ms
  Accessory [HomeBridge] Setting Characteristic "Target Position" to value 25 +3ms
  • Homebridge-mqtt handle only one of the 2 commands and after few seconds, Siri complains he didn't receive response from the system.

Cause:

  • When a set command is received, a set_timeout is started (to avoid flooding?). If the same characteristic is set within the next 250ms, the first set_timeout is cancelled and a new one is started.
          if (set_timeout && c === pre_c) {
            console.log("clearing timeout...")
            clearTimeout(set_timeout);
          }
          set_timeout = setTimeout(function() {
            console.log("calling Mqtt.set...")
            Mqtt.set(this.name, c, value, callback);
          }.bind(this), 250);
          pre_c = c;

Fix/Workaround:
Never cancel the timeout or implement a per accessory timeout.

BTW, that code can also have strange results in some theoretical situation:

  • one characteristic is updated, then another one, then the first one again within 250 ms...

example of garageport in node-red (to put in wiki)

@oriolism
[{"id":"MQTT.Localhost","type":"mqtt-broker","broker":"localhost","port":"1883","clientid":""},{"id":"12aa7850.0cb9c8","type":"mqtt out","name":"","topic":"homebridge/to/add","qos":"","retain":"","broker":"MQTT.Localhost","x":546,"y":100,"z":"19af2d6a.74e9bb","wires":[]},{"id":"f0ee7d2a.106a38","type":"inject","name":"garage","topic":"","payload":"{\"name\":\"garage2\" }","payloadType":"string","repeat":"","crontab":"","once":false,"x":179,"y":207,"z":"19af2d6a.74e9bb","wires":[["906ea779.cc4cd"]]},{"id":"906ea779.cc4cd","type":"mqtt out","name":"","topic":"homebridge/to/remove","qos":"","retain":"","broker":"MQTT.Localhost","x":551,"y":181,"z":"19af2d6a.74e9bb","wires":[]},{"id":"8031a090.b05a4","type":"comment","name":"garage test","info":"","x":228,"y":67,"z":"19af2d6a.74e9bb","wires":[]},{"id":"aa578889.1bda6","type":"mqtt out","name":"","topic":"homebridge/to/set","qos":"","retain":"","broker":"MQTT.Localhost","x":592,"y":324,"z":"19af2d6a.74e9bb","wires":[]},{"id":"931355d7.bb2688","type":"template","name":"TargetDoorState","field":"payload","format":"handlebars","template":"{\"name\":\"garage2\",\"characteristic\":\"TargetDoorState\",\"value\": {{payload}}}","x":330,"y":307,"z":"19af2d6a.74e9bb","wires":[["aa578889.1bda6"]]},{"id":"a443fc1c.d22f1","type":"template","name":"CurrentDoorState","field":"payload","format":"handlebars","template":"{\"name\":\"garage2\",\"characteristic\":\"CurrentDoorState\",\"value\": {{payload}}}","x":333,"y":359,"z":"19af2d6a.74e9bb","wires":[["aa578889.1bda6"]]},{"id":"23cfbe0d.9a55b2","type":"inject","name":"garage","topic":"","payload":"{\"name\":\"garage2\",\"service\":\"GarageDoorOpener\"}","payloadType":"string","repeat":"","crontab":"","once":false,"x":148,"y":146,"z":"19af2d6a.74e9bb","wires":[["12aa7850.0cb9c8"]]},{"id":"b63cfa6c.fc7118","type":"inject","name":"0 = open","topic":"","payload":"0","payloadType":"string","repeat":"","crontab":"","once":false,"x":115,"y":449,"z":"19af2d6a.74e9bb","wires":[["a443fc1c.d22f1"]]},{"id":"cd6858e4.62eb78","type":"inject","name":"1 = closed","topic":"","payload":"1","payloadType":"string","repeat":"","crontab":"","once":false,"x":114,"y":495,"z":"19af2d6a.74e9bb","wires":[["a443fc1c.d22f1"]]},{"id":"850ce9b1.89a468","type":"inject","name":"2 = opening","topic":"","payload":"2","payloadType":"string","repeat":"","crontab":"","once":false,"x":120,"y":558,"z":"19af2d6a.74e9bb","wires":[["a443fc1c.d22f1"]]},{"id":"2ba9731d.7cf0b4","type":"inject","name":"3 = closing","topic":"","payload":"3","payloadType":"string","repeat":"","crontab":"","once":false,"x":117,"y":599,"z":"19af2d6a.74e9bb","wires":[["a443fc1c.d22f1"]]},{"id":"13c3e3eb.b70464","type":"comment","name":"current door states","info":"// The value property of CurrentDoorState must be one of the following:\nCharacteristic.CurrentDoorState.OPEN = 0;\nCharacteristic.CurrentDoorState.CLOSED = 1;\nCharacteristic.CurrentDoorState.OPENING = 2;\nCharacteristic.CurrentDoorState.CLOSING = 3;\nCharacteristic.CurrentDoorState.STOPPED = 4;","x":105,"y":405,"z":"19af2d6a.74e9bb","wires":[]},{"id":"7ff1935.d324b6c","type":"inject","name":"4 = stopped","topic":"","payload":"4","payloadType":"string","repeat":"","crontab":"","once":false,"x":116,"y":652,"z":"19af2d6a.74e9bb","wires":[["a443fc1c.d22f1"]]},{"id":"dfe4461c.b25ec","type":"inject","name":"0 = open","topic":"","payload":"0","payloadType":"string","repeat":"","crontab":"","once":false,"x":108,"y":290,"z":"19af2d6a.74e9bb","wires":[["931355d7.bb2688"]]},{"id":"f7f1ff78.fa89d","type":"inject","name":"1 = closed","topic":"","payload":"1","payloadType":"string","repeat":"","crontab":"","once":false,"x":114,"y":332,"z":"19af2d6a.74e9bb","wires":[["931355d7.bb2688"]]},{"id":"5a4e7ac.a7e6784","type":"template","name":"ObstructionDetected","field":"payload","format":"handlebars","template":"{\"name\":\"garage2\",\"characteristic\":\"ObstructionDetected\",\"value\": {{payload}}}","x":406,"y":538,"z":"19af2d6a.74e9bb","wires":[["aa578889.1bda6"]]},{"id":"c9d15045.2531f","type":"inject","name":"0 = open","topic":"","payload":"0","payloadType":"string","repeat":"","crontab":"","once":false,"x":298,"y":481,"z":"19af2d6a.74e9bb","wires":[["5a4e7ac.a7e6784"]]},{"id":"fd4169d5.79613","type":"inject","name":"1 = closed","topic":"","payload":"1","payloadType":"string","repeat":"","crontab":"","once":false,"x":293,"y":443,"z":"19af2d6a.74e9bb","wires":[["5a4e7ac.a7e6784"]]}]

Scene support

It's been possible for a while to add third party scenes into HomeKit and have HomeKit activate them. For example Hue can do this. Would it be possible through homebridge-mqtt to send HomeKit named scenes which HomeKit then asks Homebridge-Mqtt to activate, so they get passed on to the back end?

sevice AccessoryInformation not work

If I tested sevice "AccessoryInformation" homebridge crashed:

[4/20/2017, 7:14:54 PM] [mqtt] Number of cached Accessories: 1
[4/20/2017, 7:14:54 PM] [mqtt] connect Anonymous
[4/20/2017, 7:14:54 PM] [Homebridge Server] is listening on: http://192.168.1.85:8765
[4/20/2017, 7:14:54 PM] Homebridge is running on port 51827.
[4/20/2017, 7:14:54 PM] [mqtt] connected (url = mqtt://192.168.1.85)
/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/Service.js:72
throw new Error("Cannot add a Characteristic with the same UUID as another Characteristic in this Service: " + existing.UUID);
^

Error:
Cannotadd a Characteristic with the same UUID as another Characteristic in this Service: 00000023-0000-1000-8000-0026BB765291
at Service.addCharacteristic (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/Service.js:72:13)
at new Service.AccessoryInformation (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/gen/HomeKitTypes.js:2447:8)
at PlatformAccessory.addService (/usr/local/lib/node_modules/homebridge/lib/platformAccessory.js:44:15)
at Accessory.addService (/usr/local/lib/node_modules/homebridge-mqtt/lib/accessory.js:48:13)
at Controller.addAccessory (/usr/local/lib/node_modules/homebridge-mqtt/lib/controller.js:97:17)
at Model. (/usr/local/lib/node_modules/homebridge-mqtt/lib/model.js:114:22)
at emitThree (events.js:97:13)
at MqttClient.emit (events.js:175:7)
at MqttClient._handlePublish (/usr/local/lib/node_modules/homebridge-mqtt/node_modules/mqtt/lib/client.js:819:12)
at MqttClient._handlePacket (/usr/local/lib/node_modules/homebridge-mqtt/node_modules/mqtt/lib/client.js:286:12)
pi@MQTT:~ $

Garageport with Sonoff

Hello,
I'm new to Node-Red and MQTT. Can someone explain to me how I can apply this scheme to my Sonoff Basic?
https://github.com/cflurin/homebridge-mqtt/wiki/garageport

My Sonoff Basic gives a pulse that opens or closes the garage. At GPIO14 a reed sensor is attached, which knows the current status of the garage. So how can I configure the whole thing so that I can say later: Siri open the garage

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.