homebridge-edomoticz Plugin

Moderator: leecollings

Post Reply
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: eDomoticz Homebridge-Plugin

Post by Marci »

I've got all the typevals from 0 thru 17... are there more?? Will post source for emulator this evening - effectively, it just allows you to copy in a User's JSON output to build up/replicate a static set of sensors to diagnose user issues.

S'nothing major - single file functional PHP, but you will need a locally installed web server on your development machine able to parse .htm files as PHP. (e.g.: SetHandler statement in httpd.conf or .htaccess)
Last edited by Marci on Thursday 11 February 2016 18:19, edited 1 time in total.
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!
Sneezydevil
Posts: 111
Joined: Monday 18 January 2016 9:56
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: eDomoticz Homebridge-Plugin

Post by Sneezydevil »

Nah thats what I have aswell, no need to post them then.

Cool ty. I have been developing in php for 16 years the UWP app is my first c# expierence so I should be able to figure it out.
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: eDomoticz Homebridge-Plugin

Post by Marci »

Sure you don’t need the destructions, but... spool up a vhost in apache listening on port 8080 (or whatever you fancy, just remember to point config.json at whatever port)... edit your virtualhost.conf file (or just stick it in .htaccess) and add:

Code: Select all

<FilesMatch ".+\.htm$">
        SetHandler application/x-httpd-php
</FilesMatch>
...into the relevant <VirtualHost *:8080></VirtualHost> container. Restart apache.

Then - json.htm in the web root...

Code: Select all

<?php
if (isset($_GET['type'])){ $types=true; }
if (isset($_GET['rid'])){ $idx=$_GET['rid']; } else { $idx=false; }

function transjson($json){
	if (!isset($_GET['callback'])){
		header('Content-Type: application/json; charset=utf8');
		header("Cache-Control: no-cache, must-revalidate");
		header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
		header('Access-Control-Allow-Origin: *');
		exit($json);
	} elseif (is_valid_callback($_GET['callback'])){
		header('Content-Type: application/javascript; charset=utf8');
		header("Cache-Control: no-cache, must-revalidate");
		header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
		exit("{$_GET['callback']}($json)");
	} else {
		header('status: 400 Bad Request', true, 400);
	}

}

if (($types==true) && ($idx==false)) {
	$pre = '{ "ActTime" : 1454957927, "ServerTime" : "2016-02-08 18:58:47", "Sunrise" : "07:27", "Sunset" : "16:59", "result" : [';
	$post = '], "status" : "OK", "title" : "Devices" };';
	$output = '{ "AddjMulti" : 1.0, "AddjMulti2" : 1.0, "AddjValue" : 0.0, "AddjValue2" : 0.0, "BatteryLevel" : 255, "CustomImage" : 0, "Data" : "Off", "Description" : "", "Favorite" : 1, "HardwareID" : 2, "HardwareName" : "RFXCOM", "HardwareType" : "RFXCOM - RFXtrx433 USB 433.92MHz Transceiver", "HardwareTypeVal" : 1, "HaveDimmer" : true, "HaveGroupCmd" : true, "HaveTimeout" : false, "ID" : "004DDA2", "Image" : "Light", "IsSubDevice" : false, "LastUpdate" : "2016-02-08 17:46:14", "Level" : 100, "LevelInt" : 15, "MaxDimLevel" : 15, "Name" : "Ruby\'s Ceiling Light", "Notifications" : "false", "PlanID" : "8", "PlanIDs" : [ 8, 11 ], "Protected" : false, "ShowNotifications" : true, "SignalLevel" : 5, "Status" : "Off", "StrParam1" : "", "StrParam2" : "", "SubType" : "AC", "SwitchType" : "Dimmer", "SwitchTypeVal" : 7, "Timers" : "false", "Type" : "Lighting 2", "TypeImg" : "dimmer", "Unit" : 12, "Used" : 1, "UsedByCamera" : false, "XOffset" : "860", "YOffset" : "556", "idx" : "1" },{ "AddjMulti" : 1.0, "AddjMulti2" : 1.0, "AddjValue" : 0.0, "AddjValue2" : 0.0, "BatteryLevel" : 255, "CustomImage" : 0, "Data" : "Off", "Description" : "", "Favorite" : 1, "HardwareID" : 4, "HardwareName" : "RFX", "HardwareType" : "RFXCOM - RFXtrx433 USB 433.92MHz Transceiver", "HardwareTypeVal" : 1, "HaveDimmer" : false, "HaveGroupCmd" : true, "HaveTimeout" : false, "ID" : "65", "Image" : "Light", "IsSubDevice" : false, "LastUpdate" : "2016-02-09 18:59:45", "Level" : 0, "LevelInt" : 0, "MaxDimLevel" : 0, "Name" : "My light", "Notifications" : "false", "PlanID" : "0", "PlanIDs" : [ 0 ], "Protected" : false, "ShowNotifications" : true, "SignalLevel" : 7, "Status" : "Off", "StrParam1" : "", "StrParam2" : "", "SubType" : "COCO GDR2", "SwitchType" : "On/Off", "SwitchTypeVal" : 0, "Timers" : "false", "Type" : "Lighting 1", "TypeImg" : "lightbulb", "Unit" : 4, "Used" : 1, "UsedByCamera" : false, "XOffset" : "0", "YOffset" : "0", "idx" : "2" },{ "AddjMulti" : 1.0, "AddjMulti2" : 1.0, "AddjValue" : 0.0, "AddjValue2" : 0.0, "BatteryLevel" : 255, "CustomImage" : 125, "Data" : "On", "Description" : "", "Favorite" : 1, "HardwareID" : 2, "HardwareName" : "RFXCOM", "HardwareType" : "RFXCOM - RFXtrx433 USB 433.92MHz Transceiver", "HardwareTypeVal" : 1, "HaveDimmer" : true, "HaveGroupCmd" : true, "HaveTimeout" : false, "ID" : "0005B77", "Image" : "OutsideLantern", "IsSubDevice" : false, "LastUpdate" : "2016-02-08 16:59:00", "Level" : 0, "LevelInt" : 0, "MaxDimLevel" : 15, "Name" : "Outside Front Door", "Notifications" : "false", "PlanID" : "10", "PlanIDs" : [ 10, 11 ], "Protected" : false, "ShowNotifications" : true, "SignalLevel" : "-", "Status" : "On", "StrParam1" : "", "StrParam2" : "", "SubType" : "AC", "SwitchType" : "On/Off", "SwitchTypeVal" : 0, "Timers" : "true", "Type" : "Lighting 2", "TypeImg" : "lightbulb", "Unit" : 1, "Used" : 1, "UsedByCamera" : false, "XOffset" : "929", "YOffset" : "519", "idx" : "3" },{ "AddjMulti" : 1.0, "AddjMulti2" : 1.0, "AddjValue" : 0.0, "AddjValue2" : 0.0, "BatteryLevel" : 255, "CustomImage" : 0, "Data" : "On", "Description" : "", "Favorite" : 1, "HardwareID" : 2, "HardwareName" : "RFXCOM", "HardwareType" : "RFXCOM - RFXtrx433 USB 433.92MHz Transceiver", "HardwareTypeVal" : 1, "HaveDimmer" : true, "HaveGroupCmd" : true, "HaveTimeout" : false, "ID" : "F298E1", "Image" : "Light", "IsSubDevice" : false, "LastUpdate" : "2016-02-06 13:50:45", "Level" : 100, "LevelInt" : 32, "MaxDimLevel" : 32, "Name" : "Scarlett\'s Ceiling Light", "Notifications" : "false", "PlanID" : "9", "PlanIDs" : [ 9, 11 ], "Protected" : false, "ShowNotifications" : true, "SignalLevel" : "-", "Status" : "On", "StrParam1" : "", "StrParam2" : "", "SubType" : "LightwaveRF", "SwitchType" : "Dimmer", "SwitchTypeVal" : 7, "Timers" : "false", "Type" : "Lighting 5", "TypeImg" : "dimmer", "Unit" : 16, "Used" : 1, "UsedByCamera" : false, "XOffset" : "155", "YOffset" : "193", "idx" : "4" },{ "AddjMulti" : 1.0, "AddjMulti2" : 1.0, "AddjValue" : 0.0, "AddjValue2" : 0.0, "BatteryLevel" : 255, "CustomImage" : 0, "Data" : "On, Level: 100 %", "Description" : "", "Favorite" : 0, "HardwareID" : 7, "HardwareName" : "RFXCom", "HardwareType" : "RFXCOM - RFXtrx433 USB 433.92MHz Transceiver", "HardwareTypeVal" : 1, "HaveDimmer" : true, "HaveGroupCmd" : true, "HaveTimeout" : false, "ID" : "00F6742", "Image" : "Light", "IsSubDevice" : false, "LastUpdate" : "2016-02-08 17:40:51", "Level" : 100, "LevelInt" : 15, "MaxDimLevel" : 15, "Name" : "Bug String", "Notifications" : "false", "PlanID" : "7", "PlanIDs" : [ 7, 11 ], "Protected" : false, "ShowNotifications" : true, "SignalLevel" : 4, "Status" : "On", "StrParam1" : "", "StrParam2" : "", "SubType" : "AC", "SwitchType" : "On/Off", "SwitchTypeVal" : 0, "Timers" : "false", "Type" : "Lighting 2", "TypeImg" : "lightbulb", "Unit" : 14, "Used" : 1, "UsedByCamera" : false, "XOffset" : "24", "YOffset" : "664", "idx" : "5" },{ "AddjMulti" : 1.0, "AddjMulti2" : 1.0, "AddjValue" : 0.0, "AddjValue2" : 0.0, "BatteryLevel" : 255, "CustomImage" : 0, "Data" : "On", "Description" : "", "Favorite" : 0, "HardwareID" : 7, "HardwareName" : "RFXCom", "HardwareType" : "RFXCOM - RFXtrx433 USB 433.92MHz Transceiver", "HardwareTypeVal" : 1, "HaveDimmer" : true, "HaveGroupCmd" : true, "HaveTimeout" : false, "ID" : "00F6742", "Image" : "Light", "IsSubDevice" : false, "LastUpdate" : "2016-02-08 20:41:34", "Level" : 0, "LevelInt" : 0, "MaxDimLevel" : 15, "Name" : "Twinkle 1", "Notifications" : "false", "PlanID" : "5", "PlanIDs" : [ 5, 11 ], "Protected" : false, "ShowNotifications" : true, "SignalLevel" : "-", "Status" : "On", "StrParam1" : "", "StrParam2" : "", "SubType" : "AC", "SwitchType" : "On/Off", "SwitchTypeVal" : 0, "Timers" : "false", "Type" : "Lighting 2", "TypeImg" : "lightbulb", "Unit" : 1, "Used" : 1, "UsedByCamera" : false, "XOffset" : "261", "YOffset" : "703", "idx" : "6" };
	$json = ($pre.$output.$post);
	transjson($json);
}

if (($types==true)&&($idx)){
	$pre = '{ "ActTime" : 1454957927, "ServerTime" : "2016-02-08 18:58:47", "Sunrise" : "07:27", "Sunset" : "16:59", "result" : [';
	$post = '], "status" : "OK", "title" : "Devices" };';
	if($idx==1){
		$output = '{ "ActTime" : 1454957927, "ServerTime" : "2016-02-08 18:58:47", "Sunrise" : "07:27", "Sunset" : "16:59", "result" : [{ "AddjMulti" : 1.0, "AddjMulti2" : 1.0, "AddjValue" : 0.0, "AddjValue2" : 0.0, "BatteryLevel" : 255, "CustomImage" : 0, "Data" : "Off", "Description" : "", "Favorite" : 1, "HardwareID" : 2, "HardwareName" : "RFXCOM", "HardwareType" : "RFXCOM - RFXtrx433 USB 433.92MHz Transceiver", "HardwareTypeVal" : 1, "HaveDimmer" : true, "HaveGroupCmd" : true, "HaveTimeout" : false, "ID" : "004DDA2", "Image" : "Light", "IsSubDevice" : false, "LastUpdate" : "2016-02-08 17:46:14", "Level" : 100, "LevelInt" : 15, "MaxDimLevel" : 15, "Name" : "Ruby\'s Ceiling Light", "Notifications" : "false", "PlanID" : "8", "PlanIDs" : [ 8, 11 ], "Protected" : false, "ShowNotifications" : true, "SignalLevel" : 5, "Status" : "Off", "StrParam1" : "", "StrParam2" : "", "SubType" : "AC", "SwitchType" : "Dimmer", "SwitchTypeVal" : 7, "Timers" : "false", "Type" : "Lighting 2", "TypeImg" : "dimmer", "Unit" : 12, "Used" : 1, "UsedByCamera" : false, "XOffset" : "860", "YOffset" : "556", "idx" : "1" }';
	} else if ($idx==2){
		$output = '{ "AddjMulti" : 1.0, "AddjMulti2" : 1.0, "AddjValue" : 0.0, "AddjValue2" : 0.0, "BatteryLevel" : 255, "CustomImage" : 0, "Data" : "Off", "Description" : "", "Favorite" : 1, "HardwareID" : 4, "HardwareName" : "RFX", "HardwareType" : "RFXCOM - RFXtrx433 USB 433.92MHz Transceiver", "HardwareTypeVal" : 1, "HaveDimmer" : false, "HaveGroupCmd" : true, "HaveTimeout" : false, "ID" : "65", "Image" : "Light", "IsSubDevice" : false, "LastUpdate" : "2016-02-09 18:59:45", "Level" : 0, "LevelInt" : 0, "MaxDimLevel" : 0, "Name" : "My light", "Notifications" : "false", "PlanID" : "0", "PlanIDs" : [ 0 ], "Protected" : false, "ShowNotifications" : true, "SignalLevel" : 7, "Status" : "Off", "StrParam1" : "", "StrParam2" : "", "SubType" : "COCO GDR2", "SwitchType" : "On/Off", "SwitchTypeVal" : 0, "Timers" : "false", "Type" : "Lighting 1", "TypeImg" : "lightbulb", "Unit" : 4, "Used" : 1, "UsedByCamera" : false, "XOffset" : "0", "YOffset" : "0", "idx" : "2" }';
	} else if ($idx==3){
		$output = '{ "AddjMulti" : 1.0, "AddjMulti2" : 1.0, "AddjValue" : 0.0, "AddjValue2" : 0.0, "BatteryLevel" : 255, "CustomImage" : 125, "Data" : "On", "Description" : "", "Favorite" : 1, "HardwareID" : 2, "HardwareName" : "RFXCOM", "HardwareType" : "RFXCOM - RFXtrx433 USB 433.92MHz Transceiver", "HardwareTypeVal" : 1, "HaveDimmer" : true, "HaveGroupCmd" : true, "HaveTimeout" : false, "ID" : "0005B77", "Image" : "OutsideLantern", "IsSubDevice" : false, "LastUpdate" : "2016-02-08 16:59:00", "Level" : 0, "LevelInt" : 0, "MaxDimLevel" : 15, "Name" : "Outside Front Door", "Notifications" : "false", "PlanID" : "10", "PlanIDs" : [ 10, 11 ], "Protected" : false, "ShowNotifications" : true, "SignalLevel" : "-", "Status" : "On", "StrParam1" : "", "StrParam2" : "", "SubType" : "AC", "SwitchType" : "On/Off", "SwitchTypeVal" : 0, "Timers" : "true", "Type" : "Lighting 2", "TypeImg" : "lightbulb", "Unit" : 1, "Used" : 1, "UsedByCamera" : false, "XOffset" : "929", "YOffset" : "519", "idx" : "3" }';
	} else if ($idx==4){
		$output='{ "AddjMulti" : 1.0, "AddjMulti2" : 1.0, "AddjValue" : 0.0, "AddjValue2" : 0.0, "BatteryLevel" : 255, "CustomImage" : 0, "Data" : "On", "Description" : "", "Favorite" : 1, "HardwareID" : 2, "HardwareName" : "RFXCOM", "HardwareType" : "RFXCOM - RFXtrx433 USB 433.92MHz Transceiver", "HardwareTypeVal" : 1, "HaveDimmer" : true, "HaveGroupCmd" : true, "HaveTimeout" : false, "ID" : "F298E1", "Image" : "Light", "IsSubDevice" : false, "LastUpdate" : "2016-02-06 13:50:45", "Level" : 100, "LevelInt" : 32, "MaxDimLevel" : 32, "Name" : "Scarlett\'s Ceiling Light", "Notifications" : "false", "PlanID" : "9", "PlanIDs" : [ 9, 11 ], "Protected" : false, "ShowNotifications" : true, "SignalLevel" : "-", "Status" : "On", "StrParam1" : "", "StrParam2" : "", "SubType" : "LightwaveRF", "SwitchType" : "Dimmer", "SwitchTypeVal" : 7, "Timers" : "false", "Type" : "Lighting 5", "TypeImg" : "dimmer", "Unit" : 16, "Used" : 1, "UsedByCamera" : false, "XOffset" : "155", "YOffset" : "193", "idx" : "4" }';
	} else if($idx==5){
		$output = ' "AddjMulti" : 1.0, "AddjMulti2" : 1.0, "AddjValue" : 0.0, "AddjValue2" : 0.0, "BatteryLevel" : 255, "CustomImage" : 0, "Data" : "On, Level: 100 %", "Description" : "", "Favorite" : 0, "HardwareID" : 7, "HardwareName" : "RFXCom", "HardwareType" : "RFXCOM - RFXtrx433 USB 433.92MHz Transceiver", "HardwareTypeVal" : 1, "HaveDimmer" : true, "HaveGroupCmd" : true, "HaveTimeout" : false, "ID" : "00F6742", "Image" : "Light", "IsSubDevice" : false, "LastUpdate" : "2016-02-08 17:40:51", "Level" : 100, "LevelInt" : 15, "MaxDimLevel" : 15, "Name" : "Bug String", "Notifications" : "false", "PlanID" : "7", "PlanIDs" : [ 7, 11 ], "Protected" : false, "ShowNotifications" : true, "SignalLevel" : 4, "Status" : "On", "StrParam1" : "", "StrParam2" : "", "SubType" : "AC", "SwitchType" : "On/Off", "SwitchTypeVal" : 0, "Timers" : "false", "Type" : "Lighting 2", "TypeImg" : "lightbulb", "Unit" : 14, "Used" : 1, "UsedByCamera" : false, "XOffset" : "24", "YOffset" : "664", "idx" : "5" }';
	} else if($idx==6){
		$output = '{ "AddjMulti" : 1.0, "AddjMulti2" : 1.0, "AddjValue" : 0.0, "AddjValue2" : 0.0, "BatteryLevel" : 255, "CustomImage" : 0, "Data" : "On", "Description" : "", "Favorite" : 0, "HardwareID" : 7, "HardwareName" : "RFXCom", "HardwareType" : "RFXCOM - RFXtrx433 USB 433.92MHz Transceiver", "HardwareTypeVal" : 1, "HaveDimmer" : true, "HaveGroupCmd" : true, "HaveTimeout" : false, "ID" : "00F6742", "Image" : "Light", "IsSubDevice" : false, "LastUpdate" : "2016-02-08 20:41:34", "Level" : 0, "LevelInt" : 0, "MaxDimLevel" : 15, "Name" : "Twinkle 1", "Notifications" : "false", "PlanID" : "5", "PlanIDs" : [ 5, 11 ], "Protected" : false, "ShowNotifications" : true, "SignalLevel" : "-", "Status" : "On", "StrParam1" : "", "StrParam2" : "", "SubType" : "AC", "SwitchType" : "On/Off", "SwitchTypeVal" : 0, "Timers" : "false", "Type" : "Lighting 2", "TypeImg" : "lightbulb", "Unit" : 1, "Used" : 1, "UsedByCamera" : false, "XOffset" : "261", "YOffset" : "703", "idx" : "6" }';
	}
	$json =  ($pre.$output.$post);
	transjson($json);
}
?>
In the above, I’ve taken each of deejc & jem101’s JSON output as submitted to the GitRepo, stripped line breaks altho not really necessary, one per if(idx=={int}) statement... and also concatenated them all and put the lot into $output in if (($types==true) && ($idx==false)) {}

Voila. Done. Domesticz accessory emulator. Point your config.json at your web server IP and port, and fire up Homebridge.

So, I have my ‘main’ homebridge which runs from RaspPi. I also have homebridge and homebridge-edomoticz installed on my MacbookPro, which is hosting the above at localhost:8080.

In my home kit apps, I have two homes... my actual home, paired to the rasppi homebridge, and my dev-home, paired to my Macbook homebridge install. I can mess around with user’s setups to my heart’s content without messing up my own home’s setup. I can replicate the output of their sensors precisely with a quick copy & paste.

Or, create a room in your real Domoticz... manually add switches, one of every type... hit up json.htm?type=devices&plan={room idx} to get an output of just those sensors. Copy and paste into $output above, and into the if / else if statements for the individual sensors in if (($types==true)&&($idx)){}
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!
Sneezydevil
Posts: 111
Joined: Monday 18 January 2016 9:56
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: eDomoticz Homebridge-Plugin

Post by Sneezydevil »

Nice thank you will try it.
User avatar
deejc
Posts: 168
Joined: Tuesday 22 September 2015 18:50
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.5641
Location: UK
Contact:

Re: eDomoticz Homebridge-Plugin

Post by deejc »

im not sure if this will help anyone but for future ref (mainly for my self) im making a note of it here as its relevant

Setting up Monit on Raspberry pi to restart homebridge if it fails

i followed this guide upto and including Step 3
https://www.the-hawkes.de/monitor-your- ... monit.html

I then created /etc/monit/conf.d/homebridge

Code: Select all

check process homebridge with pidfile /var/run/homebridge.pid
    start program = "/etc/init.d/homebridge start" with timeout 60 seconds
    stop program  = "/etc/init.d/homebridge stop"
    if cpu > 60% for 2 cycles then alert
    if cpu > 80% for 5 cycles then restart
    if totalmem > 200.0 MB for 5 cycles then restart
    if loadavg(5min) greater than 10 for 8 cycles then stop
    if failed host 127.0.0.1 port 51826 protocol http
       and request "/accessories"
    then restart
    if 3 restarts within 5 cycles then timeout
My homebridge is running with out forever and using the init.d script.
also i dont know if the memory and cpu loads are right as i copied this from the apache conf
Domoticz 3.5641 on RPI (Raspbian GNU/Linux 8)
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: eDomoticz Homebridge-Plugin

Post by Marci »

Stick it as a new issue on main homeBridge repo and Nik or Khaos should be able to tell you correct-ish number of cycles to watch for... 8-)

Ps: remembered why I went with havedimmer in the plugin in the first place... S'cos that's what they use in the official domoticz legacy shim supplied on the domoticz sd card Raspi image to assign dimmer characteristic :lol:
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
deejc
Posts: 168
Joined: Tuesday 22 September 2015 18:50
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.5641
Location: UK
Contact:

Re: eDomoticz Homebridge-Plugin

Post by deejc »

They should ditch that shim and make your plugin the official as it rocks


Sent from my iPhone using Tapatalk
Domoticz 3.5641 on RPI (Raspbian GNU/Linux 8)
m0rph13
Posts: 18
Joined: Sunday 31 January 2016 1:24
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.4834
Contact:

Re: eDomoticz Homebridge-Plugin

Post by m0rph13 »

Love your plugin, I too think they should update the image and include yours instead of the old deprecated one (whats the point in shipping deprecated software?!).

I'm having troubles getting HomeKit to properly show my switches, which might also affect Siris ability to switch them for me.

By looking at the Domotics json output for my switches, I see that they are properly reporting their status as on or off, but when looking at the same Switch in MyTouch Home, it does not seem to pick up its current status correctly.

Earlier, I had the same problem when using the Z-way HomeBridge plugin, but I worked around it by making the switches appear as lights (which is why I reported this feature request :) ).

I'll experiment a little with resetting HomeKit and get rid of the persisted data in HomeBridge... But I think the first step to enlightenment would be to verify the HomeBridge output.

After that I guess I will find a way to debug the HomeBridge output. Hopefully there is a debug switch that might help. If that does not help the next step is probably to set up the HomeKit environment on my OS X to see if I can see the data from that end instead.

Has anyone else experienced this behavior with Fibaro switches?

Edit: no sooner had I posted this than my devices started to properly show their current status in MyTouch Home. My Apple TV is currently turned on and I'll test to shut it off to see if remote access is part of the issue
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: eDomoticz Homebridge-Plugin

Post by Marci »

There’s a bit of ugliness in how everything works to do what we’re doing here, especially bearing in mind the ideal hardware most are using (rPi).

That ugliness being, to get status of a single accessory involves a single http request. The way we’re handling things at the moment means to update your app will trigger [num of accessories] http requests, and have to wait for that many responses.
  • The more accessories, the longer it takes for all the responses (especially if you’re using a Micro Wifi dongle on your Pi - all my kit is wired on gigabit however).
  • The more your CPU is strained on your RaspPi, the longer those responses take.
  • The more requests you make, the more strained the CPU is.
Spot the flaw. That’s without taking into account any manual scripts y’all are running to get your sensor values into Domotics (i’ve got a pile of python scripts running handling various fudged sensors on GPIOs, over OSC etc, which are all in turn updating Domoticz virtual sensors with yet more http requests).

When things don’t show up, we close and reopen apps and swipe about, triggering a constant pile of even more http requests all needing responses or to timeout.

Need to find a way to just get the _entire_ devices list once per update, and extrapolate the accessories from that, but that’s not how HomeKit nor HAP-NodeJS (the part of homebridge doing the actual work) are currently designed to work. Am pondering.

BUT all that said, glad your devices are responding correctly now m0rph!!

Upcoming: made a Gas Pulse Sensor today (2-wire magnetic reed switch under the dials, attached to RPi GPIO, & python crunching the counters) - it’s strapped to my iTron U6 and is giving me pulses as we speak, which has provided me with a P1 Gas Smart Meter in Domoticz, so support for that’ll be added to the plugin shortly too as a custom accessory/characteristic type... then I’ve just gotta choose me a 433Mhz Thermostat Relay Receiver. Once that shows up I’ll be working on adding some heating control (in addition to the request opened for EvoHome zone support over on the repo) which will hopefully be a spec-compliant HomeKit type.
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!
arcidodo
Posts: 3
Joined: Monday 15 February 2016 22:22
Target OS: Linux
Domoticz version: Latest
Contact:

Re: eDomoticz Homebridge-Plugin

Post by arcidodo »

Hello! your plugin works great! but i have the OpenTherm Gateway to control my thermostat is it possible to manage it using your plugin? it is now listed as switch in Eve.

thanks!
Eduard
Posts: 139
Joined: Monday 19 January 2015 9:14
Target OS: -
Domoticz version:

Re: eDomoticz Homebridge-Plugin

Post by Eduard »

Just wondering:
Why are the temperatures rounded to half?
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: eDomoticz Homebridge-Plugin

Post by Marci »

Cos when they weren't, HomeKit complained they were non-compliant and refused to add them.
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!
Eduard
Posts: 139
Joined: Monday 19 January 2015 9:14
Target OS: -
Domoticz version:

Re: eDomoticz Homebridge-Plugin

Post by Eduard »

Marci wrote:Cos when they weren't, HomeKit complained they were non-compliant and refused to add them.
Ok. Thanks. Good to know ;)
steppi
Posts: 41
Joined: Saturday 30 January 2016 0:33
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: eDomoticz Homebridge-Plugin

Post by steppi »

Hi guys!
I want to connect to my Homebridge of Domoticz security system, but I saw that with eDomoticz there is no work "security system" .. You could add?
One more question: I would like to install one "Selector Switch" of Domoticz and can choose directly from Home.app (Homekit)
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: eDomoticz Homebridge-Plugin

Post by Marci »

See instructions on first post for requesting additional device support.

HomeKit has no option for providing selector switches - it's not in the specification. Until Apple supports the control type there's nothing I can do.
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!
Heisenberg
Posts: 135
Joined: Monday 27 January 2014 14:12
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: eDomoticz Homebridge-Plugin

Post by Heisenberg »

Hi, when I try to execute

Code: Select all

sudo npm install -g homebridge && sudo npm install -g forever
I get this message:

Code: Select all

pi@raspberrypi:~ $ sudo npm install -g homebridge && sudo npm install -g forever
sudo: npm: command not found
After I performed

Code: Select all

sudo apt-get install npm

Code: Select all

sudo npm install -g homebridge && sudo npm install -g forever
I get these errors:

Code: Select all

gyp ERR! stack     at ChildProcess.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:809:                                                                                                                                                             12)
gyp ERR! System Linux 4.1.17-v7+
gyp ERR! command "nodejs" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/node                                                                                                                                                             _modules/curve25519
gyp ERR! node -v v0.10.29
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian


> [email protected] install /usr/local/lib/node_modules/homebridge/node_modules/hap-                                                                                                                                                             nodejs/node_modules/ed25519
> node-gyp rebuild


path.js:309
      var path = (i >= 0) ? arguments[i] : process.cwd();
                                                   ^
Error: ENOENT, no such file or directory
    at Object.exports.resolve (path.js:309:52)
    at Function.Module._resolveLookupPaths (module.js:260:17)
    at Function.Module._resolveFilename (module.js:328:31)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/usr/share/node-gyp/bin/node-gyp.js:13:11)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)

npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the curve25519 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 their info via:
npm ERR!     npm owner ls curve25519
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 4.1.17-v7+
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "homebridge"
npm ERR! cwd /home/pi
npm ERR! node -v v0.10.29
npm ERR! npm -v 1.4.21
npm ERR! code ELIFECYCLE
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian


> [email protected] install /usr/local/lib/node_modules/homebridge/node_modules/hap-no                                                                                                                                                             dejs/node_modules/mdns
> node-gyp rebuild
Raspberry Pi Type B
Raspberry Pi Type B2
RFXCOMtrx433e
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:

eDomoticz Homebridge-Plugin

Post by Marci »

Code: Select all

npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian
This implies your nodejs installation is out of date. Issues with installation of npm / node need raising via npm support / nodejs support. The only thing I can suggest is to run...

Code: Select all

sudo apt-get update && sudo apt-get upgrade
...again.
Last edited by Marci on Saturday 20 February 2016 16:00, edited 3 times in total.
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
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: eDomoticz Homebridge-Plugin

Post by Marci »

If you’ve got a Gas Pulse Counter or Elec Pulse Counter being registered as a P1 Smart Meter sensor, or an OpenThermGateway, or EvoHome Thermostat running in Domoticz, it MIGHT be worth updating homebridge-eDomoticz to latest version (0.1.19). The following assumes that the EvoHome has been added via this script method.

OpenTherm & EvoHome support VERY experimental...
  • OpenTherm should be able to change / read the SetPoint (range: 5 - 38 deg C)
  • EvoHome should be able to read & change the setPoint (range as above), as well as set Temporary Override time in minutes up to 8 hours in the future, or set minutes to 0 for auto mode, minutes to 481 for permanent override.
  • Changing the SetPoint (only) in BOTH cases should be doable via Siri as this support is using the native HomeKit Thermostat accessory type
Am waiting for confirmation on the OpenTherm/EvoHome front that it works, however, have tested to ensure that existing sensor functionality is unaffected by these additions, so nothing should be broken by the update if you don’t have these sensors.

Also, if you have a script that’s monitoring & converting a gas pulse count over time to get kWh for a “realtime” gas consumption and you’ve got this mapped to a General > kWh elec meter, make sure the word “Gas” is in it’s name in Domoticz and it should pull thru the reading from the Usage field. (The P1 Smart Meter Gas Sensor just gives you today’s total unit count so far (in m3))
Eduard wrote:Just wondering:
Why are the temperatures rounded to half?
AND, after investigating further as a result of @Eduard’s post, Temp sensors now no longer round to nearest 0.5 deg. They round to nearest 0.1 deg.

Code: Select all

sudo npm update -g homebridge-edomoticz
forever restart /usr/local/lib/node_modules/homebridge/bin/homebridge
tail -f `ls -t ~/.forever/*.log | grep -v '^d' | head -n1`
Last edited by Marci on Saturday 20 February 2016 21:18, edited 1 time in total.
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!
Eduard
Posts: 139
Joined: Monday 19 January 2015 9:14
Target OS: -
Domoticz version:

Re: eDomoticz Homebridge-Plugin

Post by Eduard »

I've noticed that the dim-level is correctly shown in my Eve-app using HomeBridge, but the Power-states of all devices (both lights & switches) show 'OFF'. Is there any change on showing the correct power state?
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: eDomoticz Homebridge-Plugin

Post by Marci »

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!
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest