Page 27 of 86

eDomoticz Homebridge-Plugin

Posted: Thursday 11 August 2016 21:46
by Marci
RduPre wrote:Hi Guys,

Sorry to jump in here.

I'm a Homeseer user and using the Homebridge shim for Homeseer based on the same architecture.

I read that you also implemented Custom HomeKit Types, like:
General kWh power meters - Types: General, Current, Usage; SubType: kWh, Electric (inc CurrentCost USB)
YouLess Meter (Current, Total and Today Total Consumption) - Type: YouLess Meter; SubType: YouLess counter
EvoHome / OpenTherm Thermostat support - Types: Heating, Thermostat; SubTypes: Zone, SetPoint
General Usage % meters (eg: Motherboard Sensors Hardware Device - CPU %, Mem %, HDD % etc) - Type: General; SubType: Percentage
Temperature, Temp + Humidity, Temp + Humidity + Baro (Current Temperature, Current Humidity, Current Pressure in hPA) - Type: Temp, Temp + Humidty, Temp + Humidity + Baro
DarkSkies Virtual Weather Station Sensors (Wind, Solar Radiation, Rainfall, Visibility, Barometer)
Location Sensor - any Domoticz text sensor with "Location" in it's title, for use with custom GeoFence / Bluetooth scripts.

Because the types not supported by HomeKit itself, I was wondering how you did this?

Many thanks in advance,

Rien
By defining the custom service and character definitions... have a look at the source on GitHub - in lib/services.js for the MQTT branch, or in index.js in the master branch.

Re: eDomoticz Homebridge-Plugin

Posted: Thursday 11 August 2016 22:07
by deejc
Marci wrote:Can do, aye...
forever seems to create randomly named logs, is there a way to get it to write home bridge.log in ~/.forever ? so i can then add it to log rotate ?

i tried

Code: Select all

forever -l ~/.forever/homebridge.log restart /usr/local/lib/node_modules/homebridge/bin/homebridge
but it didn't work

eDomoticz Homebridge-Plugin

Posted: Thursday 11 August 2016 22:11
by Marci
See https://github.com/foreverjs/forever but you'll probably need to stop it and start it rather than restart it.

Might have to use -o instead of -l and at a guess the file will need to exist.

eDomoticz Homebridge-Plugin

Posted: Thursday 11 August 2016 22:28
by Marci
Dammit - have created a problem somewhere... lasts an hour then a whole pile of sensors and switches vanish... From 65 down to 11.

MQTT branch currently broken - sorry folks!

They return after a homebridge restart, but end up vanishing again...

Re: eDomoticz Homebridge-Plugin

Posted: Thursday 11 August 2016 22:37
by deejc
seems it's

Code: Select all

forever -a -l homebridge.log start /usr/local/lib/node_modules/homebridge/bin/homebridge
seems to work now, got log rotate setup for it.

i have some devices not showing properly in Home app, will go through and get the json out put but one if the you less meter not showing me anything in home app, just shows "on" and the others are netatmo air quality sensors, also just how "On"

Re: eDomoticz Homebridge-Plugin

Posted: Thursday 11 August 2016 22:39
by Marci
Yup - fire over json & I'll take a look over next few days.

Re: eDomoticz Homebridge-Plugin

Posted: Thursday 11 August 2016 22:43
by deejc
i thought you added youless as 1 of the first items when you first started this plugin, but this is the output for it anyway

Code: Select all

{
   "ActTime" : 1470948170,
   "ServerTime" : "2016-08-11 21:42:50",
   "Sunrise" : "05:42",
   "Sunset" : "20:29",
   "result" : [
      {
         "AddjMulti" : 1.0,
         "AddjMulti2" : 1.0,
         "AddjValue" : 0.0,
         "AddjValue2" : 0.0,
         "BatteryLevel" : 255,
         "Counter" : "19311.648",
         "CounterToday" : "10.000 kWh",
         "CustomImage" : 0,
         "Data" : "19311.648 kWh 338 Watt",
         "Description" : "",
         "Favorite" : 1,
         "HardwareID" : 4,
         "HardwareName" : "youless",
         "HardwareType" : "YouLess Meter with LAN interface",
         "HardwareTypeVal" : 6,
         "HaveTimeout" : false,
         "ID" : "80",
         "LastUpdate" : "2016-08-11 21:42:43",
         "Name" : "YouLess",
         "Notifications" : "false",
         "PlanID" : "2",
         "PlanIDs" : [ 2 ],
         "Protected" : false,
         "ShowNotifications" : true,
         "SignalLevel" : "-",
         "SubType" : "YouLess counter",
         "SwitchTypeVal" : 0,
         "Timers" : "false",
         "Type" : "YouLess Meter",
         "TypeImg" : "counter",
         "Unit" : 1,
         "Usage" : "338 Watt",
         "Used" : 1,
         "ValueQuantity" : "",
         "ValueUnits" : "",
         "XOffset" : "0",
         "YOffset" : "0",
         "idx" : "2"
      }
   ],
   "status" : "OK",
   "title" : "Devices"
}

Code: Select all

[8/11/2016, 9:50:55 PM] [eDomoticz] { Battery: 255,
  RSSI: 12,
  dtype: 'YouLess Meter',
  id: '80',
  idx: 2,
  name: 'YouLess',
  nvalue: 0,
  stype: 'YouLess counter',
  svalue1: '19311697',
  svalue2: '436',
  unit: 1 }
and here is one of the air quality

Code: Select all

{
   "ActTime" : 1470948301,
   "ServerTime" : "2016-08-11 21:45:01",
   "Sunrise" : "05:42",
   "Sunset" : "20:29",
   "result" : [
      {
         "AddjMulti" : 1.0,
         "AddjMulti2" : 1.0,
         "AddjValue" : 0.0,
         "AddjValue2" : 0.0,
         "BatteryLevel" : 255,
         "CustomImage" : 0,
         "Data" : "614 ppm",
         "Description" : "",
         "Favorite" : 1,
         "HardwareID" : 3,
         "HardwareName" : "netatmo",
         "HardwareType" : "Netatmo",
         "HardwareTypeVal" : 54,
         "HaveTimeout" : false,
         "ID" : "00BD",
         "LastUpdate" : "2016-08-11 21:35:11",
         "Name" : "Lounge Air Quality",
         "Notifications" : "false",
         "PlanID" : "2",
         "PlanIDs" : [ 2 ],
         "Protected" : false,
         "Quality" : "Excellent",
         "ShowNotifications" : true,
         "SignalLevel" : "-",
         "SubType" : "Voltcraft CO-20",
         "Timers" : "false",
         "Type" : "Air Quality",
         "TypeImg" : "air",
         "Unit" : 102,
         "Used" : 1,
         "XOffset" : "0",
         "YOffset" : "0",
         "idx" : "7"
      }
   ],
   "status" : "OK",
   "title" : "Devices"
}

Code: Select all

[8/11/2016, 9:15:09 PM] [eDomoticz] { Battery: 255,
  RSSI: 12,
  dtype: 'Air Quality',
  id: '189',
  idx: 7,
  name: 'Lounge Air Quality',
  nvalue: 540,
  stype: 'Voltcraft CO-20',
  unit: 102 }

Re: eDomoticz Homebridge-Plugin

Posted: Thursday 11 August 2016 22:46
by Marci
I did, but the MQTT handler is still experimental...

I also need an MQTT message sample for each device too please!

Re: eDomoticz Homebridge-Plugin

Posted: Thursday 11 August 2016 22:47
by deejc
fair enough :D
and i do appreciate all your work, it works more or less out of the box and i know there is so much going on under the hood!!

btw, the mqtt messages are so quick the iOS home app updates before the actual light turns off in my living room :geek:

Re: eDomoticz Homebridge-Plugin

Posted: Thursday 11 August 2016 22:55
by deejc
Marci wrote:I also need an MQTT message sample for each device too please!
i think i got it in the post above, thats whats in the log

Re: eDomoticz Homebridge-Plugin

Posted: Thursday 11 August 2016 23:02
by Marci
So you did... Soz!

Re: eDomoticz Homebridge-Plugin

Posted: Friday 12 August 2016 12:53
by max_g
this is very interesting, Marci your work is much appreciated.

when open technology starts utilising the innovation that smart software developers bring, the combination becomes incredible powerfull

Re: eDomoticz Homebridge-Plugin

Posted: Friday 12 August 2016 17:56
by Marci
deejc wrote: i think i got it in the post above, thats whats in the log
Head to your homebridge-edomoticz folder, run...

Code: Select all

cd lib/
sudo rm domoticz_accessory.js
sudo wget https://raw.githubusercontent.com/PatchworkBoy/homebridge-eDomoticz/mqtt-integration/lib/domoticz_accessory.js
...then restart Homebridge. Air Quality should now be supported and YouLess fixed.

Point to note: MQTT can only update air particulate density as that’s all it sends in the MQTT message. Overall Air Quality (Excellent / Fair / Poor etc) can only be retrieved via a pull-to-refresh / old-style http request.

Re: eDomoticz Homebridge-Plugin

Posted: Friday 12 August 2016 18:53
by simon_rb
Are we close to a general release this weekend Marci?

Re: eDomoticz Homebridge-Plugin

Posted: Friday 12 August 2016 18:55
by Marci
Not sure yet - there’s still something which occurs that causes me to randomly lose 54 devices in one hit, until homebridge is restarted. Don’t want to let it properly loose til I’ve established the cause... as once it loses them, you have lost all room assignments / scene assignments etc for those devices.

Re: eDomoticz Homebridge-Plugin

Posted: Friday 12 August 2016 18:59
by simon_rb
Marci wrote:Not sure yet - there’s still something which occurs that causes me to randomly lose 54 devices in one hit, until homebridge is restarted. Don’t want to let it properly loose til I’ve established the cause... as once it loses them, you have lost all room assignments / scene assignments etc for those devices.
Ok mate, good luck! Lol

Re: eDomoticz Homebridge-Plugin

Posted: Friday 12 August 2016 19:11
by Marci
@TheRamon - here’s something genius I’ve noticed...

Get it all up and running, and run homebridge in debug mode ala:

Code: Select all

DEBUG=* /usr/local/bin/homebridge -D >> /var/log/homebridge.log
Then open a new terminal window in which to tail -f /var/log/homebridge.log

Now, open Eve, and you can see all the characteristics register for events for your devices IP Address. Close Eve, and all the characteristics unregister for events for your devices IP Address... UNLESS those characteristics are associated with a rule or trigger that requires that characteristic to remain registered. Either way, every now and again a keepalive is sent to all clients it’s aware of.

When next that device reregisters for events (ie: Eve is foregrounded again), it fires off a mass queue of things it’s missed to bring the client up to date.

So, that’s how battery life and bandwidth hit on the device is minimised.

Re: eDomoticz Homebridge-Plugin

Posted: Friday 12 August 2016 19:33
by deejc
Marci wrote: Head to your homebridge-edomoticz folder, run...
<Snip>
Overall Air Quality (Excellent / Fair / Poor etc) can only be retrieved via a pull-to-refresh / old-style http request.
The air quality is actually the part that works :D
youless is still showing "off"
IMG_6835.jpg
IMG_6835.jpg (102.03 KiB) Viewed 1999 times

Re: eDomoticz Homebridge-Plugin

Posted: Friday 12 August 2016 19:52
by Marci
Repeat...

Head to your homebridge-edomoticz folder, run...

Code: Select all

cd lib/
sudo rm domoticz_accessory.js
sudo wget https://raw.githubusercontent.com/PatchworkBoy/homebridge-eDomoticz/mqtt-integration/lib/domoticz_accessory.js
...then restart Homebridge. Let me know!

Re: eDomoticz Homebridge-Plugin

Posted: Friday 12 August 2016 19:59
by deejc
Marci wrote:Repeat..

...then restart Homebridge. Let me know!
nah, still the same except now it says it "on" :!: