Skip to content

Latest commit

 

History

History
91 lines (48 loc) · 4.63 KB

2.Virtual output.md

File metadata and controls

91 lines (48 loc) · 4.63 KB

This tutorial allows you to send Loxone statistics directly to InfluxDB using Virtual Outputs.

1. Configure UDP / HTTP / HTTPS listeners in InfluxDB

Be aware that this tutorial is intended for InfluxDB 1.8. The new version InfluxDB 2.0 does not use influxdb.conf config file (but WebGUI interface), it also does not have built-in UDP and HTTPS listeners (but requires Telegraph for parsing feeding data to the database).

Option 1: UDP

UDP listener is disabled by default. Edit /etc/influxdb/influxdb.conf and enable the UDP listener, set the port for listener and the name of the database that you want to write to:

[[udp]]
enabled = true
bind-address = ":8089"
database = "loxone"

See InfluxDB config manual for more details.

Option 2: HTTP

HTTP endpoint should work out of the box.

Option 3: HTTPS

If you have Loxone Miniserver 2. generation and you want (or need) to encrypt traffic between Loxone and the InfluxDB server, just follow their official documentation (not tested by me).

2. Configure Virtual Output in Loxone

Loxone Config > Miniserver > Virtual Outputs > Create new Virtual Output

UDP:

Address /dev/udp/192.168.1.22/8089

07

HTTP(S):

For HTTP(S) address Loxone uses slightly different syntax:

Address http://192.168.1.22:8086

3. Configure Virtual Output Command

Loxone Config > Miniserver > Virtual Outputs > Create new Virtual Output Command

UDP:

Specify Command for ON and Command for OFF, which should correspond to InfluxDB line protocol:

<measurement>,<tag_key>=<tag_value> <field_key>=<field_value>

Do not forget space between measurement (tag) and field. At the same time all spaces in tag keys, tag values, and field keys must be escaped with \. So the Command for ON can look like this:

Temperature,room=Living\ room value=<v>

But this way you would need unique Virtual Output Command for each measurement and tag. So it is better to specify only measurement name in the Virtual Output Command and fill the rest (tag and field) in Loxone schema:

Temperature,room=<v>

08

HTTP(S):

This is slightly different. The InfluxDB line protocol should go into HTTP Post command for ON and HTTP Post command for OFF.

The Command for ON and Command for OFF, contain URL endpoint. Here we need to specify database name. For UDP listener, the database is specified in /etc/influxdb/influxdb.conf , but for HTTP we have to supply the database name, user name and password through URL (see the documentation for more details):

/write?db=loxone&precision=s&u=your_user&p=your_password

09

4. Loxone Config program

Now it is time to draw in Loxone Config. We will build the rest of the UDP message (tag name and value) dynamically, through the Status block. We can thus use one Virtual Output Command as a "connector" to write statistics data from multiple sensors (differentiated by tag value).

10

All Status blocks are identical (except for the name), so you can easily copy-paste them in your program. And edit only their name. Status blocks contain a single rule with the following Status-text:

<vn> value=<v1.1>

11

As you can see, the tag is specified through block name. But remember, you have to follow the rules of the to InfluxDB line protocol. Do not forget to escape any spaces in the block name with backslash \.

That is it! You have successfully connected all your temperature sensors with InfluxDB. Whenever one of the temperature sensors changes its value, new datapoint is pushed to InfluxDB.

You can now go ahead and create another Virtual Output Command for another measurement (for example humidity) and again, you can connect all your humidity sensors to one Virtual Output Command. This approach with "shared" Virtual Output Command works as long as sensor values do not change at the same time. If you have analog or digital data which change at EXACTLY same moment, you would need different approach (it is doable, but beyond the scope of this tutorial).