name: ozwdaemon base: core20 adopt-info: set-version summary: "QT Wrapper for OpenZWave. Remotely manage a Z-Wave Network." description: | A dedicated snap package that contains only the ozwdaemon service. This snap contains only the ozwdaemon application and none of the management tools. Use Home Assistant or OZW Admin to connect to it. NOTE! To add secure devices through Home Assistant, you have to make service calls, with the payload: ``` { "secure": true, "instance_id": } ``` This is an issue with the OpenZWave integration of Home Assistant and will hopefully be fixed in the future. See `snap get ozwdaemon -d` for configuration options. grade: stable confinement: strict apps: ozwdaemon: daemon: simple restart-condition: on-failure command: usr/local/bin/ozwdaemon command-chain: - bin/env-wrapper plugs: - network - network-bind - raw-usb enable: command: bin/daemonize disable: command: bin/de-daemonize restart: command: bin/restart exec: command: usr/local/bin/ozwdaemon --exec command-chain: - bin/env-wrapper plugs: - network - network-bind - raw-usb layout: /usr/local/share/OpenZWave/qt-openzwavedatabase.rcc: bind-file: $SNAP/usr/share/qt5/qt-openzwavedatabase.rcc slots: qt-ozw-lib: interface: content content: qt-ozw-lib read: - $SNAP/usr/lib - $SNAP/usr/local parts: open-zwave: plugin: make source: https://github.com/OpenZWave/open-zwave.git qtmqtt: after: [open-zwave] plugin: make # aka qmake source: https://github.com/qt/qtmqtt.git source-tag: 5.12.8 build-packages: - build-essential - qt5-default - qtbase5-private-dev override-build: | if [ -f "Makefile" ]; then echo "Clean $SNAPCRAFT_PART_BUILD" qmake -r make distclean fi qmake make -j$(nproc) make -j$(nproc) install make -j$(nproc) install INSTALL_ROOT="${SNAPCRAFT_PART_INSTALL}" override-prime: | snapcraftctl prime stage-packages: - libdouble-conversion3 - libfreetype6 - libgl1 - libglvnd0 - libglx0 - libgraphite2-3 - libharfbuzz0b - libicu66 - libpcre2-16-0 - libpng16-16 - libqt5core5a - libqt5gui5 - libqt5network5 - libqt5websockets5 - libqt5widgets5 - libx11-6 - libxau6 - libxcb1 - libxdmcp6 qt-openzwave: after: [open-zwave, qtmqtt] plugin: make # aka qmake? source: https://github.com/OpenZWave/qt-openzwave.git build-packages: - build-essential - qt5-default - libqt5websockets5-dev - libqt5remoteobjects5-dev - libqt5remoteobjects5-bin - gcc-8-base - libgcc-8-dev - cmake - pkgconf - libunwind-dev - libcurl4-openssl-dev - rapidjson-dev stage-packages: - libdouble-conversion3 - libicu66 - libpcre2-16-0 - libqt5core5a - libqt5network5 - libqt5remoteobjects5 - libqt5websockets5 - libunwind8 override-build: | if [ -f "Makefile" ]; then echo "Clean $SNAPCRAFT_PART_BUILD" qmake -r make distclean fi INSTALL_PATH="${HOME}" if [ ! -z ${container+x} ]; then INSTALL_PATH="/build/${SNAPCRAFT_PROJECT_NAME}" fi OZW_INSTALL_PATH="${INSTALL_PATH}/parts/open-zwave/install" OZW_LIB_PATH="$(dirname $(find ${OZW_INSTALL_PATH} -name libopenzwave.so -print0 -quit))" OZW_INCLUDE_PATH="$(dirname $(find ${OZW_INSTALL_PATH} -name Manager.h -print0 -quit))" OZW_DATABASE_PATH="$(dirname $(find ${OZW_INSTALL_PATH} -name manufacturer_specific.xml))" qmake -r "CONFIG+=release" \ OZW_LIB_PATH="${OZW_LIB_PATH}" \ OZW_INCLUDE_PATH="${OZW_INCLUDE_PATH}" \ OZW_DATABASE_PATH="${OZW_DATABASE_PATH}" make -j$(nproc) make -j$(nproc) install INSTALL_ROOT="${SNAPCRAFT_PART_INSTALL}" local-src: after: [qt-openzwave] plugin: dump source: ./src source-type: local stage-packages: - coreutils - netcat-openbsd organize: hooks: snap/hooks set-version: after: [qt-openzwave] plugin: nil override-build: | set -ex INSTALL_PATH="${HOME}" if [ ! -z ${container+x} ]; then INSTALL_PATH="/build/${SNAPCRAFT_PROJECT_NAME}" fi LIBQT_OZW=$(dirname "$(find ${INSTALL_PATH} -name libqt-openzwave.so.1 -print -quit)") LIB_OZW=$(dirname "$(find ${INSTALL_PATH} -name libopenzwave.so* -print -quit)") LIB_OZWDB=$(dirname "$(find ${INSTALL_PATH} -name libqt-openzwavedatabase.so.1 -print -quit)") export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$LIBQT_OZW:$LIB_OZW:$LIB_OZWDB OZWD=$(find ${INSTALL_PATH} -type f -name ozwdaemon -print -quit) snapcraftctl set-version "$($OZWD --version | cut -f2 -d ' ')"