homebridge-edomoticz Plugin

Moderator: leecollings

simon_rb
Posts: 612
Joined: Wednesday 07 August 2013 19:09
Target OS: -
Domoticz version:
Location: UK
Contact:

Re: homebridge-edomoticz Plugin

Post by simon_rb »

Not quite eDomoticz related however.. I could not invite my wife to share my home. So I decided to delete the home and start over. I can't add my homebridge at all now. I have deleted the persist and accessories folders. Changed my username.. restarted homebridge and still getting the same.. The bridge shows up but when you click on it I get Error Cannot add device.. Don't know what else to try. I have two bridges running on 2 separate Pis both giving the same error.. Very confused now... lol Both Homebridges run fine..

UPDATE:- Gave it 5 mins and tried again and now works.. Hmmm :D Happy days

Still can't invite anyone to join the house!
User avatar
G3rard
Posts: 669
Joined: Wednesday 04 March 2015 22:15
Target OS: -
Domoticz version: No
Location: The Netherlands
Contact:

homebridge-edomoticz Plugin

Post by G3rard »

@TheRamon, updated to the latest version and it's still 1% off.
Asking Siri to set the volume to 20 gives this MQTT message

Code: Select all

{"command":"switchlight","idx":409,"level":20,"switchcmd":"Set Level"}
But the switch in Domoticz is set to 19%.

Also when doing this with a Zwave dimmer (also maxdimlevel of 100), I see the same behaviour.
When I set the lamp to 41% this is the MQTT

Code: Select all

{"command":"switchlight","idx":376,"level":41,"switchcmd":"Set Level"}
And in Domoticz it goes to 40%.

Code: Select all

Lamp kantoor	Light/Switch	Switch	Set Level: 40 %	
So I don't think this has anything to do with eDomoticz but with the way the MQTT in message is being handled.
Let me know if I can do some more testing.

Edit: did some more investigation on MQTT.
When sending the following command the % is 1 off

Code: Select all

mosquitto_pub -h localhost -t "domoticz/in" -m '{"command":"switchlight","idx":409,"level":20,"switchcmd":"Set Level"}'
But when sending this, it's spot on

Code: Select all

mosquitto_pub -h localhost -t "domoticz/in" -m '{ "idx" : 409, "nvalue" : 2, "svalue" : "20" }'
I found this by having a look at the Domoticz out when changing the slider in Domoticz and looking at the MQTT wiki.

Code: Select all

domoticz/out {
   "Battery" : 255,
   "RSSI" : 12,
   "dtype" : "Light/Switch",
   "id" : "000141E8",
   "idx" : 409,
   "name" : "Sonos kantoor volume",
   "nvalue" : 2,
   "stype" : "Switch",
   "svalue1" : "20",
   "switchType" : "Dimmer",
   "unit" : 1
}
But not sure if the second method is the right way to change the level with a MQTT message, although it is working :?
Last edited by G3rard on Monday 14 November 2016 22:15, edited 6 times in total.
Not using Domoticz anymore
frave
Posts: 16
Joined: Thursday 08 January 2015 8:53
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: homebridge-edomoticz Plugin

Post by frave »

Hi, I am running homebridge-edomoticz using NPM for quite a while now. Today I ran a few updates and also updated homebridge-edomoticz to the latest version. Everything seemed to work ok but when I tried to change the color of my RGBW bulbs, nothing happened. Brightness can be changed, I can turn the bulb on and off but the color can not be changed anymore.

Fortunately I could roll back because I am running everything on a virtual machine. The command: "npm list -g |grep homebridge" learns the working version is 0.2.1. The RGBW bulbs I am using are Mi-Light / App-Lamp bulbs. What could be the cause why I can not change the color of these bulbs anymore using homebridge-edomoticz?

UPDATE: I just fixed my own problem but encountered a new one. I just updated using git. What I did to remove the old version was:

Code: Select all

sudo npm uninstall homebridge-edomoticz
I then did:

Code: Select all

sudo npm install git+https://[email protected]/PatchworkBoy/homebridge-edomoticz.git
This resulted in the following output with the new problem when running homebridge:

Code: Select all

*** WARNING *** The program 'nodejs' uses the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see <http://0pointer.de/avahi-compat?s=libdns_sd&e=nodejs>
*** WARNING *** The program 'nodejs' called 'DNSServiceRegister()' which is not supported (or only supported partially) in the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see <http://0pointer.de/avahi-compat?s=libdns_sd&e=nodejs&f=DNSServiceRegister>
[11/15/2016, 12:30:02 AM] Loaded plugin: homebridge-edomoticz
[11/15/2016, 12:30:02 AM] Registering accessory 'homebridge-edomoticz.eDomoticz'
[11/15/2016, 12:30:02 AM] Registering platform 'homebridge-edomoticz.eDomoticz'
[11/15/2016, 12:30:02 AM] ---
[11/15/2016, 12:30:02 AM] Loaded config.json with 0 accessories and 1 platforms.
[11/15/2016, 12:30:02 AM] ---
[11/15/2016, 12:30:02 AM] Loading 1 platforms...
[11/15/2016, 12:30:02 AM] [eDomoticz] Initializing eDomoticz platform...
/usr/lib/node_modules/homebridge-edomoticz/index.js:158
    this.requestHeaders['Authorization'] = 'Basic ' + this.authorizationToken;
                                         ^

TypeError: Cannot set property 'Authorization' of undefined
    at Object.eDomoticzPlatform (/usr/lib/node_modules/homebridge-edomoticz/index.js:158:42)
    at Server._loadPlatforms (/usr/lib/node_modules/homebridge/lib/server.js:291:32)
    at Server.run (/usr/lib/node_modules/homebridge/lib/server.js:77:36)
    at module.exports (/usr/lib/node_modules/homebridge/lib/cli.js:40:10)
    at Object.<anonymous> (/usr/lib/node_modules/homebridge/bin/homebridge:17:22)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Function.Module.runMain (module.js:447:10)
So when I removed the row with "server": "username:[email protected]" from my config.json everything worked. Colors can now be changed using the original MiLight controller hardware. But the authentication looks broken in the latest GIT version. I therefore set Domoticz to accept calls from localhost. Can somebody confirm this is broken or help me in finding out what I did wrong?
MacJL
Posts: 51
Joined: Tuesday 22 April 2014 22:17
Target OS: OS X
Domoticz version: Beta
Location: France
Contact:

Re: homebridge-edomoticz Plugin

Post by MacJL »

frave wrote:So when I removed the row with "server": "username:[email protected]" from my config.json everything worked. Colors can now be changed using the original MiLight controller hardware. But the authentication looks broken in the latest GIT version. I therefore set Domoticz to accept calls from localhost. Can somebody confirm this is broken or help me in finding out what I did wrong?
Same problem here. Authentication seems broken till last commit. It used to work with the git version 2 days ago.
But for me, as I'm using domoticz and homebridge inside docker containers, I can't allow an IP to be unauthenticated without openning domoticz to everyone...
User avatar
TheRamon
Posts: 126
Joined: Tuesday 12 July 2016 11:32
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: NL/DE
Contact:

Re: homebridge-edomoticz Plugin

Post by TheRamon »

I can confirm Authorization broke in the last commit. I was a bit too enthusiastic with the refactoring and all. Have just fixed this issue on git / master. My apologies.

PS. G3rard: good find! Let me investigate. Looks like this is a Domoticz thing.
simon_rb
Posts: 612
Joined: Wednesday 07 August 2013 19:09
Target OS: -
Domoticz version:
Location: UK
Contact:

Re: homebridge-edomoticz Plugin

Post by simon_rb »

G3rard wrote:
TheRamon wrote:I have changed the following code in domoticz_accessory.js

Code: Select all

var dim = (level / this.factor == 15) ? 16 : level / this.factor;
to

Code: Select all

var dim = (level / this.factor == 15) ? 16 : (level / this.factor) + 1;
and then it is working fine.
Not sure although if that is the best solution.
@TheRamon
Would this work as a temp fix for us to implement locally? Or a temp fix until it can be fixed on Domoticz side

@G3rard
Is this still working for you?
User avatar
TheRamon
Posts: 126
Joined: Tuesday 12 July 2016 11:32
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: NL/DE
Contact:

Re: homebridge-edomoticz Plugin

Post by TheRamon »

Yeah that would.. But I'm not quite fond of fixing the issue in the plugin. I was thinking of implementing that quickfix, but it's like a patch to the problem.
I actually believe the problem should be resolved on Domoticz' side. We'll have to undo our fix again, too, when Domoticz fixes the problem.

Anyhow, have just implemented the quickfix on master. Mehhh.. :roll:


Look at this :? Looks just weird right?

Code: Select all

2016-11-15 15:59:17.967  MQTT: Topic: domoticz/in, Message: {"command":"switchlight","idx":14,"level":101,"switchcmd":"Set Level"}
simon_rb
Posts: 612
Joined: Wednesday 07 August 2013 19:09
Target OS: -
Domoticz version:
Location: UK
Contact:

Re: homebridge-edomoticz Plugin

Post by simon_rb »

TheRamon wrote:Yeah that would.. But I'm not quite fond of fixing the issue in the plugin. I was thinking of implementing that quickfix, but it's like a patch to the problem.
I actually believe the problem should be resolved on Domoticz' side. We'll have to undo our fix again, too, when Domoticz fixes the problem.

Anyhow, have just implemented the quickfix on master. Mehhh.. :roll:


Look at this :? Looks just weird right?

Code: Select all

2016-11-15 15:59:17.967  MQTT: Topic: domoticz/in, Message: {"command":"switchlight","idx":14,"level":101,"switchcmd":"Set Level"}
Level 101! lol

I'll test now mate

Limited testing it appears to work! Even fixed an issue with my 16 step wall light dimmers. I'd have to say above 87% to get them to 80% or they would drop to 73%. Same with the slide - had to set it to above 86% for them to go to 80% or is would drop to 73% Hopefully it works for others.. How would we log this to Domoticz to fix?

UPDATE:- I've noticed that if my dimmers are off and and I say set the level to.. the level is sent then the On command which is the wrong way round lol. Although I don't really do it that way. I'll always turn them on first. Maybe is a delay with the +1 mod? Like I said doesn't really effect me too much but might others ;)
Last edited by simon_rb on Tuesday 15 November 2016 16:32, edited 1 time in total.
User avatar
TheRamon
Posts: 126
Joined: Tuesday 12 July 2016 11:32
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: NL/DE
Contact:

Re: homebridge-edomoticz Plugin

Post by TheRamon »

Yeah it's a bit weird. It drops to it's "known" values / steps.
I'll file a bug in Github about this dimmer issue when I find the time!
frave
Posts: 16
Joined: Thursday 08 January 2015 8:53
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: homebridge-edomoticz Plugin

Post by frave »

TheRamon wrote:I can confirm Authorization broke in the last commit. I was a bit too enthusiastic with the refactoring and all. Have just fixed this issue on git / master. My apologies.

PS. G3rard: good find! Let me investigate. Looks like this is a Domoticz thing.
Hi TheRamon, thanks for your efforts. The authorization is working again.
madrian
Posts: 231
Joined: Saturday 27 August 2016 1:18
Target OS: -
Domoticz version:
Contact:

Re: homebridge-edomoticz Plugin

Post by madrian »

Hi,

So it's not possible to fix my bug?

viewtopic.php?f=36&t=10272&start=1060#p103662
User avatar
TheRamon
Posts: 126
Joined: Tuesday 12 July 2016 11:32
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: NL/DE
Contact:

Re: homebridge-edomoticz Plugin

Post by TheRamon »

hpapagaj wrote:Hi,

So it's not possible to fix my bug?

viewtopic.php?f=36&t=10272&start=1060#p103662
I'm finding it very hard to reproduce this. Does anyone else have the same problem? When switching brightness of a LED it sends the "On" command right after. Might be that Domoticz doesn't know the device is actually on. Can anyone test?

@hpapagaj: Can you post the output of the following call:

Code: Select all

[domoticz]/json.htm?type=devices&rid=25
User avatar
Marci
Posts: 531
Joined: Friday 22 January 2016 18:00
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8153
Location: Wakefield, West Yorkshire UK
Contact:

Re: homebridge-edomoticz Plugin

Post by Marci »

TheRamon wrote:Nope, did not have one until now. xtheramon :mrgreen:
I'll have to figure that out though. NPM 101!
Done - npm updated (coincidentally, to v1.0.1)

Essentially, commit and push all your changes to git, but do NOT change the version number in package.json.
Run 'npm version patch' which sorts version in package.json. Do another git commit and push to shove the new package.json up to git, then run 'npm publish' to update npmjs.org

See https://docs.npmjs.com/getting-started/ ... m-packages
Extended Domoticz homebridge-plugin for latest Homebridge - adds temp/humidity/pressure sensors, power consumption sensors, DarkSkies virtual weather station support, YouLess Meter support, general % usage support & switch/lamp status checking!
mkanon
Posts: 1
Joined: Wednesday 16 November 2016 10:46
Target OS: Windows
Domoticz version:
Contact:

Re: homebridge-edomoticz Plugin

Post by mkanon »

Hello everybody! Total newbie, and i have some questions concerning homebridge and domoticz.

I have the most recent version of domoticz running on an windows 10 pc. All working well, as for now I have my thermostat (TOON, dutch) connected and I can check the current temperature and set an new one, even remotly! So far I'm happy! Currently awaiting mi-light's to make more possible.

But, I have an iphone, and I really would like to say something like "he siri, make it 2 degrees warmer"...
So yesterday I installed homebridge (-http) on the windows machine following this tutorial https://github.com/nfarina/homebridge/w ... on-Windows. And it worked! My iphone can register to homebridge! No error's, all seems wel.. But now the tricky part, I want to see my current temperature and set a new one with siri! Domoticz and homebridge don't connect together yet.
What steps do I take? I can see some homebridge/domoticz plugins but how do I intall them on a windows machine? And can I install them on my current setup?

Please help!
User avatar
Marci
Posts: 531
Joined: Friday 22 January 2016 18:00
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8153
Location: Wakefield, West Yorkshire UK
Contact:

Re: homebridge-edomoticz Plugin

Post by Marci »

mkanon wrote:...following this tutorial https://github.com/nfarina/homebridge/w ... on-Windows. And it worked!
*snip*
how do I install them on a windows machine?
You install the homebridge-http plugin as part of the procedure you link to - Step 4, command 3.

Just repeat that step for homebridge-edomoticz (ie: npm install -g homebridge-edomoticz, then update C:\Users\xxx\.homebridge\config.json )

You’ll also need to configure an MQTT broker in Windows... see https://sivatechworld.wordpress.com/201 ... windows-7/
Then you’ll need to activate Domoticz’ MQTT client - see https://www.domoticz.com/wiki/MQTT#Add_ ... Gateway.22
Extended Domoticz homebridge-plugin for latest Homebridge - adds temp/humidity/pressure sensors, power consumption sensors, DarkSkies virtual weather station support, YouLess Meter support, general % usage support & switch/lamp status checking!
madrian
Posts: 231
Joined: Saturday 27 August 2016 1:18
Target OS: -
Domoticz version:
Contact:

Re: homebridge-edomoticz Plugin

Post by madrian »

TheRamon wrote:
hpapagaj wrote:Hi,

@hpapagaj: Can you post the output of the following call:

Code: Select all

[domoticz]/json.htm?type=devices&rid=25
Sure, here it is:

Code: Select all

{
   "ActTime" : 1479303983,
   "ServerTime" : "2016-11-16 14:46:23",
   "Sunrise" : "06:54",
   "Sunset" : "16:05",
   "result" : [
      {
         "AddjMulti" : 1.0,
         "AddjMulti2" : 1.0,
         "AddjValue" : 0.0,
         "AddjValue2" : 0.0,
         "BatteryLevel" : 255,
         "CustomImage" : 0,
         "Data" : "Off",
         "Description" : "",
         "Favorite" : 1,
         "HardwareID" : 7,
         "HardwareName" : "Quinled_1",
         "HardwareType" : "Dummy (Does nothing, use for virtual switches only)",
         "HardwareTypeVal" : 15,
         "HaveDimmer" : true,
         "HaveGroupCmd" : true,
         "HaveTimeout" : false,
         "ID" : "060105",
         "Image" : "Light",
         "IsSubDevice" : false,
         "LastUpdate" : "2016-11-16 00:42:29",
         "Level" : 68,
         "LevelInt" : 22,
         "MaxDimLevel" : 32,
         "Name" : "LED",
         "Notifications" : "false",
         "PlanID" : "0",
         "PlanIDs" : [ 0 ],
         "Protected" : false,
         "ShowNotifications" : true,
         "SignalLevel" : "-",
         "Status" : "Off",
         "StrParam1" : "",
         "StrParam2" : "",
         "SubType" : "LightwaveRF",
         "SwitchType" : "Dimmer",
         "SwitchTypeVal" : 7,
         "Timers" : "false",
         "Type" : "Lighting 5",
         "TypeImg" : "dimmer",
         "Unit" : 1,
         "Used" : 1,
         "UsedByCamera" : false,
         "XOffset" : "0",
         "YOffset" : "0",
         "idx" : "25"
      }
   ],
   "status" : "OK",
   "title" : "Devices"
}
Toyman
Posts: 23
Joined: Wednesday 31 August 2016 16:17
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: homebridge-edomoticz Plugin

Post by Toyman »

What's the recommended way to upgrade to the latest release: via npm or via git?
User avatar
Marci
Posts: 531
Joined: Friday 22 January 2016 18:00
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8153
Location: Wakefield, West Yorkshire UK
Contact:

Re: homebridge-edomoticz Plugin

Post by Marci »

For less experienced linux users, wait for stable releases to be published to npm, then update via that.
More experienced users are free to use the git repo which contains the latest bleeding-edge code, however, brings with it an inherent stability risk.
Extended Domoticz homebridge-plugin for latest Homebridge - adds temp/humidity/pressure sensors, power consumption sensors, DarkSkies virtual weather station support, YouLess Meter support, general % usage support & switch/lamp status checking!
User avatar
G3rard
Posts: 669
Joined: Wednesday 04 March 2015 22:15
Target OS: -
Domoticz version: No
Location: The Netherlands
Contact:

Re: homebridge-edomoticz Plugin

Post by G3rard »

TheRamon wrote:I can confirm Authorization broke in the last commit. I was a bit too enthusiastic with the refactoring and all. Have just fixed this issue on git / master. My apologies.

PS. G3rard: good find! Let me investigate. Looks like this is a Domoticz thing.
Also setting the dim level via JSON is 1 off.

Code: Select all

http://<domoip:port>/json.htm?type=command&param=switchlight&idx=409&switchcmd=Set%20Level&level=20
sets the volume to 19%. So must indeed by a Domoticz thing.
Not using Domoticz anymore
simon_rb
Posts: 612
Joined: Wednesday 07 August 2013 19:09
Target OS: -
Domoticz version:
Location: UK
Contact:

Re: homebridge-edomoticz Plugin

Post by simon_rb »

G3rard wrote:Also setting the dim level via JSON is 1 off.

Code: Select all

http://<domoip:port>/json.htm?type=command&param=switchlight&idx=409&switchcmd=Set%20Level&level=20
sets the volume to 19%. So must indeed by a Domoticz thing.
Funny you say that I noticed this today. Changed the Denon volume to -81 from 80 to compensate which seems to work. Only thing I can think of is it's 0-99 rather than 1 - 100 and domoticz isn't compensating for it..



Sent from my iPhone using Tapatalk
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest