diff --git a/profiles/ini.env b/profiles/ini.env index 9605e04..0ab0fdf 100644 --- a/profiles/ini.env +++ b/profiles/ini.env @@ -4,6 +4,9 @@ node = 12.22.12 [zigbee2mqtt] nodeenv = 16.15.0 +[mosquitto] +homeassistant_user = homeassistant + [postgresql] homeassistant_database = homeassistant homeassistant_user = homeassistant diff --git a/profiles/templates/homeassistant/check-crashed/conf.check-crashed b/profiles/templates/homeassistant/check-crashed/conf.check-crashed index f069d78..53ce28b 100644 --- a/profiles/templates/homeassistant/check-crashed/conf.check-crashed +++ b/profiles/templates/homeassistant/check-crashed/conf.check-crashed @@ -1,2 +1,2 @@ # Calculate format=openrc path=/etc/conf.d name=#-cut(1,.)-# -RC_MONITOR_RESTART="zigbee2mqtt homeassistant" +RC_MONITOR_RESTART="zigbee2mqtt homeassistant mosquitto" diff --git a/profiles/templates/homeassistant/mosquitto/.calculate_directory b/profiles/templates/homeassistant/mosquitto/.calculate_directory new file mode 100644 index 0000000..6eca94f --- /dev/null +++ b/profiles/templates/homeassistant/mosquitto/.calculate_directory @@ -0,0 +1 @@ +# Calculate env=install ac_install_merge==on mergepkg(app-misc/mosquitto)!= append=skip diff --git a/profiles/templates/homeassistant/mosquitto/0-ini.env b/profiles/templates/homeassistant/mosquitto/0-ini.env new file mode 100644 index 0000000..34a814f --- /dev/null +++ b/profiles/templates/homeassistant/mosquitto/0-ini.env @@ -0,0 +1,3 @@ +# Calculate format=samba path=/var/calculate name=#-cut(1)-# grep(/var/calculate/ini.env,\[mosquitto\])== protected +[mosquitto] +homeassistant_password = #-rnd(pas,16)-# diff --git a/profiles/templates/homeassistant/mosquitto/mosquitto.conf b/profiles/templates/homeassistant/mosquitto/mosquitto.conf new file mode 100644 index 0000000..3b2d028 --- /dev/null +++ b/profiles/templates/homeassistant/mosquitto/mosquitto.conf @@ -0,0 +1,10 @@ +# Calculate path=/etc/mosquitto format=squid + +listener 1883 +password_file /etc/mosquitto/passwd +allow_anonymous false + +log_dest file /var/log/mosquitto.log +log_type error +log_type warning +connection_messages true diff --git a/profiles/templates/homeassistant/mosquitto/passwd b/profiles/templates/homeassistant/mosquitto/passwd new file mode 100644 index 0000000..1b6686c --- /dev/null +++ b/profiles/templates/homeassistant/mosquitto/passwd @@ -0,0 +1,4 @@ +# Calculate run=/bin/bash exists(/etc/mosquitto/passwd)== + +touch /etc/mosquitto/passwd +mosquitto_passwd -b /etc/mosquitto/passwd #-ini(mosquitto.homeassistant_user)-# #-ini(mosquitto.homeassistant_password)-# diff --git a/profiles/templates/homeassistant/postgresql/ini.env b/profiles/templates/homeassistant/postgresql/ini.env index 417419a..f966732 100644 --- a/profiles/templates/homeassistant/postgresql/ini.env +++ b/profiles/templates/homeassistant/postgresql/ini.env @@ -1,4 +1,4 @@ # Calculate format=samba path=/var/calculate grep(/var/calculate/ini.env,\[postgresql\])== protected [postgresql] -postgres_password = #-rnd(pas,12)-# -homeassistant_password = #-rnd(pas,12)-# +postgres_password = #-rnd(pas,16)-# +homeassistant_password = #-rnd(pas,16)-# diff --git a/profiles/templates/homeassistant/zigbee2mqtt/.ini.env.swp b/profiles/templates/homeassistant/zigbee2mqtt/.ini.env.swp new file mode 100644 index 0000000..cff8c16 Binary files /dev/null and b/profiles/templates/homeassistant/zigbee2mqtt/.ini.env.swp differ diff --git a/profiles/templates/mastodon/postgresql/ini.env b/profiles/templates/mastodon/postgresql/ini.env index 640c544..04b5edd 100644 --- a/profiles/templates/mastodon/postgresql/ini.env +++ b/profiles/templates/mastodon/postgresql/ini.env @@ -1,6 +1,6 @@ # Calculate format=samba chown=mastodon:mastodon path=/var/calculate grep(/var/calculate/ini.env,\[postgresql\])== comment=# protected [postgresql] -postgres_password = #-rnd(pas,12)-# +postgres_password = #-rnd(pas,16)-# mastodon_user = mastodon -mastodon_password = #-rnd(pas,12)-# +mastodon_password = #-rnd(pas,16)-# mastodon_database = mastodon_production diff --git a/profiles/templates/taiga/postgresql/ini.env b/profiles/templates/taiga/postgresql/ini.env index 1a60a40..5b52d4e 100644 --- a/profiles/templates/taiga/postgresql/ini.env +++ b/profiles/templates/taiga/postgresql/ini.env @@ -1,4 +1,4 @@ # Calculate format=samba path=/var/calculate grep(/var/calculate/ini.env,\[postgresql\])== protected [postgresql] -postgres_password = #-rnd(pas,12)-# -taiga_password = #-rnd(pas,12)-# +postgres_password = #-rnd(pas,16)-# +taiga_password = #-rnd(pas,16)-# diff --git a/profiles/templates/taiga/rabbitmq-server/ini.env b/profiles/templates/taiga/rabbitmq-server/ini.env index 9eaed84..eeb6e9f 100644 --- a/profiles/templates/taiga/rabbitmq-server/ini.env +++ b/profiles/templates/taiga/rabbitmq-server/ini.env @@ -1,3 +1,3 @@ # Calculate format=samba path=/var/calculate grep(/var/calculate/ini.env,\[rabbitmq\])== protected [rabbitmq] -taiga_password = #-rnd(pas,12)-# +taiga_password = #-rnd(pas,16)-# diff --git a/scripts/homeassistant/step/3-zigbee2mqtt.sh b/scripts/homeassistant/step/3-zigbee2mqtt.sh index b48e640..6733f30 100755 --- a/scripts/homeassistant/step/3-zigbee2mqtt.sh +++ b/scripts/homeassistant/step/3-zigbee2mqtt.sh @@ -75,5 +75,11 @@ serial: # Location of USB sniffer port: ${ini[zigbee2mqtt.dev]} frontend: true + +mqtt: + base_topic: zigbee2mqtt + server: mqtt://localhost + user: ${ini[mosquitto.homeassistant_user]} + password: '${ini[mosquitto.homeassistant_password]}' EOF eend