$response = msudp_send_mem($msno, $udpport, $prefix, $sendstring/%LabelsAndValues);

Sends one or multiple values to the specified Loxone Miniserver via UDP. The function automatically saves the last state and only sends values that have changed.

LoxBerry Compatibility

This feature first is available with LoxBerry 1.2.4. Set your LB_MINIMUM version in your plugin.cfg accordingly.

Please see the documentation of LoxBerry::IO::msudp_send for parameters. Parameters and return values are fully compatible to this function.

The difference to the msudp_send function is that it remembers recently sent values, and does not re-send non-changed values.

That memory is kept on RAM disk - therefore the memory works not only during a single runtime, but also over several calls that init new processes every time (e.g. calls from the webinterface, or calls from a cronjob).

The function uses different mechanisms to check, if it should exceptionally send all values, not only the diff:

  • After a LoxBerry reboot, the memory file on the RAM disk is empty → Every new incoming parameter and value is sent
  • LoxBerry::IO defines a variable $LoxBerry::IO::mem_sendall_sec that defaults to 3600 seconds (1 hour). A call after 1 hour will clear the cache and all values will be re-sent.
  • LoxBerry::IO checks the Miniserver after at least 5 minutes if it possibly was rebooted. If so, the cache is cleared too and every value is sent again.

Custom delimiter (from V1.4.2)

By default, the delimiter of label and value is the equal sign (=). You can set your own delimiter by setting this, before calling the function:

$LoxBerry::IO::udp_delimiter = '#';

This sets the delimiter for msudp_send and msudp_send_mem to, for example, the hash sign (#). 

Special parameters

These parameters are shared for mshttp_send_mem and msudp_send_mem.

# Set this variable directly before the function call to override the cache and exceptionally submit ALL values.
# After every function call, the function resets the value to 0.
$LoxBerry::IO::mem_sendall = 1;

# Change the setting after what time (seconds) the cache should be cleared and all values should be sent.
# Default value is 3600.
$LoxBerry::IO::mem_sendall_sec = 7200;