Skip to content
biffhero edited this page Nov 14, 2018 · 6 revisions

Since MisterHouse v4.0 there is support for MQTT.

Configuration

This is a stub page that needs expansion, for initial info on how to configure this, please see the comments in #488.

Notes from my install.

  1. sudo apt install mosquitto mosquitto-clients

  2. ps auxw | grep -i mosquitto | grep -v grep

  3. mosquit+ 4734 0.0 0.1 17296 5580 ? S 19:04 0:00 /usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf

  4. sudo netstat -lanp | grep -i 4734 tcp 0 0 0.0.0.0:1883 0.0.0.0:* LISTEN 4734/mosquitto

  5. add these lines mh.private.ini

mqtt_host=192.168.1.2

mqtt_server_port=1883

mqtt_topic=home/#

# mqtt_user=user # (optional)

# mqtt_password=password # (optional)

# mqtt_keepalive=120 # (optional)

  1. restart mh, get errors

Can't locate Net/MQTT/Constants.pm in @INC (you may need to install the Net::MQTT::Constants module) (@INC contains: ./../../local/code ./../code/common /hom
e/mh/mrhouse/mrhouse-hollie/bin/../lib /home/mh/mrhouse/mrhouse-hollie/bin/../lib/site . /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.28.0 /usr/local/sha
re/perl/5.28.0 /usr/lib/x86_64-linux-gnu/perl5/5.28 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.28 /usr/share/perl/5.28 /usr/local/lib/site_perl /usr/l
ib/x86_64-linux-gnu/perl-base) at /home/mh/mrhouse/mrhouse-hollie/bin/../lib/mqtt.pm line 180. at mh line 31.

  1. Install Net::MQTT (I use debian, so these are the steps that I'm using)

  2. wget https://cpan.metacpan.org/authors/id/B/BE/BEANZ/Net-MQTT-1.163170.tar.gz

  3. tar -zxvf Net-MQTT-1.163170.tar.gz

  4. dh-make-perl Net-MQTT-1.163170/

  5. cd Net-MQTT-1.163170

  6. debuild -i -us -uc -b

  7. sudo dpkg -i ../libnet-mqtt-perl_1.163170-1_all.deb

  8. restart mh, get no errors

  9. test mosquitto pub / sub (I used this page: http://www.steves-internet-guide.com/mosquitto_pub-sub-clients/ )

  10. In one shell, mosquitto_sub -h 127.0.0.1 -v -t house/#

  11. In another shell, mosquitto_pub -h 127.0.0.1 -m "test message" -t house/bulb1 -d

  12. Verify that you see the message on the sub side. "house/bulb1 test message"

TODO:

  1. mqtt.pl file

  2. mqtt.mht file

Clone this wiki locally