summaryrefslogtreecommitdiff
path: root/roles/daq-node/bin/fapg-daq-node
blob: 55a6d599c624f8fc6cd0828289de344434b42abd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env perl
# -*- mode: perl-ts; -*-

use 5.40.1;
use strict;
use warnings;

use FindBin;
use lib "${FindBin::Bin}/../lib/perl5";

use FAPG::DAQ::EZO;

=head1 NAME

fapg-daq - read sensor data and send over MQTT

=cut

my $probe = FAPG::DAQ::EZO::identify_probe();

print "Found probe "
  . $probe->type
  . " on "
  . $probe->device
  . ".\n";

while (1) {
  my $reading = $probe->get_reading();

  print "Reading: " . $reading->value . " " . $reading->unit . "\n";

  $reading->publish_mqtt();

  sleep 5;
}
Copyright 2019--2026 Marius PETER