Skip to content

Commit e040cab

Browse files
committed
More template fixes
* Only add writable entries to the output templates * Fix syntax for sending MQTT values
1 parent 5c10f31 commit e040cab

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

webfrontend/htmlauth/index.cgi

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,14 +136,17 @@ if ($R::saveformdata2) {
136136

137137
my $count = scalar(@datenpunkte);
138138

139-
# Generate a temporary arroy for all virtual inputs
140139
for ($i = 1; $i < $count; $i++) {
141140
my $id = sprintf "%03d", $datenpunkte[$i][0];
142141
my $device = $datenpunkte[$i][1];
143142
my $name = encode('UTF-8', $datenpunkte[$i][1]." ".$datenpunkte[$i][2]);
143+
my $input_output = $datenpunkte[$i][4];
144144
if ($id == '000') {
145145
next;
146146
}
147+
if (!($input_output =~ /Out/)) {
148+
next;
149+
}
147150

148151
foreach $item (@devices) {
149152
if ($item eq $device) {
@@ -173,11 +176,16 @@ if ($R::saveformdata2) {
173176
# Generate a temporary arroy for all virtual inputs
174177
for ($i = 1; $i < $count; $i++) {
175178
my $id = sprintf "%03d", $datenpunkte[$i][0];
179+
my $device = $datenpunkte[$i][1];
176180
my $name = encode('UTF-8', $datenpunkte[$i][1]." ".$datenpunkte[$i][2]);
181+
my $input_output = $datenpunkte[$i][4];
177182

178183
if ($id == '000') {
179184
next;
180185
}
186+
if (!($input_output =~ /In/)) {
187+
next;
188+
}
181189

182190
foreach $item (@devices) {
183191
if ($item eq $device) {
@@ -216,15 +224,20 @@ if ($R::saveformdata2) {
216224
my $device = $datenpunkte[$i][1];
217225
my $name = encode('UTF-8', $datenpunkte[$i][1]." ".$datenpunkte[$i][2]);
218226
my $topic = encode('UTF-8', "wolfism8_".getMQTTFriendly($datenpunkte[$i][1])."_".getMQTTFriendly($datenpunkte[$i][2]));
227+
my $input_output = $datenpunkte[$i][4];
219228
if ($id == '000') {
220229
next;
221230
}
231+
if (!($input_output =~ /Out/)) {
232+
next;
233+
}
222234

223235
foreach $item (@devices) {
224236
if ($item eq $device) {
225237
my $linenr = $VIhttp->VirtualInHttpCmd (
226238
Title => "$topic",
227-
Comment => "$name"
239+
Comment => "$name",
240+
Check => " "
228241
);
229242
}
230243
}
@@ -248,21 +261,26 @@ if ($R::saveformdata2) {
248261
# Generate a temporary arroy for all virtual inputs
249262
for ($i = 1; $i < $count; $i++) {
250263
my $id = sprintf "%03d", $datenpunkte[$i][0];
264+
my $device = $datenpunkte[$i][1];
251265
my $name = encode('UTF-8', $datenpunkte[$i][1]." ".$datenpunkte[$i][2]);
252266
my $topic = encode('UTF-8', "wolfism8/".getMQTTFriendly($datenpunkte[$i][1])."/".getMQTTFriendly($datenpunkte[$i][2]));
253267
my $topic_name = $topic;
254268
$topic_name =~ s/\//_/g;
269+
my $input_output = $datenpunkte[$i][4];
255270

256271
if ($id == '000') {
257272
next;
258273
}
274+
if (!($input_output =~ /In/)) {
275+
next;
276+
}
259277

260278
foreach $item (@devices) {
261279
if ($item eq $device) {
262280
my $linenr = $VO->VirtualOutCmd (
263281
Title => "$topic_name",
264282
Comment => "$name",
265-
CmdOn => "retain $topic \v",
283+
CmdOn => "retain $topic <v>",
266284
Analog => 1,
267285
);
268286
}

0 commit comments

Comments
 (0)