Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


Installing MQTT-Broker "mosquitto" and WeatherFlow UDP-listener on RaspberryPi running "dietpi"


pflugj
 Share

Recommended Posts

I had a few problems to get it right and maybe this post helps others to

NOT make so many mistakes than I did :-( 

 

I am running the currently latest Dietpi Version 7.3.x
 

Installing MQTT Broker: "Mosquitto"

log on to your dietpi via ssh.
run:
pyhon3 -V
result : Python 3.7.x
Should be somewhere @ 3.7.x or higher

 

Install software via "dietpi-software" - search for:
"pip"        - should find package n#130
"influx"    - should find package n#74 = InfluxDB
"mosquitto"    - should find package n#123

 

Important:

I also installed "paho-mqtt" via:
sudo pip3 install paho-mqtt

# if you forget this step - like I did first - the listener will not publish to the MQTT Broker but still works!! WITHOUT any ERROR message
# You will only notice that the when you run listen.py from the command prompt that the line: 

# "publishing to" will be missing 

# It took me a while to figure this out

 

Next I changed the "mosquitto.conf" file located in
/etc/mosquitto

I installed Midnight Commander via dietpi-software and started "mc" from here
Then opened "mosquitto.conf" for editing via "Edit F4"
and added a line:
allow_anonymous true
# obviously to allow connection without user & password
              
and changed the listener line to:
listener 1833 0.0.0.0 
#otherwise mosquitto starts in "local ONLY"mode

 

I then restarted the mosquitto server:
systemctrl restart mosquitt.service
and checked
systemctrl status mosquitto service

 

I then changed directory to:
cd /usr/local/bin/

Create a new text file via:
touch listen.py    - or by any other means

Then go to:

Please login or register to see this link.

click on "listen.py" and then on "raw" 
"ctrl-a" > ctrl-c" - copy

 

I then started "mc" and opened "listen.py" for editing and pasted the content from the above
via "shift-ctrl-v" then quit via F10 and save the file.

 

Then I started:
python3 /usr/local/bin/listen.py -b 127.0.0.1 -m -d
This should produce some output like:
rapid_wind     =>  ts  = 1624942363 mps = 2.07 dir = 131
publishing to mqtt://127.0.0.1/wf/rapid_wind

 

I then edited the dietpi "custom.sh" file @ 

/var/lib/dietpi-autostart/
and added the line
nohup python3 /usr/local/bin/listen.py -b 127.0.0.1 -m

 

I then run dietpi-config and changed Autostart options to n#14: Custom        
This should start the listener.py automatically after a reboot.    

 

NI then checked that the MQTT Broker "mosquitto" is running and reachable!
I use "MQTT Explorer" which is free and available for all major plattforms:
Can be found here:

Please login or register to see this link.

 

Install on any machine on your network.

When you are connected to your MQTT server you should find the topi "wf"
and now all should be good to go and run the QuickApp :-)

 

You might also want to publish to InfluxDB for later use with grafana or so

by adding the options to the listen.py command line.
for options look at:

Please login or register to see this link.

 

....and last but not least again thanks to:

vinceskahan for the brilliant "listener"  -- THANKS

afendikov for providing the QuickApp  -- THANKS 

and

Bodyart @ for providing an alternate way of reading out the WeatherFlow data

..and of course anybody else I might have forgotten to mention here.

 

THANK you very much 

Cheers 

Jürgen

 

PS: Please report if you spot anything wrong here! 

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...