Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MQTT read_table_A.pl support #804

Merged
merged 1 commit into from
Dec 17, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 33 additions & 1 deletion lib/read_table_A.pl
Original file line number Diff line number Diff line change
Expand Up @@ -1901,7 +1901,39 @@ sub read_table_A {
$object = '';
}
#-------------- End AoGSmartHome Objects ----------------

#-------------- MQTT Objects -----------------
elsif ( $type eq "MQTT_BROKER" ) {
# there must be one record for the broker above any MQTT_DEVICE definitions
# it takes the following format
# MQTT_BROKER, name_of_broker
# e.g.MQTT_BROKER, mqtt_1
require 'mqtt.pm';
( $name ) = @item_info;
$code .= sprintf( "\n\$%-35s = new mqtt(\"%s\", \$config_parms{mqtt_host},
\$config_parms{mqtt_server_port},
\$config_parms{mqtt_topic},
\$config_parms{mqtt_username},
\$config_parms{mqtt_password}, 121);\n",
$name,
$name
);
}
elsif ( $type eq "MQTT_DEVICE" ) {
# there is one record per mqtt device and it must be below the MQTT_BROKER definition
# it takes the following form
# MQTT_DEVICE, name_of_device, groups, name_of_broker, topic
# e.g. MQTT_DEVICE, MQTT_test, Kitchen, mqtt_1, stat/mh_mqtt_test/SENSOR
# if the device is to transmit to MH, its topic must match the
# config parameter mqtt_topic in the mh.ini file
require 'mqtt.pm';
my ($MQTT_broker_name, $MQTT_topic);
( $name, $grouplist, $MQTT_broker_name, $MQTT_topic ) = @item_info;

$code .= sprintf( "\n\$%-35s = new mqtt_Item(\$%s\,\"%s\");\n",
$name, $MQTT_broker_name, $MQTT_topic );

}
#-------------- End MQTT Objects ----------------
elsif ( $type =~ /PLCBUS_.*/ ) {
#<,PLCBUS_Scene,Address,Name,Groups,Default|Scenes>#
require PLCBUS;
Expand Down