Changes

OpenHAB2

4,698 bytes added, 00:33, 23 April 2019
/* Cameras */
* Things, Items etc .. http://docs.openhab.org/configuration/things.html* Basics for file locations: [https://docs.openhab.org/installation/linux.html#file-locations at this link][[Image:Filelocations.png|thumb|800px|left]]<br clear=both>* Good overview of the OpenHAB binding architecture: http://kacangbawang.com/openhab2-binding-architecture/* [http://www.cd-jackson.com/index.php/openhab/5-zwave-debugging-openhab this site] has info on debug settings etc.* Set debug in OHAB console: <pre>log:set debug org.openhab.binding.isy</pre>* WS client for ISY on raspi01: http://192.168.1.27/ws.html* WS client for OHAB: http://ohab:8080/static/ws.html** this needs "org.eclipse.smarthome.cors:enable=true" in ''/usr/share/openhab2/runtime/services.cfg'' (see https://community.openhab.org/t/sse-over-rest-api/19220/7) 
==Openhab hacks ==
* log files are at ohab: [http://ohab:9001/ log files]
** change log settings in '''org.ops4j.pax.logging.cfg''' in the ''userdata/etc''' directory. The location depend on install, normally in '''/var/log/openhab2/etc'''.
* karaf console login: By default disabled from anywhere but localhost. Thus ssh into ohab, then ssh from there to <pre>ssh -p 8101 openhab@localhost</pre> default pwd is habopen.
* timeout exception prevents any further updates. This is evidently a eclipse smarthome framework bug<pre>2017-11-21 16:59:30.517 [WARN ] [org.apache.karaf.services.eventadmin] - EventAdmin: Blacklisting ServiceReference [{org.osgi.service.event.EventHandler, org.eclipse.smarthome.core.events.EventPublisher}={event.topics=smarthome, component.name=org.eclipse.smarthome.core.internal.events.OSGiEventManager, component.id=38, service.id=139, service.bundleid=109, service.scope=bundle} | Bundle(org.eclipse.smarthome.core_0.9.0.201711202142 [109])] due to timeout!</pre>
** to fix, add <pre>-XstartOnFirstThread -Djava.awt.headless=true</pre> to the VM arguments of the launch
* to show "configuration->items" in PaperUI, you need to switch from "simple" to "advanced" mode. Go to Configuration->System->Item Linking and deactivate the "Simple Mode". You will then have a new entry Configuration->Items which will show you all your items (also the ones from the files, but note that these are read-only).
* if '''the mqtt broker binding doesn't start''', and the log shows two entries for mqtt brokers, check ''/var/lib/openhab2/config/org/openhab/mqtt.config'' for double entries (or other files that configure another broker in that directory), and remove those files* if '''there are no channels created for a binding''', then make sure the binding didn't fail with an earlier instance which is still present in the system. Delete the bindings "Thing" and re-add, thi should make things work. === OpenHAB 2.3-- ===* the isy binding now wants the following before it can start (in the OH console "ssh -p 8101 openhab@localhost" ) feature:install openhab-httpclient feature:install esh-io-transport-upnp  * for z-wave, before adding the jar to addon/, add feature:install openhab-transport-serial
== 5 inch touch screen ==
** make sure Node version already installed is > 8.0 (update to TLS version)
** upgrade before installing the ''homebridge-openhab2'' node contribution and the stuff required for homebridge
* '''Important:''' When the OpenHAB server is rebooted - or the OpenHAB server is restarted, the HomeBridge server doesn't reconnect (timing problem). Need to restart HomeBridge too <-- fix me
* '''Important:''' After initial start of OHAB, wait until that's settled, then start HomeBridge. It seems that Homebridge/Homekit needs some time to settle for updates from devices to work. Also, always restart the Home.app's on the iOS devices.
* fix reboot problems via https://gist.github.com/johannrichard/0ad0de1feb6adb9eb61a/
** '''/etc/default/homebridge'''
<pre>
# Defaults / Configuration options for homebridge
# The following settings tells homebridge where to find the config.json file and where to persist the data (i.e. pairing and others)
# HOMEBRIDGE_OPTS=-U /var/lib/homebridge
HOMEBRIDGE_OPTS=-U /opt/homebridge
 
# If you uncomment the following line, homebridge will log more
# You can display this via systemd's journalctl: journalctl -f -u homebridge
DEBUG=*
</pre>
:* '''/etc/systemd/system/homebridge.service'''
<pre>
[Unit]
Description=Node.js HomeKit Server
After=syslog.target network-online.target
 
[Service]
Type=simple
User=homebridge
EnvironmentFile=/etc/default/homebridge
# Adapt this to your specific setup (could be /usr/bin/homebridge)
# See comments below for more information
ExecStart=/usr/bin/homebridge $HOMEBRIDGE_OPTS
Restart=on-failure
RestartSec=10
KillMode=process
 
[Install]
WantedBy=multi-user.target
</pre>
 
:* then install:
<pre>
sudo systemctl daemon-reload
sudo systemctl enable homebridge
sudo systemctl start homebridge
</pre>
 
:* check log file via
journalctl -f -u homebridge
 
:* to pipe ''journalctl'' logs into ''frontail'', use
journalctl -u homebridge | frontail -p 9002 -
 
:: or a bit more elaborate:
/bin/journalctl -u homebridge | /usr/bin/frontail --ui-highlight --ui-highlight-preset /usr/lib/node_modules/frontail/preset/openhab.json -t openhab -l 2000 -n 200 -p 9002 -
== Alexa setup ==
# Amazon Echo voice control
Essential mapping between Apple HomeKIt and OpenHAB2 is done via the Node-RED .js homebridge-openhab2 plugin (https://www.npmjs.com/package/homebridge-openhab2). This will map any OpenHAB2 ''Items'' decorated in the .items files into the HomeKIT space. The HomeBridge setup is essential since HomeKit can only deal with 99 accessories. Since HomeBridge is a bridge, it only counts as one. '''Important:''' The items defined in the items file also need to be in the sitemap file for updates to work. Otherwise, the items will update on restart of Home app, or when operated thru the Home app, but not when the update happens from another client (incl. HW switches)
Additional mappings of devices that have troubles with OpenHAB + HomeKit bridge can be added as separate HomeKit devices in Node-RED and hitched up to OpenHAB via the OpenHAB2 ''node-red-contrib-homekit'' plugin. To install, first look here: https://www.npmjs.com/package/node-red-contrib-homekit . However, the install needs a small modification, basically run:
<pre>
> sudo apt-get install libavahi-compat-libdnssd-dev
> sudo npm install -g node-red-contrib-homekit --unsafe-perm=true
</pre>
 
For some reason, this builds the new library in "/usr/local/lib", but the current running instance looks in "/usr/lib". Something isn't right. A hack to get around was to create a symlink to the new build module, after that, the new nodes finally showed up.
 
The '''Node RED service''' is installed as '''nodered''' (not ''node-red''). Stop and start via:
<pre>
> sudo systemctl stop nodered
> sudo systemctl start nodered
</pre>
Cameras are mapped via the ZM node server, separate from the ''ohab'' server
=== Cameras ===
* cameras will be tied to openhab2 via the zoneminder binding, which will get them onto BasicUI
* use the zm server to install Node.js + the homebridge camera node server, which gets them onto Apple HomeKit. Link to plugin is [https://www.npmjs.com/package/homebridge-camera-ffmpeg here]
* the node/homebridge/camera server evidently cannot add a camera to an already existing HomeKit key mapping. The camera def's need to be present when the bridge is paired with iOS. However, it is possible to change the cam url in the homebridge config.json.
* create a systemd service for homebridge as per the instructions here: https://gist.github.com/johannrichard/0ad0de1feb6adb9eb61a/ . If the homebridge setup was started and paired by starting manually before, copy the entire ~/.homebridge folder to /var/lib (not just the config.json), otherwise the already existing pairing info is missing. Don't forget to set correct perms/user/group on copied files. Also, make this service depend on "zoneminder.service" as explained here: https://stackoverflow.com/questions/21830670/systemd-start-service-after-specific-service
* the resulting script is saved as ''homebridge.service''. Commands are
** sudo '''systemctl <command> homebridge''' on ''zm''
=== ISY binding ===
Note: see [[OpenHAB ISY Binding rework]] before proceeding
 
* install ISY binding
* establish items in .items files, decorate for HomeKit/Alexa
It's probably best to have the Thermostat control mapped as a OpenHAB node in Node-RED as a separate HomeKit device, since the OpenHAB2 mappings for thermostats don't appear to work correctly. Also, the same is true for other "Thermostat" like devices (hottub, fireplace) - just keep Thermostats separate for now (with their own HomeKit ID). This also requires a separate Node-RED map into Alexa.
 
* link to [http://isy.home.hentschel.net/USER/WEB/ws.htm WS logger]
=== Zoneminder ===
* create items
* create in sitemap
 
=== Weather station ===
* AmbientWeather1400IP binding
* SolarRadiation ~ 30 when Solar panels come on/start producing
* Solar Radiation max ~ 750
 
== Influx / Grafana ==
=== Influx ===
* username openhab
* database openhab_db
Bureaucrat, administrator
963
edits