Question about sending a Modbus poll (remotely) and feedback on my first set-up

Platform information:

  • Hardware: Raspberry Pi 3 Model B Rev 1.2 // 1GB RAM // 32GB SD
  • OS: Raspbian GNU/Linux 10 (buster) // Linux 4.19.75-v7+
  • Java Runtime Environment: openjdk version (build: 1.8.0_222)
  • openHAB version: openHAB 2.5.0-1 (openHABian)

Issue of the topic: Question about manually sending a Modbus poll (remotely) and feedback on my first set-up.

Dear openHAB-community,

is it possible to somehow send a individual modbus poll remotely without implementing it as a specific data thing just using the general format of modbus?

Lets says i want to change the adres of my sensor with this command:
image

Is it possible to somehow directly send that poll in hexadecimal form? And is it somehow possible doing that remotely via VPN/reverse proxy or some other solution and connecting via SSH/openhab console?

My complete first set-up:
I would love get some feedback. Are there things i should to differently?

Binding, persistences, transformations etc. used:
Modbus, ntp, influxdb, transformation-javascript - 2.5.1, Grafana v6.5.3

Modbus_senor.things:

// Brigde to the physical RS-485 connection, defining the connection parameters
Bridge modbus:serial:slave01 
[port="/dev/ttyUSB0",baud=9600,id=1,stopBits="1.0",parity="none",dataBits=8,encoding="rtu"]
{
    // Data pollers for temp and humidity registers
    Bridge poller SensorRead1[start=1, length=2, refresh=1000, type="input"]
    {
        Thing data temperature1 [readStart="1", readValueType="int16", readTransform="JS(IntToFloat.js)"]
        Thing data humidity1    [readStart="2", readValueType="uint16", readTransform="JS(IntToFloat.js)"]
    }
}

Local_Time.things:

DateTime    Local_date_time     "Date/time:"    {channel="ntp:ntp:my_local_time:dateTime"}

.items:

Number Humidity_read    "Relative humidity: [%.1f/100 %%]"     {channel="modbus:data:slave01:SensorRead1:humidity1:number"}
Number Temperature_read "Temperature: [%.1f °C]"               {channel="modbus:data:slave01:SensorRead1:temperature1:number"}
DateTime Local_date_time "Date/time:"                          {channel="ntp:ntp:my_local_time:dateTime"}

Transforms(IntToFloat.js):

(function(inputData) {
    var DIVISiON_FACTOR = 10;
    return parseFloat(inputData) / DIVISiON_FACTOR;
})(input)

.sitemap:

sitemap HVAC label="HVAC Monitoring"
 
{
    Frame label="Local Date & Time" {
        Text item= Local_date_time   label="Time:[%1$tH:%1$tM:%1tS]"            icon="time"
        Text item= Local_date_time   label="Date:[%1$td.%1$tm.%1$tY]"           icon="calendar"
    }
    Frame label="Modbus Sensor 1" {
        
        Default item= Humidity_read     icon="humidity"         label="Relative humidity: [%.1f %%]"
        Default item= Temperature_read  icon="temperature"      label="Temperature: [%.1f °C]"
    

    }
}

BasicUI:


Habpanel with Grafana:

Thanks for any feedback and help in advance!
Sancho

It’s a good question.
The answer in short is “no”.
openHAB modbus binding is set up to read and write to preconfigured devices and registers.
That configuring is done in Things.

The simplest way to do this kind of one-time task is on the bench with a general purpose modbus utility like mbpoll on an old laptop.

Modbus in general is not designed for dynamic reconfiguring of devices, a working installation is expected to be quite static. You’ll certainly get into trouble if you change things like baud rate on the fly.
Why would you want to do it after installation? Why would you want to do it remotely?

Longer answer - there is some hacky stuff that might partly do what you want.
Say you wanted to set the address on a factory-default unit, where you know what the slave ID and baud rate, parity, etc. is.
You could preconfigure Things in openHAB to those factory defaults to do your one-time write, using an Item as the basis of your new target id.

That’s an Item and belongs in an xxx.items file