techwitheddie

oldmacdonald

Jul 20th, 2022 (edited)
1,370
2
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.20 KB | None | 2 0
  1. # Home-brew Install
  2. /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  3.  
  4. # Home-brew MQTT Install
  5. brew install mosquitto
  6.  
  7. # Update mosquito.conf
  8. sudo nano /opt/homebrew/etc/mosquitto/mosquitto.conf
  9.  
  10.     #   Add the below
  11.         listener 1883
  12.         allow_anonymous true
  13.  
  14. # Run Service
  15. /opt/homebrew/opt/mosquitto/sbin/mosquitto -c /opt/homebrew/etc/mosquitto/mosquitto.conf
  16.  
  17. # Restart Computer
  18.  
  19. # Check MQTT Connection
  20.  
  21. # Zigbee 2 MQTT Install
  22. # Install Node.Js- https://nodejs.org/en/
  23. # Check Adapter
  24. ls /dev/
  25.  
  26. # Clone Z2M Repository
  27. git clone --depth 1 https://github.com/Koenkk/zigbee2mqtt.git /Applications/zigbee2mqtt
  28.  
  29. # Execute Libraries
  30. cd /Applications/zigbee2mqtt
  31. npm ci
  32.  
  33. # Configuration YAML
  34. frontend:
  35.   # Optional, default 8080 or you can use your own as well.
  36.   port: 8083
  37.   # IP address of the device running Zigbee2MQTT
  38.   host: 192.168.86.189
  39.  
  40. advanced:
  41.   network_key: GENERATE
  42.  
  43. # Execute Zigbee2MQTT service
  44. npm start
  45.  
  46. # Running as a service
  47. cd /Library/LaunchDaemons
  48.  
  49. # Create Application Plist
  50. sudo nano zigbe2mqtt.application.plist
  51.  
  52. # Add the below
  53. <?xml version="1.0" encoding="UTF-8"?>
  54. <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
  55. <plist version="1.0">
  56. <dict>
  57. <key>Label</key>
  58. <string>zigbe2mqtt.application.plist</string>
  59.  
  60. <key>EnvironmentVariables</key>
  61. <dict>
  62.     <key>PATH</key>
  63.     <string><![CDATA[/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin]]></string>
  64. </dict>
  65.  
  66. <key>WorkingDirectory</key>
  67. <string>/Applications/zigbee2mqtt</string>
  68.  
  69. <key>ProgramArguments</key>
  70. <array>
  71. <string>/usr/local/bin/npm</string>
  72. <string>start</string>
  73. </array>
  74.  
  75. <key>RunAtLoad</key>
  76. <true/>
  77.  
  78. <key>KeepAlive</key>
  79. <true/>
  80.  
  81. </dict>
  82. </plist>
  83.  
  84. # Enable & Start Application
  85. sudo launchctl load /Library/LaunchDaemons/zigbe2mqtt.application.plist
  86. sudo launchctl start /Library/LaunchDaemons/zigbe2mqtt.application.plist
  87.  
  88. # Stop the application
  89. sudo launchctl stop /Library/LaunchDaemons/zigbe2mqtt.application.plist
  90.  
  91. # Unload the applicaiton to modify the plist file
  92. sudo launchctl unload /Library/LaunchDaemons/zigbe2mqtt.application.plist
  93.  
Add Comment
Please, Sign In to add comment