snapcraft.yaml 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. name: home-assistant-snap
  2. title: Home assistant
  3. version: '2021.11.0'
  4. icon: snap/gui/home-assistant-snap.svg
  5. summary: Open source home automation that puts local control and privacy first
  6. description: |
  7. Home Assistant is a free and open-source software for home automation that is designed to be the central control system for smart home devices with focus on local control and privacy.
  8. It can be accessed via a web-based user interface, via companion apps for Android and iOS, or using voice commands via a supported virtual assistant like Google Assistant or Amazon Alexa.
  9. Home Assistant integrates with over a thousand different devices and services.
  10. Read more about Home Assistant at
  11. - https://en.wikipedia.org/wiki/Home_Assistant
  12. - https://www.home-assistant.io/
  13. **NOTE!** This is Home Assistant Core (not supervised).
  14. Your new installation will be available through your browser at http://localhost:8123/ (or change localhost to any other IP address where the snap packages is installed). You will get a launcher available in your application menu on desktops.
  15. **Important information about updates**
  16. Since each major versions of Home Assistant might bring breaking changes, you will **only** auto-update for minor releases. Each major release must be upgraded manually, by switching channel.
  17. See available channels in the software center or with
  18. `snap info home-assistant-snap`
  19. Please use the stable versions, e.g `2021.8/stable`.
  20. You can switch channel with:
  21. `
  22. $ snap switch home-assistant-snap --channel=<channel>
  23. `
  24. where `<channel>` could be `2021.8/stable`.
  25. There is a binary sensor `binary_sensor.updater` that will flip to `true` from `false` whenever there are updates available in a newer channel. Use this to show a notification whenever a new major release is available.
  26. **Need help?**
  27. Please use https://www.home-assistant.io/docs/ for documentation and https://community.home-assistant.io for help from the community.
  28. **Necessary plugs**
  29. Can't connect to your USB (e.g Zigbee, Z-wave, removable drive)?
  30. See `snap connections home-assistant-snap` for necessary plugs (such as access to USB, removable media etc) and connect them with
  31. `$ snap connect home-assistant-snap:<plug>`
  32. where `<plug>` can be in example `raw-usb`.
  33. **Required plugs**
  34. - *network:* allows Home Assistant access to the network.
  35. - *network-bind:* allows operating as a network service, to run the Home Assistant server.
  36. - *network-control:* enables the configuration of networking and network namespaces via `ip netns`, providing a wide, privileged access to networking. This is required for the DHCP discovery integration to work which will watch the network for DHCP requests for supported devices and services. To disable this feature you will have to disable the `default_config` from you `configuration.yaml` and disconnect the `network-control` plug with `snap disconnect home-assistant-snap:network-control`.
  37. **NOTE!** Removing the `default_config` will require you to build up a whole new configuration for Home Assistant. More on what is enabled by default at this link: https://www.home-assistant.io/integrations/default_config/
  38. **Optional plugs**
  39. - *raw-usb:* allows access to all connected USB devices via a raw interface.
  40. - *removable-media*: allows read/write access to mounted removable storage in /media, /run/media and /mnt.
  41. - *serial-port*: enables access to a specific serial port. This interface is restricted because it provides privileged access to configure serial port hardware. Might require hot-plug support `snap set system experimental.hotplug=true` followed by `systemctl restart snapd`.
  42. **Available slots**
  43. - *components:* Load custom components to Home Assistant. You will find the Home Assistant Community Store package here: https://snapcraft.io/home-assistant-hacs - Installations on own risk and note that provided integrations are not tested or guaranteed to work.
  44. - *bin:* Missing binaries might be in the Home Assistant Toolbox, such as cURL etc. See https://snapcraft.io/home-assistant-toolbox
  45. - *configurations:* Edit your configuration files with `code-server` (VS Code) or HASS configurator:
  46. - https://snapcraft.io/code-server
  47. - https://snapcraft.io/home-assistant-configurator.
  48. # source-code: "https://github.com/home-assistant-snap/home-assistant-snap"
  49. # website: "https://github.com/home-assistant-snap/home-assistant-snap"
  50. # issues: "https://github.com/home-assistant-snap/home-assistant-snap/issues"
  51. # donation: "https://www.paypal.com/donate/?hosted_button_id=69NA8SXXFBDBN"
  52. license: Apache-2.0
  53. base: core20
  54. grade: stable
  55. confinement: strict
  56. architectures:
  57. - build-on: amd64
  58. - build-on: arm64
  59. - build-on: armhf
  60. - build-on: ppc64el
  61. layout:
  62. /usr/local/lib:
  63. bind: $SNAP/usr/lib/${SNAPCRAFT_ARCH_TRIPLET}
  64. /etc/pip.conf:
  65. bind-file: $SNAP_COMMON/pip.conf
  66. /etc/openzwave:
  67. bind: $SNAP/openzwave
  68. /etc/ethertypes:
  69. bind-file: $SNAP/etc/ethertypes
  70. /etc/protocols:
  71. bind-file: $SNAP/etc/protocols
  72. /etc/services:
  73. bind-file: $SNAP/etc/services
  74. plugs:
  75. bin:
  76. interface: content
  77. content: executables
  78. target: $SNAP/shared-bin
  79. slots:
  80. components:
  81. interface: content
  82. content: components
  83. write:
  84. - $SNAP_DATA/custom_components
  85. configurations:
  86. interface: content
  87. write:
  88. - $SNAP_DATA
  89. vscs-content:
  90. interface: content
  91. write:
  92. - $SNAP_DATA
  93. apps:
  94. home-assistant-snap:
  95. command: bin/hass --config $SNAP_DATA
  96. command-chain:
  97. - bin/plug-bin
  98. daemon: simple
  99. environment:
  100. PIP_USER: 1
  101. #PYTHONPATH: "$PYTHONPATH:$SNAP/lib/python3.9/site-packages"
  102. restart-condition: always
  103. plugs:
  104. - bluez
  105. - network
  106. - network-bind
  107. - network-control
  108. - raw-usb
  109. - serial-port
  110. - physical-memory-control
  111. - removable-media
  112. slots:
  113. - components
  114. open-localhost:
  115. command: bin/open-localhost
  116. plugs:
  117. - desktop
  118. check-config:
  119. plugs:
  120. - network
  121. environment:
  122. PIP_USER: 1
  123. command: bin/hass --script check_config --config $SNAP_DATA -i
  124. package-repositories:
  125. - type: apt
  126. ppa: deadsnakes/ppa
  127. parts:
  128. # python:
  129. # plugin: dump
  130. # source: ./src/nil
  131. # build-packages:
  132. # - python3.9-dev
  133. # stage-packages:
  134. # - python3.9-venv
  135. # - python3.9-distutils
  136. # override-build: |
  137. # snapcraftctl build
  138. # cp -rf $(find /snap -path *python3.9/distutils -print0 -quit) ${SNAPCRAFT_PART_INSTALL}/usr/lib/python3.9
  139. homeassistant:
  140. # after: [python]
  141. plugin: python #-wot-plugin
  142. source: https://github.com/home-assistant/core.git
  143. source-tag: ${SNAPCRAFT_PROJECT_VERSION}
  144. # build-environment:
  145. # - SNAPCRAFT_PYTHON_INTERPRETER: python3.9
  146. # - SNAPCRAFT_PYTHON_VENV_ARGS: --system-site-packages
  147. python-packages:
  148. - setuptools<58
  149. - wheel
  150. - Cython
  151. build-packages:
  152. - autoconf
  153. - build-essential
  154. - cmake
  155. - cython3
  156. - ffmpeg
  157. - libavcodec-dev
  158. - libavdevice-dev
  159. - libavfilter-dev
  160. - libavformat-dev
  161. - libavresample-dev
  162. - libavutil-dev
  163. - libcrypt-dev
  164. - libffi-dev
  165. - libglib2.0-dev
  166. - libglu1-mesa-dev
  167. - libgpiod-dev
  168. - libjpeg-dev
  169. - libopenzwave1.5-dev
  170. - libpcap0.8-dev
  171. - libswresample-dev
  172. - libssl-dev
  173. - libswscale-dev
  174. - libudev-dev
  175. - libxml2-dev
  176. - libxslt1-dev
  177. - pkg-config
  178. - python3-dev
  179. - zlib1g-dev
  180. - on armhf:
  181. - rustc
  182. - cargo
  183. - make
  184. - gcc
  185. - dpkg-dev
  186. - on ppc64el:
  187. - rustc
  188. - cargo
  189. stage-packages:
  190. - freeglut3
  191. - ffmpeg
  192. - libglu1-mesa
  193. - libpcap0.8
  194. - libpcap0.8-dev
  195. - libpulse0
  196. - libturbojpeg
  197. - netbase
  198. - tcpdump
  199. - zlib1g
  200. stage:
  201. - -lib/python3.8/site-packages/homeassistant/components/updater
  202. - -lib/python3.8/site-packages/aiogithubapi*
  203. requirements:
  204. - requirements_all.txt
  205. constraints:
  206. - homeassistant/package_constraints.txt
  207. override-build: |
  208. # export PYTHONPATH="/root/parts/python/install/usr/lib/python3.9"
  209. # python3.9 -c 'help("modules")'
  210. # /root/parts/python/install/usr/bin/python3.9 -c 'help("modules")'
  211. # mkdir -p "${SNAPCRAFT_PART_INSTALL}/bin"
  212. # ln -sf /root/parts/python/install/usr/bin/python3.9 /root/parts/homeassistant/install/bin/python3.9
  213. # /root/parts/homeassistant/install/bin/python3.9 -c 'help("modules")'
  214. # rm -rf /var/tmp/*
  215. # /root/parts/homeassistant/install/bin/python3.9 -Im ensurepip
  216. # IDISTUTILS="$(find ${SNAPCRAFT_PART_INSTALL} -path *python3.9/distutils -print0 -quit)"
  217. # UDISTUTILS="$(find /usr -path *python3.9/distutils -print0 -quit)"
  218. # rm -rf "${IDISTUTILS}"
  219. # cp -r "${UDISTUTILS}" "${IDISTUTILS}"
  220. # mkdir -p "${SNAPCRAFT_PART_INSTALL}/usr/include"
  221. # cp -r "$(find /usr -path *include/python3.9 -print0 -quit)" "${SNAPCRAFT_PART_INSTALL}/usr/include"
  222. snapcraftctl build
  223. sed -i 's/include-system-site-packages = false/include-system-site-packages = true/g' $SNAPCRAFT_PART_INSTALL/pyvenv.cfg
  224. updater:
  225. after: [homeassistant]
  226. plugin: dump
  227. source: ./src/components
  228. source-type: local
  229. organize:
  230. '*': lib/python3.9/site-packages/homeassistant/components/
  231. bins:
  232. plugin: dump
  233. source: ./src/bin
  234. source-type: local
  235. organize:
  236. open-localhost: bin/open-localhost
  237. hooks:
  238. plugin: dump
  239. source: ./src/hooks
  240. source-type: local
  241. stage-packages:
  242. - uuid
  243. organize:
  244. install: snap/hooks/install
  245. configure: snap/hooks/configure
  246. post-refresh: snap/hooks/post-refresh
  247. connect-plug-bin: snap/hooks/connect-plug-bin
  248. config:
  249. plugin: dump
  250. source: ./src/config
  251. source-type: local
  252. organize:
  253. plug-bin: bin/plug-bin