Page 22 of 86

Re: eDomoticz Homebridge-Plugin

Posted: Thursday 04 August 2016 17:56
by Marci
@TheRamon - I’ve knocked up an mqtt-integration branch over on github... and an issue raised to cover, should you feel the urge to tinker! See https://github.com/PatchworkBoy/homebri ... /issues/29 - Currently it connects to the domoticz/out stream and echoes any messages to the homebridge log. Need to work out how best to parse and then affect those changes back to HomeKit. Am referencing cflurin’s homebridge-mqtt plugin for the foundations.

There are some caveats to be aware of thru doing this tho... namely, amount of generated traffic = increase in mem load on a lowly RaspPi B+ (for instance), and (more importantly) this will result in a significant impact on battery life for devices connected to HomeKit depending on how many Domoticz accessories one has and how frequently sensors update within Domoticz.

Re: eDomoticz Homebridge-Plugin

Posted: Friday 05 August 2016 6:52
by sandurz
Nice work! You're the fastest dev ever. As you go forward it might be nice to have an MQTT inclusion/exclusion prefix or just name list option in the config since it might not be critical for every device to go real time.

I was rigging something up today with the same new homebridge-mqtt platform to test out controlling actual non-homebridge HomeKit devices direct from Domoticz using native iOS triggers and dummy switches and man it works great now that we can go real time with MQTT. Very exciting stuff.

Re: eDomoticz Homebridge-Plugin

Posted: Saturday 06 August 2016 10:07
by anasazi
Hi,

I have som problem with my thermostat when using it in eDomiticz.

I have a Popp Radiator Thermostat (the same as Danfoss LC-13 but this can report the temp) which I can control from Domoticz without any problem.
In Domoticz I can see and set the temperature correctly.

On my iPhone I'm using Elgato Eve to add homekit devices and I can add the Homebridge without problems.
But when I'm viewing the thermostat, both current temp and target temp is the same.
Do you know why and how I can fix this?

As you can see the current temperature shows as a an own accessory also but the value should also be in the thermostat.
Both thees

See the attached image...
Thanks!

Re: eDomoticz Homebridge-Plugin

Posted: Saturday 06 August 2016 10:25
by TheRamon
Oh wow. Great work. Memory load might be a thing, jeps. I'd love to take a look. Might be tonight or tomorrow, don't know yet. I'll keep you updated!

Re: eDomoticz Homebridge-Plugin

Posted: Saturday 06 August 2016 11:07
by Marci
anasazi wrote:Hi,

I have som problem with my thermostat when using it in eDomiticz.

I have a Popp Radiator Thermostat (the same as Danfoss LC-13 but this can report the temp) which I can control from Domoticz without any problem.
In Domoticz I can see and set the temperature correctly.

On my iPhone I'm using Elgato Eve to add homekit devices and I can add the Homebridge without problems.
But when I'm viewing the thermostat, both current temp and target temp is the same.
Do you know why and how I can fix this?

As you can see the current temperature shows as a an own accessory also but the value should also be in the thermostat.
Both thees

See the attached image...
Thanks!
See first post, q & a's... need JSON output for the device to be able to investigate.

Re: eDomoticz Homebridge-Plugin

Posted: Saturday 06 August 2016 12:31
by anasazi
Marci wrote:
anasazi wrote:Hi,

I have som problem with my thermostat when using it in eDomiticz.

I have a Popp Radiator Thermostat (the same as Danfoss LC-13 but this can report the temp) which I can control from Domoticz without any problem.
In Domoticz I can see and set the temperature correctly.

On my iPhone I'm using Elgato Eve to add homekit devices and I can add the Homebridge without problems.
But when I'm viewing the thermostat, both current temp and target temp is the same.
Do you know why and how I can fix this?

As you can see the current temperature shows as a an own accessory also but the value should also be in the thermostat.
Both thees

See the attached image...
Thanks!
See first post, q & a's... need JSON output for the device to be able to investigate.
Sorry about that.
When I'm running this "http:/xxx.xxx.xxx.xxx/json.htm?type=devices&rid=ID3, all I get is this:
{
"ActTime" : 1470476433,
"ServerTime" : "2016-08-06 11:40:33",
"Sunrise" : "05:18",
"Sunset" : "20:58",
"status" : "OK",
"title" : "Devices"
}

I don't get any result.
Am I doing something wrong?
Tried it with Chrome and JSONView but it's the same...
I'm using an Aeon Labs Z-Stick if it does matter.

Re: eDomoticz Homebridge-Plugin

Posted: Saturday 06 August 2016 12:34
by Marci
S'the ID3 - that's wrong. You want the IDX number for your thermostat from your devices list there... (Settings > Devices in Domoticz)

Re: eDomoticz Homebridge-Plugin

Posted: Saturday 06 August 2016 12:39
by anasazi
Marci wrote:
anasazi wrote:Hi,

I have som problem with my thermostat when using it in eDomiticz.

I have a Popp Radiator Thermostat (the same as Danfoss LC-13 but this can report the temp) which I can control from Domoticz without any problem.
In Domoticz I can see and set the temperature correctly.

On my iPhone I'm using Elgato Eve to add homekit devices and I can add the Homebridge without problems.
But when I'm viewing the thermostat, both current temp and target temp is the same.
Do you know why and how I can fix this?

As you can see the current temperature shows as a an own accessory also but the value should also be in the thermostat.
Both thees

See the attached image...
Thanks!
See first post, q & a's... need JSON output for the device to be able to investigate.
Got it!
Here comes the json output:

{
"ActTime" : 1470479795,
"ServerTime" : "2016-08-06 12:36:35",
"Sunrise" : "05:18",
"Sunset" : "20:58",
"result" : [
{
"AddjMulti" : 1.0,
"AddjMulti2" : 1.0,
"AddjValue" : 0.0,
"AddjValue2" : 0.0,
"BatteryLevel" : 100,
"CustomImage" : 0,
"Data" : "22.0",
"Description" : "",
"Favorite" : 0,
"HardwareID" : 2,
"HardwareName" : "Aeon Labs Z-Stick",
"HardwareType" : "OpenZWave USB",
"HardwareTypeVal" : 21,
"HaveTimeout" : false,
"ID" : "0000501",
"LastUpdate" : "2016-08-06 12:34:52",
"Name" : "Kökstermostat",
"Notifications" : "false",
"PlanID" : "0",
"PlanIDs" : [ 0 ],
"Protected" : false,
"SetPoint" : "22.0",
"ShowNotifications" : true,
"SignalLevel" : "-",
"SubType" : "SetPoint",
"Timers" : "false",
"Type" : "Thermostat",
"TypeImg" : "override_mini",
"Unit" : 1,
"Used" : 1,
"XOffset" : "0",
"YOffset" : "0",
"idx" : "2"
}
],
"status" : "OK",
"title" : "Devices"
}

Re: eDomoticz Homebridge-Plugin

Posted: Saturday 06 August 2016 12:44
by Marci
The data and setpoint fields are the only two we care about - both read 22. Is that the case? (Presume one is current, other is target)

Re: eDomoticz Homebridge-Plugin

Posted: Saturday 06 August 2016 12:49
by anasazi
Marci wrote:The data and setpoint fields are the only two we care about - both read 22. Is that the case? (Presume one is current, other is target)
Correct!

Here is the output for the temperature device in Domoticz which is from the same physical thermostat device as device 2 (idx):

{
"ActTime" : 1470480369,
"ServerTime" : "2016-08-06 12:46:09",
"Sunrise" : "05:18",
"Sunset" : "20:58",
"result" : [
{
"AddjMulti" : 1.0,
"AddjMulti2" : 1.0,
"AddjValue" : 0.0,
"AddjValue2" : 0.0,
"BatteryLevel" : 100,
"CustomImage" : 0,
"Data" : "23.5 C",
"Description" : "",
"Favorite" : 0,
"HardwareID" : 2,
"HardwareName" : "Aeon Labs Z-Stick",
"HardwareType" : "OpenZWave USB",
"HardwareTypeVal" : 21,
"HaveTimeout" : false,
"ID" : "0501",
"LastUpdate" : "2016-08-06 12:44:36",
"Name" : "Kökstemperatur",
"Notifications" : "false",
"PlanID" : "0",
"PlanIDs" : [ 0 ],
"Protected" : false,
"ShowNotifications" : true,
"SignalLevel" : "-",
"SubType" : "LaCrosse TX3",
"Temp" : 23.50,
"Timers" : "false",
"Type" : "Temp",
"TypeImg" : "temperature",
"Unit" : 1,
"Used" : 1,
"XOffset" : "0",
"YOffset" : "0",
"idx" : "3"
}
],
"status" : "OK",
"title" : "Devices"
}

So the current temperature should be around 23.5 and the target 22.

Re: eDomoticz Homebridge-Plugin

Posted: Saturday 06 August 2016 13:07
by Marci
Right. The two are separate devices within Domoticz. Nothing can be done without some butchery. HomeKit expects a single device to present all the info, not to be split across multiple devices.

Re: eDomoticz Homebridge-Plugin

Posted: Saturday 06 August 2016 13:11
by anasazi
Marci wrote:Right. The two are separate devices within Domoticz. Nothing can be done without some butchery. HomeKit expects a single device to present all the info, not to be split across multiple devices.
Do you want me to create an issue over at Github or is this enough information for you?

Re: eDomoticz Homebridge-Plugin

Posted: Saturday 06 August 2016 13:42
by Marci
It's not something I can fix really... until Domoticz handles the thermostat within a single device, the plugin can't. S'just a general incompatibility between Domoticz' way of handling that particular hardware vs the apple-certified way.

I have the same issue with my thermostat, as do most others.

eDomoticz Homebridge-Plugin

Posted: Saturday 06 August 2016 13:45
by Marci
Nb: the thermostat will still work correctly. Changing the setpoint will still work, but any on/off rules based on that setpoint are handled by Domoticz, not HomeKit.

Ie: problem is visual, doesn't affect functionality.

Re: eDomoticz Homebridge-Plugin

Posted: Saturday 06 August 2016 14:37
by anasazi
Ok, now I understand.
Thanks for the explanation :)

Re: eDomoticz Homebridge-Plugin

Posted: Sunday 07 August 2016 12:25
by NewFolk
Marci wrote:That's not the JSON output from Domoticz... that's the Homebridge run-log.

See https://www.domoticz.com/wiki/Domoticz_ ... fic_device

Sorry for my very late response.

It`s JSON from my RGBW Milight bulb.
Spoiler: show

Code: Select all

{
   "ActTime" : 1470565164,
   "ServerTime" : "2016-08-07 13:19:24",
   "Sunrise" : "04:48",
   "Sunset" : "20:22",
   "result" : [
      {
         "AddjMulti" : 1.0,
         "AddjMulti2" : 1.0,
         "AddjValue" : 0.0,
         "AddjValue2" : 0.0,
         "BatteryLevel" : 255,
         "CustomImage" : 0,
         "Data" : "Off",
         "Description" : "",
         "Favorite" : 1,
         "HardwareID" : 5,
         "HardwareName" : "Mi Light",
         "HardwareType" : "Limitless/AppLamp/Mi Light with LAN/WiFi interface",
         "HardwareTypeVal" : 22,
         "HaveDimmer" : true,
         "HaveGroupCmd" : false,
         "HaveTimeout" : false,
         "ID" : "1",
         "Image" : "Light",
         "IsSubDevice" : false,
         "LastUpdate" : "2016-08-07 13:18:16",
         "Level" : 78,
         "LevelInt" : 78,
         "MaxDimLevel" : 100,
         "Name" : "Torchere",
         "Notifications" : "false",
         "PlanID" : "0",
         "PlanIDs" : [ 0 ],
         "Protected" : false,
         "ShowNotifications" : true,
         "SignalLevel" : "-",
         "Status" : "Off",
         "StrParam1" : "",
         "StrParam2" : "",
         "SubType" : "RGBW",
         "SwitchType" : "Dimmer",
         "SwitchTypeVal" : 7,
         "Timers" : "false",
         "Type" : "Lighting Limitless/Applamp",
         "TypeImg" : "dimmer",
         "Unit" : 1,
         "Used" : 1,
         "UsedByCamera" : false,
         "XOffset" : "0",
         "YOffset" : "0",
         "idx" : "116"
      }
   ],
   "status" : "OK",
   "title" : "Devices"
}

UPD: ALL WORKS !

I don`t know why, I just came home after my vacation, update homebridge and edomoticz. re add lamps and now could change colors.

Thank you!

Re: eDomoticz Homebridge-Plugin

Posted: Sunday 07 August 2016 20:14
by simon_rb
This MQTT stuff looks promising. Been looking for a way to speed the whole refresh process up. Hope we can get it to work without too much hog on resources.

This is still a great plugin and one I use pretty much all the time! Thanks again Marci!!


Sent from my iPhone using Tapatalk

Re: eDomoticz Homebridge-Plugin

Posted: Monday 08 August 2016 11:16
by Nautilus
This might be more of a question to Homebridge devs but after updating the plugin yesterday I'm only getting "Sorry, I can't do that." from Siri but e.g. the Eve App is showing devices correctly and also controls them. Any idea what might be causing the issue with Siri? I had not used Siri for a while so I cannot say for sure if the update had anything to do with it :)


=== EDIT ===
Ok, this was "solved" by resetting the homekit configuration. Do you think there would've been some other way which would not have involved loosing the configuration? :D
==========

Re: eDomoticz Homebridge-Plugin

Posted: Monday 08 August 2016 15:24
by TheRamon
Heya,

I have just created a pull request on mqtt-integration.
This is basically the first proof of concept that MQTT integration works. I have messed about with a lot of files, hope you don't mind Marci.
Also split up the platform and accessory since they were in one file.

Basically, this works as follows:
  • Press the switch in domoticz
  • A message gets sent through MQTT
  • MQTT.js picks this up, searches for the right accessory and calls a function on this accessory named handleMQTTMessage.
  • This function is almost the same as getServices. Searches the right service based on swTypeVal, extracts the Characteristic from it, and sends the updated value to Homekit.
  • This might not be perfect, hence my comment in domoticz_accessory.js:759:
// TODO: Build the implementation for dimmers + RGB.
// !! This is where I stopped for now, we'd have to think of a good way to get a sane value from 'nvalue'.
// The getdValue function does this perfectly. The only downside is that it updates the value in domoticz too, resulting in a MQTT loop. (See the comment above silentlyUpdateCharacteristicValue in mqtt.js)


I really don't want to create the setdValue twice, but the way it works now, it also makes a HTTP request to the JSON api. This request sends a MQTT message in it's turn, which is picked up by mqtt.js, leading to an infinite loop.
We might have to fiddle about with a few things to specify if we'd want to update the value in domoticz too. (Send HTTP request)

Any ideas?

- Ramon

Re: eDomoticz Homebridge-Plugin

Posted: Monday 08 August 2016 16:31
by TheRamon
Nautilus wrote:This might be more of a question to Homebridge devs but after updating the plugin yesterday I'm only getting "Sorry, I can't do that." from Siri but e.g. the Eve App is showing devices correctly and also controls them. Any idea what might be causing the issue with Siri? I had not used Siri for a while so I cannot say for sure if the update had anything to do with it :)


=== EDIT ===
Ok, this was "solved" by resetting the homekit configuration. Do you think there would've been some other way which would not have involved loosing the configuration? :D
==========
This is probably because something got messed up along the way.. I don't think there's any way to debug this. Only thing is to remove the "persist" folder and try again.. A pain, I know.