Home Assistant Core -- TrueNAS CORE Community Plugin

Have had to wake up a spare Pi and just run that as my MQTT server. MQTT is so important as a backbone to HA.

It looks like the FreeBSD mosquitto port has been updated to 2.0 or later. This version has some breaking configuration and command line changes. See the blog post here: https://mosquitto.org/blog/2020/12/version-2-0-0-released/
I have not updated mine yet, and I’m running mine in a raw jail not a TrueNAS plugin, so I don’t know exactly what it will take to fix. I expect a minor change to the config file and maybe the startup script.

I’ll post notes here if I get mine updated and working.

1 Like

@DoucheCanoe and @elyobelyob sorry for the delayed response… I think found the problem

Looks like the variable name for the pidfile has changed. Please give this a try…

EDIT – See here instead

Thanks @jkhii just what I needed to see

Hi, thanks for taking a look.

I made the change, but unfortunately it’s still not starting.

Is there a log file I can reply with useful info from?!

In the meantime, I’ve popped back to my spare MQTT server …

Thanks

Nick

I see it now - I don’t think the pid-file was even being used before…

Rather than have you try editing more files, please give this a try

  • $ZPOOL is the pool where you have activated iocage
  • You may use any valid --name JAIL_NAME to name this jail
cd /mnt/$ZPOOL/iocage/.plugins/github_com_ix-plugin-hub_iocage-plugin-index_git
iocage fetch -P mosquitto.json --branch test-quick-fix --name JAIL_NAME

Watching you edit your post while I was typing into shell was interesting…

Its currently running now. Thank you.

1 Like

This seems to have worked for me. I have a second jail now which started up and responded to a test.

root@mosquitto-1:~ # mosquitto_sub -d -t /dev/test
Client (null) sending CONNECT
Client (null) received CONNACK (0)
Client (null) sending SUBSCRIBE (Mid: 1, Topic: /dev/test, QoS: 0, Options: 0x00)
Client (null) received SUBACK
Subscribed (mid: 1): 0

I’m still on my Pi spare for the moment, so if you want me to destroy my current jail and build again from scratch, happy to help.

1 Like

If your current jail is broke, then I suppose there is nothing to loose?

You can just rename your test jail to the current jail’s name, after it has been destroyed.

iocage destroy -f $original_jail_name
iocage stop $test_jail_name
iocage rename $test_jail_name $original_jail_name
iocage start $original_jail_name
1 Like

I destroyed it and recreated.
All back up and running.

Now on the branch, right? Not that I’ll be updating anytime again soon …

Thanks

Actually, no. Using --branch only works on the command line, and for the initial installation. When you run the update (or upgrade) it will use it’s default behavior. Currently the way iocage works, is to to look for a branch that matches the release - which at this time, would be the 12.2-RELEASE - if that branch does not exist it will use the master branch instead.

For the mosquitto plugin, I do not have separate release branches, everything typically installs and updates from the master branch.

Anyway, I pushed these changes over so this will install again from TrueNAS UI and running a Plugin UPDATE won’t break it, if you installed using --branch test-quick-fix

1 Like

Hi Troy,
I didn’t explain clearly enough about the daily snapshot. Yours will work because it is already set up. The problem is that the blueprint will not create an automation because of the error I posted.

unknown tag !<!input> at line 32, column 36:
dataset_name: !input dataset_name

An automation is written to the automations.yaml, but it does not appear in the automations list and is, therefore, not triggered. It was only after checking both yamls that I found this error message while looking at the file in File Editor. Should I post this to the general Configuration forum for yaml experts to give advice?

Also, after updating MQTT to 2.08, my single Tasmota switch gives this error message in the console: Connect failed to 192.168.0.31:1883. It was working before the update and I can log into the Tasmota webpage. I checked the config file of mosquitto and see you set it to allow anonymous false, so I changed it to true and added a username and password. Still no go. See edit below.

Regards,

Frank
Edit: Sorry Troy I stuffed that up badly. You did set anonymous to TRUE. I set it to FALSE to try a username and password but that did not work, so I set it back to TRUE.

Ah - I got it now… Thanks for me letting me know, I’ll take a look

That’s weird - I have set allow_anonymous true in the config.

It should work with everything when allow_anonymous true, but I have also found my Tasmota devices are refusing to connect now, but adding a username and password has resolved the issue.

You need add the username /password on the broker itself, as well as set it in the tasmota device. The mosquito plugin has a few tricks to helps… I think the only mention of this is hidden away in a now closed issue… So I’ll mention it here

These commands are run from TrueNAS console, not inside the jail

- enable / disable allow_anonymous

# Enable
iocage set -P allow_anonymous=true $mosquitto_jail
# Disable
iocage set -P allow_anonymous=false $mosquitto_jail

- add a new user

iocage set -P adduser=username,password $mosquitto_jail

- list existing users

iocage get -P users $mosquitto_jail

- change the password for a user

iocage set -P setpassword=username,password $mosquitto_jail

- delete a user

iocage set -P deluser=username $mosquitto_jail
1 Like

Sorry Troy, you are right. Please see my edit. I think I was going nuts trying to get the Tasmota device to connect. :slight_smile:

I did edit (ee) the mosquitto config and password files but that didn’t work either. Using the TrueNAS shell commands above worked immediately after changing to FALSE and adding username/password.

Just FYI for anyone following

It’s perfectly fine to manually edit the mosquitto config using (ee) - The shell command does the same, just using (sed)

Mosquitto has a tool for setting a username and password: mosquitto_passwd - The shell command is using this tool, which can also be used from the command line.

You also need to reload or restart mosquitto after making some changes - The shell command restarts the mosquitto service when changes are made.

Hi Troy,
Have you had time to have a look at the ZFS Snapshot yaml error?

Hi Troy, I was having the exact same issue with a PyNaCl error and fixed my issue following your instructions.

1 Like

Not yet @Tromperie - I’ll try to prioritize that for this weekend.

Look after yourself first. You do so much and I feel guilty asking.

Hey @Tromperie – Can you say exactly what you did to produce this error ?

I have tried creating a new automation using the blueprint, removing it, and creating it again but I can not reproduce your error.

Are you having an error when trying to create the automation, or when it tries to run ?

Any chance this is a simple oversight when entering the dataset name ? It may not be obvious from the blueprint comments, the dataset should be entered beginning with the zpool as follows

zpool/path/to/dataset