Open dpatelli opened 7 years ago
What is your setup? using the latest master I couldn’t replicate your issue;
MH doesn’t come with the dependancy Net::MQTT::Message, so
cpan to install Net::MQTT::Message
user code:
require mqtt; #noloop $mqtt1 = new mqtt('mqtt', ‘127.0.0.1', 1883, 'home/#', "", "", 121); $water = new mqtt_Item($mqtt1, "home/water");
and I see mqtt starting up in the logs:
08/26/17 04:54:14 PM Creating mqtt on 127.0.0.1:1883 home/# 08/26/17 04:54:14 PM Opening MQTT (mqtt) connection to 127.0.0.1/1883/home/# 08/26/17 04:54:14 PM Host = 127.0.0.1 08/26/17 04:54:14 PM Port = 1883 08/26/17 04:54:14 PM Topic = home/# 08/26/17 04:54:14 PM User = 08/26/17 04:54:14 PM Password = 08/26/17 04:54:14 PM Keep Alive = 121 08/26/17 04:54:14 PM mqtt mqtt_connect Socket (127.0.0.1:1883,121) 08/26/17 04:54:14 PM mqtt Socket check (121) [ ]: Connected 08/26/17 04:54:14 PM mqtt mqtt Received: ConnAck/at-most-once Connection Accepted 08/26/17 04:54:14 PM mqtt mqtt Sub 1 Received: (--No $$msg{string}--) 08/26/17 04:54:14 PM mqtt mqtt Initializing MQTT connection ... 08/26/17 04:54:14 PM mqtt added MQTT check_for_data ...
08/26/17 04:54:14 PM Oops1: Use of uninitialized value in concatenation (.) or string at ../lib/mqtt.pm line 776.
08/26/17 04:54:14 PM mqtt mqtt set mqtt: [(on), (mqtt=HASH(0x7fdf2420c228)), ] 08/26/17 04:54:14 PM mqtt mqtt set mqtt: isa mqtt
On Aug 26, 2017, at 4:13 PM, dpatelli notifications@github.com wrote:
Attempting to use mh with a mqtt server. Configured using what limited info I could find.
Startup error on &mqtt::server_startup('mqtt'): Undefined subroutine &mqtt::server_startup called at (eval 454) line 1. at ./mh line 31. main::ANON('Undefined subroutine &mqtt::server_startup called at (eval 45...') called at (eval 454) line 1 eval '&mqtt::server_startup('mqtt') ;' called at ./mh line 968 main::setup called at ./mh line 7764
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/hollie/misterhouse/issues/729, or mute the thread https://github.com/notifications/unsubscribe-auth/AExbSDFt-13WyEs023MD-bC3dpNIDqyTks5scJhtgaJpZM4PDopc.
I had included the MQTT dependencies, but did not include any code in /code/mysutff/my.pl. I had found a example/reference about putting something like this into my ./mht file:
# MQTT stuff
CODE, require mqtt; #noloop
#
CODE, $mqtt_1 = new mqtt('mqtt_1', '192.168.1.21', 1883, 'telemetry/#', "", "", 121);
#CODE, $mqtt_2 = new mqtt('mqtt_2', 'test.mosquitto.org', 1883, 'home/test/#', "", "", 122);
#CODE, $mqtt_3 = new mqtt('mqtt_3', '127.0.0.1', 1883, 'home/network/#', "", "", 122); #noloop
#
CODE, $CR_Temp = new mqtt_Item($mqtt_1, "home/ha/text/x10/1");
#CODE, $M2_Temp = new mqtt_Item($mqtt_2, "test.mosquitto.org/test/x10/1");
#CODE, $M3_Temp = new mqtt_Item($mqtt_3, "home/network/test/x10/1");
#
CODE, $CR_Temp->set("On");
#CODE, $M2_Temp->set("Off");
#CODE, $M3_Temp->set("On");
I added your example (with changes to point to my mqtt broker) and it seemed to at least connect to the broker. Not sure how it should all work, but I'll keep plugging along.
I've been playing with misterhouse for over 10 years with X10 and am still running an old version which I made a Star Trek LCARS interface for it. Most of my X10 stuff has long died with the exception of motion detectors and thermostat -- Glad to see the project did not die out.
Found light switches which are based on ESP8266s, reflashed with custom code to talk mqtt protocol. Been playing with them for a few months... Was very happy to see mqtt support for the new version of MH, so today I spun up another server and installed, Docs seem to be lacking (or my google-fu failed me) on the mqtt interfacing.
Thank you Dan
Attempting to use mh with a mqtt server. Configured using what limited info I could find.
Startup error on &mqtt::server_startup('mqtt'): Undefined subroutine &mqtt::server_startup called at (eval 454) line 1. at ./mh line 31. main::ANON('Undefined subroutine &mqtt::server_startup called at (eval 45...') called at (eval 454) line 1 eval '&mqtt::server_startup(\'mqtt\') ;' called at ./mh line 968 main::setup called at ./mh line 7764