homebridge-edomoticz Plugin

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

Re: homebridge-edomoticz Plugin

Postby simon_rb » Saturday 07 January 2017 14:55

Marci wrote:I have a cron job set up which restarts Domoticz & Homebridge every 24hrs, alongside a switch in Domoticz for manual restarts of homebridge when required.


Curious to know what your Cron Job look like. Is it advisable to restart everyday?

Cheers


Sent from my iPhone using Tapatalk

User avatar
Marci
Posts: 463
Joined: Friday 22 January 2016 19:00
Target OS: Raspberry Pi
Domoticz version: 2.3530
Location: Wakefield, West Yorkshire UK
Contact:

Re: homebridge-edomoticz Plugin

Postby Marci » Saturday 07 January 2017 15:06

Not strictly necessary... just minimises unexpected unresponsiveness from either system on the particular Pi I’m currently running on (an old ModelB which is now doing quite a lot of additional work as well as home automation). Script is simple...

/root/monitor.sh:

Code: Select all

systemctl restart domoticz && systemctl restart homebridge


Root’s Crontab entry:

Code: Select all

30     02     *     *     *         /root/monitor.sh


Restarts Domoticz then Homebridge at 2.30am daily.
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!

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

Re: homebridge-edomoticz Plugin

Postby simon_rb » Saturday 07 January 2017 15:16

I might have to implement this :-)
My Nest plugin loses contact with Nest every so often and restarting homebridge fixes it.

Cheers


Sent from my iPhone using Tapatalk

User avatar
G3rard
Posts: 542
Joined: Wednesday 04 March 2015 23:15
Target OS: Linux
Domoticz version: V3.5877
Location: The Netherlands
Contact:

Re: homebridge-edomoticz Plugin

Postby G3rard » Sunday 08 January 2017 14:24

TheRamon wrote:Hehehe, alright. I have just reverted the setcolbrightnessvalue commit since it's not yet working 100%.. Does not have support for RGB values and such. I'll wait for Domoticz to implement that, too..

Maybe this can help?
http://www.domoticz.com/forum/viewtopic.php?f=38&t=14941
https://github.com/t0mg/reacticz/blob/master/src/widgets/SwitchRGBW.js
It is also using MQTT and I can change the colors of my Hue lights.
But I have no RGB lights, so not sure if this is the solution you're searching for :)
Ubuntu Server 14.04 | Domoticz v3.5877 | RFXtrx433E | Z-Wave Aeotec Z-Stick S2
Frontpage | Sonos

matv
Posts: 15
Joined: Sunday 08 January 2017 19:26
Target OS: Raspberry Pi
Domoticz version: 3.5877
Location: EU
Contact:

Re: homebridge-edomoticz Plugin

Postby matv » Sunday 08 January 2017 20:11

Marci wrote:

Code: Select all

sudo service homebridge stop
sudo npm set prefix '/usr' -g
sudo npm update -g homebridge --unsafe-perm
sudo npm update -g homebridge-edomoticz --unsafe-perm
cd /usr/lib/node_modules
sudo npm rebuild homebridge
sudo npm rebuild homebridge-edomoticz
[...]

Code: Select all

sudo pico ~/.homebridge/config.json

Launch homebridge!

Code: Select all

homebridge


I'm completely stuck and I hope someone is able to give me some general directions..
After following the outdated Wiki and finding out that that is not the way to go anymore I started with these instructions.
Being completely new to Unix it naturally involves a lot of trial and error for me..

The first error I get when executing the code above;
-bash: cd: /usr/lib/node_modules: No such file or directory

I found that there's a way to search with find / -name "node_modules" and that showed the location of the folder:
/usr/local/lib/node_modules

I then changed the code on top, replcaing cd /usr/lib/node_modules with the path I just found.
The error is gone but when is type ls in /usr/local/lib/node_modules, I only see a folder called npm with the following contents:

Screen Shot 2017-01-08 at 19.08.37.png
Screen Shot 2017-01-08 at 19.08.37.png (76.88 KiB) Viewed 334 times


Could someone provide me with some tips on how to proceed? All the folders, Node-installs and file locations are getting a bit too much to oversee at this point.. Thanks in advance!

User avatar
TheRamon
Posts: 128
Joined: Tuesday 12 July 2016 11:32
Target OS: Raspberry Pi
Domoticz version: BETA
Location: NL/DE
Contact:

Re: homebridge-edomoticz Plugin

Postby TheRamon » Monday 09 January 2017 17:37

G3rard wrote:
TheRamon wrote:Hehehe, alright. I have just reverted the setcolbrightnessvalue commit since it's not yet working 100%.. Does not have support for RGB values and such. I'll wait for Domoticz to implement that, too..

Maybe this can help?
http://www.domoticz.com/forum/viewtopic.php?f=38&t=14941
https://github.com/t0mg/reacticz/blob/master/src/widgets/SwitchRGBW.js
It is also using MQTT and I can change the colors of my Hue lights.
But I have no RGB lights, so not sure if this is the solution you're searching for :)


Yes, thank you so much but the MQTT call itself does not support a RGB value yet. I'm happy to convert to Hue, saturation and brightness but 'saturation' does not work. So we're left with Hue and brightness. We really need to wait for Domoticz to get full color support instead of only the brightest of the bunch. (100% saturation).


matv wrote:I'm completely stuck and I hope someone is able to give me some general directions..
After following the outdated Wiki and finding out that that is not the way to go anymore I started with these instructions.
Being completely new to Unix it naturally involves a lot of trial and error for me..

The first error I get when executing the code above;
-bash: cd: /usr/lib/node_modules: No such file or directory

I found that there's a way to search with find / -name "node_modules" and that showed the location of the folder:
/usr/local/lib/node_modules

I then changed the code on top, replcaing cd /usr/lib/node_modules with the path I just found.
The error is gone but when is type ls in /usr/local/lib/node_modules, I only see a folder called npm with the following contents:

Could someone provide me with some tips on how to proceed? All the folders, Node-installs and file locations are getting a bit too much to oversee at this point.. Thanks in advance!


Hi,

You were almost there! Nice job though doing this without any knowledge.

The command sudo npm set prefix '/usr' -g sets the 'main' directory for npm. This has to be:
sudo npm set prefix '/usr/local' -g on your end.

Try the following list instead:

Code: Select all

* Installing homebridge and the plugin *
sudo service homebridge stop
sudo npm set prefix '/usr/local' -g
sudo npm install -g homebridge --unsafe-perm
sudo npm install -g homebridge-edomoticz --unsafe-perm
cd /usr/local/lib/node_modules
sudo npm rebuild homebridge
sudo npm rebuild homebridge-edomoticz

* To edit your config: *
sudo nano -w ~/.homebridge/config.json

* Starting homebridge *
homebridge

* Auto-starting homebridge *
sudo service homebridge start

matv
Posts: 15
Joined: Sunday 08 January 2017 19:26
Target OS: Raspberry Pi
Domoticz version: 3.5877
Location: EU
Contact:

Re: homebridge-edomoticz Plugin

Postby matv » Monday 09 January 2017 19:07

Thank you so much Ramon!
Looking at the culprit it makes complete sense to me now. I learned something today :)

Homebridge does start now, with the aforementioned warnings that are described in Marci's first post of this topic.
And I was pleasantly surprised that I can also control my 'Domoticz lamps (switches)' straight from the iOS Home app! No 3rd party app needed.
Amazing. Thanks agian :)

(I did get one scary error during install, regarding node/node-gyp/curve (?)
Just for my peace of mind I'd like to verify that this is all good.)

Code: Select all

[email protected]:~ $ cd /usr/local/lib/node_modules
[email protected]:/usr/local/lib/node_modules $ sudo npm rebuild homebridge

> [email protected] install /usr/local/lib/node_modules/homebridge/node_modules/curve25519-n
> node-gyp rebuild

gyp ERR! clean error
gyp ERR! stack Error: EACCES: permission denied, unlink 'build/Makefile'
gyp ERR! stack     at Error (native)
gyp ERR! System Linux 4.4.38-v7+
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/homebridge/node_modules/curve25519-n
gyp ERR! node -v v6.3.1
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok

npm ERR! Linux 4.4.38-v7+
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "rebuild" "homebridge"
npm ERR! node v6.3.1
npm ERR! npm  v3.10.3
npm ERR! code ELIFECYCLE
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the curve25519-n package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs curve25519-n
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls curve25519-n
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /usr/local/lib/node_modules/npm-debug.log

User avatar
TheRamon
Posts: 128
Joined: Tuesday 12 July 2016 11:32
Target OS: Raspberry Pi
Domoticz version: BETA
Location: NL/DE
Contact:

Re: homebridge-edomoticz Plugin

Postby TheRamon » Monday 09 January 2017 20:08

Nice!!!!

Yeah that error is no biggie. It was trying to rebuild something. It didn't have the permission to do so. But apparently there's already a built version on your system, hence the program up and running.

Enjoy!

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

homebridge-edomoticz Plugin

Postby simon_rb » Tuesday 10 January 2017 12:21

Can anyone confirm something for me. I believe the behaviour within HomeKit may have changed. Before when a device was on and you requested it to be turned on again, it would send the on command. Which I need for some of my devices. Was trying today and it's not sending an on command to domoticz if the device is already on. If I remember correctly TheRamon had changed it so it would send an on command if it was already on. Has this or HomeKits behaviour changed?

Cheers Guys

Update:-
Thinking about it, maybe it was the off command I was thinking about. Having it send the on command messed up some of the dimmers. Funny really as for some of the switches I need an on command sent even if it's on as they switch channels on a matrix.. doh!


Sent from my iPhone using Tapatalk

User avatar
TheRamon
Posts: 128
Joined: Tuesday 12 July 2016 11:32
Target OS: Raspberry Pi
Domoticz version: BETA
Location: NL/DE
Contact:

Re: homebridge-edomoticz Plugin

Postby TheRamon » Tuesday 10 January 2017 16:41

@simon:

Yeah! It was the off command one can send multiple times. Sending two ON commands is not possible, only one will flow through. This was because of the "dimmer" issue. Apparently sometimes an "on" commands gets sent twice, even when dimming a light to 50%. So 50% + on command = 100% since ON = 100%.

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

homebridge-edomoticz Plugin

Postby simon_rb » Tuesday 10 January 2017 17:02

TheRamon wrote:@simon:

Yeah! It was the off command one can send multiple times. Sending two ON commands is not possible, only one will flow through. This was because of the "dimmer" issue. Apparently sometimes an "on" commands gets sent twice, even when dimming a light to 50%. So 50% + on command = 100% since ON = 100%.


That's right. I realised after the post. I don't want two on commands sent. Just an on command even if the switch is on. I have 4 switches - Siri TV, Siri Fire TV, Siri Apple TV & Siri PS4. When one of them turns on it will set my HDMI matrix to the right channel and turn the TV on if its off. When they are all off the TV will turn off so that works great. Issue is (not really an issue but inconvenience lol) when you want to switch from one to the other when it's already on.. for example the Siri Fire TV is on, I can turn on Siri Sky TV to see what's on that and it all changes the matrix over but if I want to switch back to the Siri Fire TV and ask it to turn Fire TV on (renamed them all to remove the Siri inside HomeKit) and it responds saying it's done however the Siri Fire TV in Domoticz isn't switched on because it's already on so it wont change the matrix back over so I have to turn off the Siri Fire TV then turn it back on again to get it to activate..

Is this a HomeKit behaviour or are we not sending an on if the switch is on using edomoticz. If it's the later can you separate behaviour between lights and switches so switches would send an on command as that probably wouldn't do any harm. If this is possible I'm happy to make the modification locally so not to effect other people's setup lol.

Other uses for the above could be when a switch doesn't get the on signal from domoticz you can issue the on command again via Siri but with current setup it has to be turned off then on again.

Really funny asking about this as I was one of the ones who had the problem with dimmers receiving an on command when they were already on!! Lol.

Thanks TheRamon!!!


Sent from my iPhone using Tapatalk

User avatar
Marci
Posts: 463
Joined: Friday 22 January 2016 19:00
Target OS: Raspberry Pi
Domoticz version: 2.3530
Location: Wakefield, West Yorkshire UK
Contact:

Re: homebridge-edomoticz Plugin

Postby Marci » Friday 13 January 2017 1:17

Knock up a blocky script in Domoticz, to turn the other switches off when you turn one on...?
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!

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

Re: homebridge-edomoticz Plugin

Postby simon_rb » Friday 13 January 2017 1:27

Marci wrote:Knock up a blocky script in Domoticz, to turn the other switches off when you turn one on...?


I have a blocky that will switch back if two are on then turn one of the Siri Tv activities are turned off and works for most cases. Can't switch between sources if I leave them on for whatever reason though.

More curious to know if it's possible to resend an on command to a device that's already on as sometimes they don't receive the command, although do not want to ruin the good work done in regards to the dimmers.

Cheers Marci

Pauldc
Posts: 1
Joined: Friday 13 January 2017 13:27
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: homebridge-edomoticz Plugin

Postby Pauldc » Friday 13 January 2017 13:34

So I’m doing a fresh installation of image 4834 on a Pi 2, and was going to go with option 2 from post 1. Im just a bit confused of which node install do go with seems the 4834 says if its on a Pi A/B/B+ to use: node-v6.3.1-linux-armv6l.tar.gz and the 3530 for Pi 2/3 use node-v6.3.1-linux-armv7l.tar.gz.

Well I’m on a Pi 2 with 4834 so should i run node-v6.3.1-linux-armv6l.tar.gz or node-v6.3.1-linux-armv6l.tar.gz seems the Pi 2 uses armv7l i think? I’m very new to this and very confused.

Any help would be great

Lorccan
Posts: 5
Joined: Wednesday 21 December 2016 11:18
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: homebridge-edomoticz Plugin

Postby Lorccan » Friday 13 January 2017 19:01

I had everything working, but needed to rearrange room plans - which meant deleting a room (6) on the Domoticz side - so I removed this from config.json as well:

Code: Select all

{
    "description" : "Configuration file for Domoticz platform",
    "bridge" : {
            "name" : "Homebridge",
            "username" : "XX:XX:XX:XX:XX:XX",
            "port" : 34473,
            "pin" : "031-45-154"
        },
    "platforms": [
        {
            "platform" : "eDomoticz",
            "name" : "eDomoticz",
            "server" : "127.0.0.1",
            "port" : "8080",
            "roomid" : 2,
            "loadscenes" : 0
       },
       {
            "platform" : "eDomoticz",
            "name" : "eDomoticz",
            "server" : "127.0.0.1",
            "port" : "8080",
            "roomid" : 3,
            "loadscenes" : 0
       },
       {
            "platform" : "eDomoticz",
            "name" : "eDomoticz",
            "server" : "127.0.0.1",
            "port" : "8080",
            "roomid" : 4,
            "loadscenes" : 0
       },
       {
            "platform" : "eDomoticz",
            "name" : "eDomoticz",
            "server" : "127.0.0.1",
            "port" : "8080",
            "roomid" : 5,
            "loadscenes" : 0
       },
       {
            "platform" : "eDomoticz",
            "name" : "eDomoticz",
            "server" : "127.0.0.1",
            "port" : "8080",
            "roomid" : 7,
            "loadscenes" : 0
       },
       {
            "platform" : "eDomoticz",
            "name" : "eDomoticz",
            "server" : "127.0.0.1",
            "port" : "8080",
            "roomid" : 8,
            "loadscenes" : 0
       }
    ],
    "accessories" : [
    ]
}


When I launch Homebridge now, I get an error:

Code: Select all

Jan 13 16:39:23 domoticz-1 homebridge[646]: [1/13/2017, 4:39:23 PM] [eDomoticz] There was a problem connecting to Domoticz. (HTTP Status code 200)
Jan 13 16:39:23 domoticz-1 homebridge[646]: [object Object]


and this is at the position of the missing room.

Can anyone suggest how to get around this please?

Lorccan
Posts: 5
Joined: Wednesday 21 December 2016 11:18
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: homebridge-edomoticz Plugin

Postby Lorccan » Saturday 14 January 2017 16:25

Lorccan wrote:I had everything working, but needed to rearrange room plans - which meant deleting a room (6) on the Domoticz side - so I removed this from config.json as well:

When I launch Homebridge now, I get an error:

Code: Select all

Jan 13 16:39:23 domoticz-1 homebridge[646]: [1/13/2017, 4:39:23 PM] [eDomoticz] There was a problem connecting to Domoticz. (HTTP Status code 200)
Jan 13 16:39:23 domoticz-1 homebridge[646]: [object Object]


and this is at the position of the missing room.

Can anyone suggest how to get around this please?


I found the solution: stupid error - I was editing the wrong config.json file!

darrepac
Posts: 141
Joined: Tuesday 04 February 2014 22:31
Target OS: Raspberry Pi
Domoticz version:
Location: Isère, France
Contact:

Re: homebridge-edomoticz Plugin

Postby darrepac » Sunday 15 January 2017 18:28

This plugin and this thread seem worth to try to impress our wife using Siri to drive our home...
Yet, I have some issues and would need your help.
I have domoticz running on 192.168.0.19 with MQTT broker stuff done (and tested on local with mosquitto_pub test)
I have homebridge and homebridge-edomoticz plugin installed and (seems) working on 192.168.0.27
So they are not running on the same server. I write the following config.json:

Code: Select all


    "bridge": {
        "name": "Homebridge",
        "username": "CC:21:3E:E4:DE:33",
        "port": 51826,
        "pin": "031-45-154"
    },
    "description": "Configuration file for (e)xtended Domoticz platform.",
    "platforms": [
        {
            "platform": "eDomoticz",
            "name": "eDomoticz",
            "server": "192.168.0.19",
            "port": "9090",
            "ssl": 0,
            "roomid": 0,
            "mqtt": 1
        }
    ],
    "accessories": [],
    "mqtt": {
            "host": "192.168.0.19",
            "port": 1234
        }
}


Once I launch homebridge, I have the following error:

Code: Select all

[1/15/2017, 4:52:04 PM] [eDomoticz] Could not connect to MQTT broker! (192.168.0.27:1883)

Yet, on Home iOS application, all devices are detected. Yet, actions doesn't seem to work


Return to “iOS”

Who is online

Users browsing this forum: No registered users and 1 guest