MODBUS with HVAC Pluggit

Thank you for testing!
What might be the reason? Maybe convert to hex before sending?

Something strange: if I plug my laptop via USB, iFlow shows 2052 for summer mode, not 2048…

Best regards
Robert

Hi Robert;

I’ve found one understanding mistake
According register description, register 40169 (prmRamIdxUnitMode) includes two control behaviors

  • Selection of the main program
    o Demand Mode 0x0002
    o Manual Mode 0x0004
    o WeekProgram Mode 0x0008
  • Enable/Disable Options
    o Away Mode ( enable = 0x0010, disable=0x8010
    o Fireplace Mode ( enable = 0x0040, disable =0x8040,
    o Summer Mode ( enable = 0x0800, disable =0x8800
    o Bypass Manual ( enable = 0x0080, disable =0x8080

So, the register Value 2052 means
Manual Mode (0x0004) with enables Option Summer mode (0x0800)

But that does not change the write behavior

1 Like

For me also everything is working fine, except writing. The ventilation unit shows up the right values (for example changing the fan speed from 1 to 4), but the rpms remain the same.

I have the same behaviour with different php/python scripts.

Using e.g. ModbussPoll for Windows (http://www.modbustools.com/download.html) works well.
Everything works as expected. Writing the values changes the behaviour of my pluggit Avent P310.

Does anybody have a working (php/python) script for Linux and is willing to share it with us? Maybe I can build a working script for OpenHab2 !

I could verify the same behaviour on my P310 using the new modbus2 binding. What was constantly bothering me was the fact that the documentation clearly states

All parameters of the ventilation unit have a 32-bits dimension.

The binding uses the jamod library for the modbus communication, so I wrote the following code to check the register 325:

TCPMasterConnection con = null; //the connection
ModbusTCPTransaction trans = null; //the transaction
ReadMultipleRegistersRequest req = null; //the request

/* Variables for storing the parameters */
InetAddress addr = null; //the slave's address
int port = Modbus.DEFAULT_PORT;
int ref = 325; // according to the documentation 325 should be prmRomIdxSpeedLevel
int count = 2; //the number of registers to read

addr = InetAddress.getByName("192.168.XXX.YYY");
//2. Open the connection
con = new TCPMasterConnection(addr);
con.setPort(port);
con.connect();

//3. Prepare the request
req = new ReadMultipleRegistersRequest(ref, count);
System.out.println("Hex request: "+req.getHexMessage());

//4. Prepare the transaction
trans = new ModbusTCPTransaction(con);
trans.setRequest(req);

trans.execute();

ModbusResponse response = trans.getResponse();
System.out.println("Hex result: "+response.getHexMessage());
ReadMultipleRegistersResponse resMulti = (ReadMultipleRegistersResponse) response;
System.out.println("Register 0 "+resMulti.getRegisterValue(0));
System.out.println("Register 1 "+resMulti.getRegisterValue(1));

The result is:

Hex request: 00 00 00 00 00 06 00 03 01 45 00 02 
Hex result: 00 01 00 00 00 07 00 03 04 00 00 00 00 
Register 0 0
Register 1 0

Somewhere I read that you have to subtract 1 as the starting point (offset?) is 40001. So I tried it with register 324 and the output now is:

Hex request: 00 00 00 00 00 06 00 03 01 44 00 02 
Hex result: 00 01 00 00 00 07 00 03 04 00 01 00 00 
Register 0 1
Register 1 0

The confusing part for me was that for other registers (e.g. 133, prmRamIdxT1) it worked without subtracting one. But apparently this was just coincidence. The key factor seems to be the swapping of the blocks. So in essence, the following configuration works for me (using the paperUI):

prmRamIdxT1:
Read Address: 132
Read value type: 32bit floating point, 16bits word swapped (float32_swap)

prmRomIdxSpeedLevel:
Read Address: 324
Read value type: 32bit unsigned integer, 16bits word swapped (uint32_swap)
Write Address: 324
Write type: Holding register
Write value type: 32bit signed integer, as two's complement but with 16bit words swapped (int32_swap)
Write multiple even with single register or coil: true

prmRamIdxUnitMode:
Write Address: 168
Write type: Holding register
Write value type: 32bit signed integer, as two's complement but with 16bit words swapped (int32_swap)
Write multiple even with single register or coil: true

When I write the value ‘16’ to prmRamIdxUnitMode, the device goes in “away” mode and the fan speed drops correctly.

1 Like

Well done exploring. Modbus docs can be very confusing, regarding MB “register number” = “address +1”. There’s no consistency about this usage. And none about two-register 32 bit values, which half is ‘first’.

I followed your guide and it seems to work pretty good but I’m having some issues.
Running openHAB 2.4.0 right now (on a pi 3b+)

Here are my files:

item

Number Pluggit_SpeedFan01               "Speed Fan 1 [%.0f rpm]"                                                        (gPluggit)      {modbus="pluggit_prmHALTaho1:0"}
Number Pluggit_SpeedFan02               "Speed Fan 2 [%.0f rpm]"                                                        (gPluggit)      {modbus="pluggit_prmHALTaho2:0"}
Number Pluggit_OutdoorTemperature01     "Außenluft [%.1f °C]"                                           <temperature>   (gPluggit)      {modbus="pluggit_prmRamIdxT1:0"}
Number Pluggit_SupplyTemperature02      "Eingangsluft [%.1f °C]"                                        <temperature>   (gPluggit)      {modbus="pluggit_prmRamIdxT2:0"}
Number Pluggit_ExtractTemperature03     "Abgangsluft [%.1f °C]"                                         <temperature>   (gPluggit)      {modbus="pluggit_prmRamIdxT3:0"}
Number Pluggit_ExhaustTemperature04     "Ausgangsluft [%.1f °C]"                                        <temperature>   (gPluggit)      {modbus="pluggit_prmRamIdxT4:0"}
Number Pluggit_PowerOfPreheater         "Power Of Preheater [%d %%]"                                    <energy>        (gPluggit)      {modbus="pluggit_prmPreheaterDutyCycle:0"}
Number Pluggit_SpeedLevelOfFans         "Lüfterstufe [MAP(Pluggit.map):SpeedLevelOfFans_%d]"            <settings>      (gPluggit)      {modbus="pluggit_prmRomIdxSpeedLevel:0"}
Number Pluggit_ActiveUnitMode           "Modus [MAP(Pluggit.map):ActiveUnitMode_%d]"                    <settings>      (gPluggit)      {modbus="pluggit_prmRamIdxUnitMode:0"}
Number Pluggit_CurentUnitMode           "aktueller Modus [MAP(Pluggit.map):CurrentUnitMode_%d]"                         (gPluggit)      {modbus="pluggit_prmCurrentBLState:0"}
Number Pluggit_CurrentUnixTime          "Current Unix time [%d]"                                        <time>          (gPluggit)      {modbus="pluggit_prmDateTime:0"}
Number Pluggit_StartExploitationUnixTime"Date Stamp of the system start [%d]"                           <time>          (gPluggit)      {modbus="pluggit_prmStartExploitationDateStamp:0"}
Number Pluggit_WorkTimeOfSystem         "Work time of system [%d h]"                                    <time>          (gPluggit)      {modbus="pluggit_prmWorkTime:0"}
Number Pluggit_RemainingFilerLivetime   "Filterrestzeit [%d days]"                                      <time>          (gPluggit)      {modbus="pluggit_prmFilterRemainingTime:0"}
Number Pluggit_BypassTemperatureMin     "Min. für Außenluft [%.1f °C]"                                  <temperature>   (gPluggit)      {modbus="pluggit_prmBypassTmin:0"}
Number Pluggit_BypassTemperatureMax     "Max. für Abgangsluft [%.1f °C]"                                <temperature>   (gPluggit)      {modbus="pluggit_prmBypassTmax:0"}
Number Pluggit_BypassState              "Bypass [MAP(Pluggit.map):BypassState_%d]"                                  (gPluggit)      {modbus="pluggit_prmRamIdxBypassActualState:0"}

map

#================================================================================
SpeedLevelOfFans_0=Aus
SpeedLevelOfFans_1=1
SpeedLevelOfFans_2=2
SpeedLevelOfFans_3=3
SpeedLevelOfFans_4=4

#================================================================================
# Active Unit mode:

# relevante Modi
ActiveUnitMode_4=Manuell
ActiveUnitMode_132=Bypass-Auto
ActiveUnitMode_2052=Bypass-Manuell
####
ActiveUnitMode_2=Demand Mode
ActiveUnitMode_4=Manuell
ActiveUnitMode_8=WeekProgram Mode
ActiveUnitMode_16=Away Mode
ActiveUnitMode_64=Fireplace Mode
ActiveUnitMode_2048=Sommer

#================================================================================
# Current unit mode:

# relevante Modi
CurrentUnitMode_1=Bypass
CurrentUnitMode_6=Sommer
####
CurrentUnitMode_0=Standby
CurrentUnitMode_2=Demand
CurrentUnitMode_3=Week program
CurrentUnitMode_5=Away
CurrentUnitMode_9=Fireplace
CurrentUnitMode_4=Servo-flow
CurrentUnitMode_7=DI Override
CurrentUnitMode_8=Hygrostat override
CurrentUnitMode_9=Fireplace
CurrentUnitMode_10=Installer
CurrentUnitMode_11=Fail Safe 1
CurrentUnitMode_12=Fail Safe 2
CurrentUnitMode_13=Fail Off
CurrentUnitMode_14=Defrost Off
CurrentUnitMode_15=Defrost
CurrentUnitMode_16=Night
CurrentUnitMode_255=KeinPlan

#================================================================================
# Bypass state:
BypassState_0=Geschlossen
BypassState_1=In Bearbeitung
BypassState_32=Schließt
BypassState_64=Öffnet
BypassState_255=Offen

# END ===========================================================================

modbus.cfg

modbus:poll=10000


#       http://www.pluggit.com/fileserver/files/1413/609560454939420/21_10_2013_modbus_addresses.pdf

#================================================================================
#        40133 | prmRamIdxT1                                    | Float | Read  |  Outdoor temperature T1, °C
# modbus:writemultipleregisters=false
modbus:tcp.pluggit_prmRamIdxT1.connection=192.168.143.4:502
modbus:tcp.pluggit_prmRamIdxT1.id=1
modbus:tcp.pluggit_prmRamIdxT1.start=133
modbus:tcp.pluggit_prmRamIdxT1.length=2
modbus:tcp.pluggit_prmRamIdxT1.type=holding
modbus:tcp.pluggit_prmRamIdxT1.valuetype=float32

#================================================================================
#       40135 | prmRamIdxT2                                     | Float | Read  |  Supply  temperature T2, °C
# modbus:writemultipleregisters=false
modbus:tcp.pluggit_prmRamIdxT2.connection=192.168.143.4:502
modbus:tcp.pluggit_prmRamIdxT2.id=1
modbus:tcp.pluggit_prmRamIdxT2.start=135
modbus:tcp.pluggit_prmRamIdxT2.length=2
modbus:tcp.pluggit_prmRamIdxT2.type=holding
modbus:tcp.pluggit_prmRamIdxT2.valuetype=float32

#================================================================================
#       40137 | prmRamIdxT3                                     | Float | Read  |  Extract temperature T3, °C
# modbus:writemultipleregisters=false
modbus:tcp.pluggit_prmRamIdxT3.connection=192.168.143.4:502
modbus:tcp.pluggit_prmRamIdxT3.id=1
modbus:tcp.pluggit_prmRamIdxT3.start=137
modbus:tcp.pluggit_prmRamIdxT3.length=2
modbus:tcp.pluggit_prmRamIdxT3.type=holding
modbus:tcp.pluggit_prmRamIdxT3.valuetype=float32

#================================================================================
#       40139 | prmRamIdxT4                                     | Float | Read  |  Exhaust temperature T4, °C
# modbus:writemultipleregisters=false
modbus:tcp.pluggit_prmRamIdxT4.connection=192.168.143.4:502
modbus:tcp.pluggit_prmRamIdxT4.id=1
modbus:tcp.pluggit_prmRamIdxT4.start=139
modbus:tcp.pluggit_prmRamIdxT4.length=2
modbus:tcp.pluggit_prmRamIdxT4.type=holding
modbus:tcp.pluggit_prmRamIdxT4.valuetype=float32

#================================================================================
# 40161 | prmPreheaterDutyCycle                         | UINT  | Read  |  Power of Preheater in %
# modbus:writemultipleregisters=false
modbus:tcp.pluggit_prmPreheaterDutyCycle.connection=192.168.143.4:502
modbus:tcp.pluggit_prmPreheaterDutyCycle.id=1
modbus:tcp.pluggit_prmPreheaterDutyCycle.start=161
modbus:tcp.pluggit_prmPreheaterDutyCycle.length=1
modbus:tcp.pluggit_prmPreheaterDutyCycle.type=holding
modbus:tcp.pluggit_prmPreheaterDutyCycle.valuetype=uint16

#================================================================================
# 40473 | prmCurrentBLState                             | UINT  | Read  |       Current unit mode:
#                                                                                                                               0       Standby
#                                                                                                                               1       Manual
#                                                                                                                               2       Demand
#                                                                                                                               3       Week program
#                                                                                                                               4       Servo-flow
#                                                                                                                               5       Away
#                                                                                                                               6       Summer
#                                                                                                                               7       DI Override
#                                                                                                                               8       Hygrostat override
#                                                                                                                               9       Fireplace
#                                                                                                                               10      Installer
#                                                                                                                               11      Fail Safe 1
#                                                                                                                               12      Fail Safe 2
#                                                                                                                               13      Fail Off
#                                                                                                                               14      Defrost
#                                                                                                                               16      Night
# modbus:writemultipleregisters=false
modbus:tcp.pluggit_prmCurrentBLState.connection=192.168.143.4:502
modbus:tcp.pluggit_prmCurrentBLState.id=1
modbus:tcp.pluggit_prmCurrentBLState.start=472
modbus:tcp.pluggit_prmCurrentBLState.length=1
modbus:tcp.pluggit_prmCurrentBLState.type=holding
modbus:tcp.pluggit_prmCurrentBLState.valuetype=uint16

#================================================================================
#@bug           32Bit Access is buggy, 30min are missing
# 40109 | prmDateTime                                           | UINT  | Read  |       Current Date/time in Unix time (amount of seconds from 1.1.1970)
# 40109 | prmDateTimeSet                                        | UINT  | Write |       New date/time in Unix time
# modbus:writemultipleregisters=false
modbus:tcp.pluggit_prmDateTime.connection=192.168.143.4:502
modbus:tcp.pluggit_prmDateTime.id=1
modbus:tcp.pluggit_prmDateTime.start=109
modbus:tcp.pluggit_prmDateTime.length=2
modbus:tcp.pluggit_prmDateTime.type=holding
modbus:tcp.pluggit_prmDateTime.valuetype=uint32

#================================================================================
# 40625 | prmWorkTime                                           | UINT  | Read  |       Work time of system, in hours
# modbus:writemultipleregisters=false
modbus:tcp.pluggit_prmWorkTime.connection=192.168.143.4:502
modbus:tcp.pluggit_prmWorkTime.id=1
modbus:tcp.pluggit_prmWorkTime.start=624
modbus:tcp.pluggit_prmWorkTime.length=1
modbus:tcp.pluggit_prmWorkTime.type=holding
modbus:tcp.pluggit_prmWorkTime.valuetype=uint16

#================================================================================
#@bug           32Bit Access is buggy, 12h are missing
# 40669 | prmStartExploitationDateStamp         | UINT  | Read  |       Date Stamp of the system start time in Unix time
#modbus:writemultipleregisters=false
modbus:tcp.pluggit_prmStartExploitationDateStamp.connection=192.168.143.4:502
modbus:tcp.pluggit_prmStartExploitationDateStamp.id=1
modbus:tcp.pluggit_prmStartExploitationDateStamp.start=669
modbus:tcp.pluggit_prmStartExploitationDateStamp.length=2
modbus:tcp.pluggit_prmStartExploitationDateStamp.type=holding
modbus:tcp.pluggit_prmStartExploitationDateStamp.valuetype=uint32

#================================================================================
##40555 | prmFilterRemainingTime                        | UINT  | Read  |       Remaining time of the Filter Lifetime (Days)
m# odbus:writemultipleregisters=false
modbus:tcp.pluggit_prmFilterRemainingTime.connection=192.168.143.4:502
modbus:tcp.pluggit_prmFilterRemainingTime.id=1
modbus:tcp.pluggit_prmFilterRemainingTime.start=554
modbus:tcp.pluggit_prmFilterRemainingTime.length=1
modbus:tcp.pluggit_prmFilterRemainingTime.type=holding
modbus:tcp.pluggit_prmFilterRemainingTime.valuetype=uint16

#================================================================================
# 40101 | prmHALTaho1                                           | Float | Read  |   Fan1 rpm
# modbus:writemultipleregisters=false
modbus:tcp.pluggit_prmHALTaho1.connection=192.168.143.4:502
modbus:tcp.pluggit_prmHALTaho1.id=1
modbus:tcp.pluggit_prmHALTaho1.start=101
modbus:tcp.pluggit_prmHALTaho1.length=2
modbus:tcp.pluggit_prmHALTaho1.type=holding
modbus:tcp.pluggit_prmHALTaho1.valuetype=float32

#================================================================================
# 40103 | prmHALTaho2                                           | Float | Read  |       Fan2 rpm
# modbus:writemultipleregisters=false
modbus:tcp.pluggit_prmHALTaho2.connection=192.168.143.4:502
modbus:tcp.pluggit_prmHALTaho2.id=1
modbus:tcp.pluggit_prmHALTaho2.start=103
modbus:tcp.pluggit_prmHALTaho2.length=2
modbus:tcp.pluggit_prmHALTaho2.type=holding
modbus:tcp.pluggit_prmHALTaho2.valuetype=float332

#================================================================================
# 40445 | prmBypassTmin                                         | Float | Read  |       Min temperature for outdoor air (T1)
# modbus:writemultipleregisters=false
modbus:tcp.pluggit_prmBypassTmin.connection=192.168.143.4:502
modbus:tcp.pluggit_prmBypassTmin.id=1
modbus:tcp.pluggit_prmBypassTmin.start=445
modbus:tcp.pluggit_prmBypassTmin.length=2
modbus:tcp.pluggit_prmBypassTmin.type=holding
modbus:tcp.pluggit_prmBypassTmin.valuetype=float32

#================================================================================
# 40447 | prmBypassTmax                                         | Float | Read  |       Max temperature for extract air (T3)
# modbus:writemultipleregisters=false
modbus:tcp.pluggit_prmBypassTmax.connection=192.168.143.4:502
modbus:tcp.pluggit_prmBypassTmax.id=1
modbus:tcp.pluggit_prmBypassTmax.start=447
modbus:tcp.pluggit_prmBypassTmax.length=2
modbus:tcp.pluggit_prmBypassTmax.type=holding
modbus:tcp.pluggit_prmBypassTmax.valuetype=float32

#================================================================================
# 40199 | prmRamIdxBypassActualState            | UINT  | Read  |       Bypass state:
#                                                                                                                               0       Closed 0x0000
#                                                                                                                               1       In process 0x0001
#                                                                                                                               32      Closing 0x0020
#                                                                                                                               64      Opening 0x0040
#                                                                                                                               255     Opened 0x00
# modbus:writemultipleregisters=false
modbus:tcp.pluggit_prmRamIdxBypassActualState.connection=192.168.143.4:502
modbus:tcp.pluggit_prmRamIdxBypassActualState.id=1
modbus:tcp.pluggit_prmRamIdxBypassActualState.start=198
modbus:tcp.pluggit_prmRamIdxBypassActualState.length=1
modbus:tcp.pluggit_prmRamIdxBypassActualState.type=holding
modbus:tcp.pluggit_prmRamIdxBypassActualState.valuetype=uint16

#================================================================================
# 40325 | prmRomIdxSpeedLevel                           | UINT  | Write |       Speed level of Fans ->  Manual mode: Fan step can be set
# 40325 | prmRomIdxSpeedLevel                           | UINT  | Read  |       Speed level of Fans ->  Other modes: Fan step can be read.
modbus:writemultipleregisters=true
modbus:tcp.pluggit_prmRomIdxSpeedLevel.connection=192.168.143.4:502
modbus:tcp.pluggit_prmRomIdxSpeedLevel.id=1
modbus:tcp.pluggit_prmRomIdxSpeedLevel.start=324
modbus:tcp.pluggit_prmRomIdxSpeedLevel.length=1
modbus:tcp.pluggit_prmRomIdxSpeedLevel.type=holding
modbus:tcp.pluggit_prmRomIdxSpeedLevel.valuetype=uint16

#================================================================================
# 40169 | prmRamIdxUnitMode                             | UINT  | Write |       Active Unit mode:
#                                                                                                                               Demand Mode                     0x0002          2
#                                                                                                                               Manual Mode                     0x0004          4
#                                                                                                                               WeekProgram Mode        0x0008          8
#                                                                                                                               Away Mode                       0x0010          16
#                                                                                                                               Fireplace Mode          0x0040          64
#                                                                                                                               Summer Mode                     0x0800          2048
modbus:writemultipleregisters=true
modbus:tcp.pluggit_prmRamIdxUnitMode.connection=192.168.143.4:502
modbus:tcp.pluggit_prmRamIdxUnitMode.id=1
modbus:tcp.pluggit_prmRamIdxUnitMode.start=168
modbus:tcp.pluggit_prmRamIdxUnitMode.length=1
modbus:tcp.pluggit_prmRamIdxUnitMode.type=holding
modbus:tcp.pluggit_prmRamIdxUnitMode.valuetype=uint16

# END ===========================================================================

sitemap

sitemap home label="Home" {
                Frame Text icon="fan" label="Lüftung2.0"
                {
                        Frame label="Allgemein"
                        {
                                Text item=Pluggit_CurentUnitMode
                                Selection item=Pluggit_ActiveUnitMode mappings=[
                                                4       = "Bypass-Auto",
                                                132     = "Bypass-Manuell",
                                                2052    = "Sommer"
                                ]
                                //Switch item=Pluggit_SpeedLevelOfFans mappings=[0 = "off", 1 = "1", 2 = "2", 3 = "3", 4 = "4"]
                                Selection item=Pluggit_SpeedLevelOfFans mappings=[0 = "off", 1 = "1", 2 = "2", 3 = "3", 4 = "4"]
                        }

                        Frame label="Temperaturen"
                        {
                                        Text item=Pluggit_OutdoorTemperature01
                                        Text item=Pluggit_SupplyTemperature02
                                        Text item=Pluggit_ExtractTemperature03
                                        Text item=Pluggit_ExhaustTemperature04
                        }

                        Frame label="Bypass"
                        {
                                        Text item=Pluggit_BypassState
                                        Text item=Pluggit_BypassTemperatureMin
                                        Text item=Pluggit_BypassTemperatureMax
                        }

                        Frame label="Filter"
                        {
                                        Text item=Pluggit_RemainingFilerLivetime
                                        Switch item=Pluggit_FilterTimerReset mappings=[1 = "Reset"]
                        }
                }

        Frame Text icon="poweroutlet" label="Strom"
        {
                Frame label="Wohnzimmer"
                {
                                Switch item=TVwSound label="TV + Soundsystem"
                                Switch item=01_1 label="TV"
                                Switch item=01_2 label="Sound-System"
                                Switch item=02_2 label="Lichterkette"
                                //Switch item=01_3 label="C"
                                //Switch item=01_4 label="D"
                }

                Frame label="Flur"
                {
                                Switch item=02_1 label="Blume EG"
                                //Switch item=02_3 label="C"
                                //Switch item=02_4 label="D"
                }
        }
}

I changed some wording to german but otherwise its exactly your config.

Issues I have:
When I load the sitemap from the openHAB Android App on my phone I get those lines in the log viewer:

2019-08-05 22:51:16.050 [WARN ] [rest.core.item.EnrichedItemDTOMapper] - Failed transforming the state '1' on item 'Pluggit_CurentUnitMode' with pattern 'MAP(Pluggit.map):CurrentUnitMode_%d': Cannot format state '1' to format 'CurrentUnitMode_%d'

2019-08-05 22:51:16.082 [WARN ] [rest.core.item.EnrichedItemDTOMapper] - Failed transforming the state '132' on item 'Pluggit_ActiveUnitMode' with pattern 'MAP(Pluggit.map):ActiveUnitMode_%d': Cannot format state '132' to format 'ActiveUnitMode_%d'

2019-08-05 22:51:16.095 [WARN ] [rest.core.item.EnrichedItemDTOMapper] - Failed transforming the state '4' on item 'Pluggit_SpeedLevelOfFans' with pattern 'MAP(Pluggit.map):SpeedLevelOfFans_%d': Cannot format state '4' to format 'SpeedLevelOfFans_%d'

2019-08-05 22:51:16.110 [WARN ] [rest.core.item.EnrichedItemDTOMapper] - Failed transforming the state '0' on item 'Pluggit_BypassState' with pattern 'MAP(Pluggit.map):CurrentUnitMode_%d': Cannot format state '0' to format 'CurrentUnitMode_%d'

2019-08-05 22:51:16.127 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'Pluggit_FilterTimerReset' for widget org.eclipse.smarthome.model.sitemap.Switch

2019-08-05 22:51:16.133 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'Pluggit_FilterTimerReset' for widget org.eclipse.smarthome.model.sitemap.Switch

2019-08-05 22:51:16.138 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item for widget org.eclipse.smarthome.model.sitemap.Switch

When I open that sitemap in the Basic UI from my PC I get those lines:

2019-08-05 22:53:30.325 [WARN ] [basic.internal.render.SwitchRenderer] - Cannot determine item type of 'Pluggit_FilterTimerReset'

org.eclipse.smarthome.core.items.ItemNotFoundException: Item 'Pluggit_FilterTimerReset' could not be found in the item registry

	at org.eclipse.smarthome.core.internal.items.ItemRegistryImpl.getItem(ItemRegistryImpl.java:79) ~[?:?]

	at org.eclipse.smarthome.ui.internal.items.ItemUIRegistryImpl.getItem(ItemUIRegistryImpl.java:802) ~[?:?]

	at org.eclipse.smarthome.ui.basic.internal.render.SwitchRenderer.renderWidget(SwitchRenderer.java:84) [192:org.eclipse.smarthome.ui.basic:0.10.0.oh240]

	at org.eclipse.smarthome.ui.basic.internal.render.PageRenderer.renderWidget(PageRenderer.java:194) [192:org.eclipse.smarthome.ui.basic:0.10.0.oh240]

	at org.eclipse.smarthome.ui.basic.internal.render.PageRenderer.processChildren(PageRenderer.java:160) [192:org.eclipse.smarthome.ui.basic:0.10.0.oh240]

	at org.eclipse.smarthome.ui.basic.internal.render.PageRenderer.processChildren(PageRenderer.java:181) [192:org.eclipse.smarthome.ui.basic:0.10.0.oh240]

	at org.eclipse.smarthome.ui.basic.internal.render.PageRenderer.processPage(PageRenderer.java:124) [192:org.eclipse.smarthome.ui.basic:0.10.0.oh240]

	at org.eclipse.smarthome.ui.basic.internal.servlet.WebAppServlet.service(WebAppServlet.java:209) [192:org.eclipse.smarthome.ui.basic:0.10.0.oh240]

	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) [29:javax.servlet-api:3.1.0]

	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:865) [85:org.eclipse.jetty.servlet:9.4.11.v20180605]

	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:535) [85:org.eclipse.jetty.servlet:9.4.11.v20180605]

	at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:71) [186:org.ops4j.pax.web.pax-web-jetty:7.2.3]

	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146) [84:org.eclipse.jetty.server:9.4.11.v20180605]

	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548) [82:org.eclipse.jetty.security:9.4.11.v20180605]

	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) [84:org.eclipse.jetty.server:9.4.11.v20180605]

	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257) [84:org.eclipse.jetty.server:9.4.11.v20180605]

	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595) [84:org.eclipse.jetty.server:9.4.11.v20180605]

	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255) [84:org.eclipse.jetty.server:9.4.11.v20180605]

	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1317) [84:org.eclipse.jetty.server:9.4.11.v20180605]

	at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:293) [186:org.ops4j.pax.web.pax-web-jetty:7.2.3]

	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203) [84:org.eclipse.jetty.server:9.4.11.v20180605]

	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473) [85:org.eclipse.jetty.servlet:9.4.11.v20180605]

	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1564) [84:org.eclipse.jetty.server:9.4.11.v20180605]

	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201) [84:org.eclipse.jetty.server:9.4.11.v20180605]

	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1219) [84:org.eclipse.jetty.server:9.4.11.v20180605]

	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144) [84:org.eclipse.jetty.server:9.4.11.v20180605]

	at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:80) [186:org.ops4j.pax.web.pax-web-jetty:7.2.3]

	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) [84:org.eclipse.jetty.server:9.4.11.v20180605]

	at org.eclipse.jetty.server.Server.handle(Server.java:531) [84:org.eclipse.jetty.server:9.4.11.v20180605]

	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:352) [84:org.eclipse.jetty.server:9.4.11.v20180605]

	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:260) [84:org.eclipse.jetty.server:9.4.11.v20180605]

	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:281) [75:org.eclipse.jetty.io:9.4.11.v20180605]

	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:102) [75:org.eclipse.jetty.io:9.4.11.v20180605]

	at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118) [75:org.eclipse.jetty.io:9.4.11.v20180605]

	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333) [87:org.eclipse.jetty.util:9.4.11.v20180605]

	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310) [87:org.eclipse.jetty.util:9.4.11.v20180605]

	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168) [87:org.eclipse.jetty.util:9.4.11.v20180605]

	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126) [87:org.eclipse.jetty.util:9.4.11.v20180605]

	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366) [87:org.eclipse.jetty.util:9.4.11.v20180605]

	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:762) [87:org.eclipse.jetty.util:9.4.11.v20180605]

	at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:680) [87:org.eclipse.jetty.util:9.4.11.v20180605]

	at java.lang.Thread.run(Thread.java:748) [?:?]

2019-08-05 22:53:30.362 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'Pluggit_FilterTimerReset' for widget org.eclipse.smarthome.model.sitemap.Switch

2019-08-05 22:53:30.366 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item for widget org.eclipse.smarthome.model.sitemap.Switch

2019-08-05 22:53:30.370 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'Pluggit_FilterTimerReset' for widget org.eclipse.smarthome.model.sitemap.Switch

2019-08-05 22:53:30.374 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'Pluggit_FilterTimerReset' for widget org.eclipse.smarthome.model.sitemap.Switch

2019-08-05 22:53:30.378 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'Pluggit_FilterTimerReset' for widget org.eclipse.smarthome.model.sitemap.Switch

Can anyone help me figure out how to fix this so I dont see any errors?

Another thing I noticed is that I can switch between Bypass manual and Bypass auto but cannot get the Summer Mode in (only exhausting air).
I got the option in the sitemap and thought I had the right status number set but guess not…

Also the item “Text item=Pluggit_BypassState” in sitemap shows the word “Standby” all the time instead of Open when I know for a fact the Bypass is open (or closed doesnt matter)

greetings
Alkahna

That part is easy enough. There is no Item named that in your items file, but you refer to it in your sitemap.

Okay, let’s look at the Item definition.

Number Pluggit_CurentUnitMode           "Curent Unit Mode [MAP(Pluggit.map):CurrentUnitMode_%d]" ...

The operative part is the state formatter
[MAP(Pluggit.map):CurrentUnitMode_%d]
which I interpret as meaning:
Take the state of this Number Item (which is a number, naturally)
Format that as a decimal number
Prefix with some text “CurrentUnitMode_
Look all that up in a file called Pluggit.map and return the paired string
Then output that string for the UI

I’d guess you don’t actually have a file called Pluggit.map?

Hello Alkahna,

switching the current unit mode is currently a litle bit magic.
I do not really use this feature, so I have not optimize this behavior yet.
You have to select\deselect the summer mode with

Summer Mode Start		**2048**
Summer Mode End			**40169**

Please use the latest version from
https://github.com/Project51At/PluggitAP190/tree/master/OpenHAB

I fixed that issue adding the required item

I would look at this the same way you did but I do have a Pluggit.map file (content’s are in my first post).
So why doesn’t it look up this value? It works fine with all other values defined in that map, just some weird ones are not working…
Opening that sitemap in a browser with the Basic UI gives 0 warning messages in the error log. Only when I use the android app (this one) I see those warnings in the log file.

I put in your code and now I’m down to one warning (only app not basic UI)

[rest.core.item.EnrichedItemDTOMapper] - Failed transforming the state '0' on item 'Pluggit_BypassState' with pattern 'MAP(Pluggit.map):BypassState_%d': Cannot format state '0' to format 'BypassState_%d'

cannot figure out why though… map is there (transform/Pluggit.map) and value 0 is defined so…

Other things:

  • now I cannot switch between manual and auto bypass modes (132 & 4). If I select auto it goes back to manual.

    • with this item instead of the item from your file switching modes works fine again:
Number	Pluggit_ActiveUnitMode	"Modus [MAP(Pluggit.map):ActiveUnitMode_%d]"	 <settings>	(gPluggit)	{modbus="pluggit_prmRamIdxUnitMode:0"}
  • Summer mode (by using 2048 as the value in my sitemap still doenst work

Could you explain why you use a things file? I had modified that modbus.cfg file.

greetings
Alkahna

The technique of prepending text to a value to look up in a common MAP file is unusual. It’s quite possible it doesn’t work properly in the app.
Does it appear to actually work in BasicUI, it’s not clear?

Current Modbus binding v2.x uses things and channels
Obsolete Modbus binding v1.x uses modbus.cfg
You choose which to install.

In Basic UI it works fine its just the App that causes those warnings in the log file.

Ah I see, I will try to get the settings of my modbus file over to a .thing file then.

You should create an issue for the app on Github

You have to change the binding you have installed as well. v1 and v2 will not coexist, It’s a fairly big job, there is conversion advice in the docs

Already saw that formatting and stuff is different. Will try to work with Helge_K’s .thing file as a base and basicly just try to fix the mode switching. Thats the only thing not working with it (cannot test preheater since I don’t have one)

This Binding manages to change modes (at least bypass in auto mode and manual bypass) fine:

tcp.pluggit_prmRamIdxUnitMode.connection="192.168.143.4:502"
tcp.pluggit_prmRamIdxUnitMode.id="1"
tcp.pluggit_prmRamIdxUnitMode.length="1"
tcp.pluggit_prmRamIdxUnitMode.start="168"
tcp.pluggit_prmRamIdxUnitMode.type="holding"
tcp.pluggit_prmRamIdxUnitMode.valuetype="uint16"

Now I’m trying to get it over into the .thing file to work there as well because this (from Helge_K’s Github) doenst switch modes at all:

Bridge poller prmRamIdxUnitMode	[ start=168, length=4, refresh=5000, type="holding" ] {
	Thing data register	[ readStart="168",	readValueType="uint32_swap", writeStart="169",	writeValueType="uint32_swap", writeType="holding" ]
}

Documentation for the Pluggit-Unit is here.
so based on the information above (working section from 1.x binding, docu and not working 2.x binding) and seeing that the value type is UINT (and they use 16bit) I would construct the thing like this;

Bridge poller prmRamIdxUnitMode	[ start=168, length=1, refresh=5000, type="holding" ] {
	Thing data register	[ readStart="168",	readValueType="uint16", writeStart="169",	writeValueType="uint16", writeType="holding" ]
}

but that just causes:

[ERROR] [rt.modbus.internal.ModbusManagerImpl] - Last try 3 failed when executing request (BasicModbusWriteRegisterRequestBlueprint@1b77f49[slaveId=1,reference=169,functionCode=WRITE_SINGLE_REGISTER,registers=ModbusRegisterArrayImpl(00 04),maxTries=3]). Aborting. Error was: net.wimpi.modbus.ModbusSlaveException Error Code = 1 [operation ID dcb98a39-5bb6-4070-8e6d-4bed675ff46d]
[ERROR] [ernal.handler.ModbusDataThingHandler] - Thing modbus:data:PluggitAP310:prmRamIdxUnitMode:register 'Modbus data' had ModbusSlaveErrorResponseExceptionImpl error on write: ModbusSlaveErrorResponseException(error=1)
[hingStatusInfoChangedEvent] - 'modbus:data:PluggitAP310:prmRamIdxUnitMode:register' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR)
- 'modbus:data:PluggitAP310:prmRamIdxUnitMode:register' changed from OFFLINE (COMMUNICATION_ERROR) to ONLINE

in the documentation for the 2.x modbus bindings it doens’t list uint16 as a valid type for writing, how do I overcome that issue when the “target” of that operation is a uint16 field though?

The v1 binding did not support 32-bit writes at all.
Sometimes that could be “faked” by using 16 bit write
I’ve no idea if that was used here.

In the v2 binding, writing uint16 and int16 use exactly the same process, so both options need not be provided, and they aren’t.

The v2 binding does support 32 bit writes, if that’s what is really needed by this device.

The target register address in your 32bit attempt looks wrong, you are reading and writing overlapping but different pairs of registers

I changed the writeStart to 168 already as a test because it seems like its just one register for read and write but no difference.

This is from the documentation of my hvac unit:

For MPCB control the Modbus protocol v 1.1 is used (TCP/IP over Ethernet).

prmRamIdxUnitMode
Registeraddress: 40169
Type: UINT
MAX: 65535
Example: Start Summer Mode: Write 0x0800 (2048) to 40169 prmRamIdxUnitMode.

How would you contrstuct the thing?

Just looked at the PDF doc, isn’t very clear but that’s usual :crazy_face: You play at suck it and see.

My first guess would be to write 169 as a 16 bit int

That does not appear to be a readable register; you’d read mode from register 473
EDIT - I now think the PDF means r/w when it says write

I’m not sure if those are register numbers or addresses, you may need to do the -1 thing.

I tried all the following combinations so far (all without success)

start: 168 & 169
type: int16, int32
length: 1 & 4

Everytime int16 is used I get errors in the log.
Other types results in no errors but mode is not switching.

Will do a little more trying around tomorrow.

Yeh, elsewhere the PDF is fairly consistent in wanting 32-bit write.

This post above looks like your reference

I cannot recall if the binding is smart enough to assert writeMultipleEvenWithSingleRegisterOrCoil when selected type is 32 bit - but I suspect this is the magic you are missing.

with

Thing data register     [ readStart="168",      readValueType="uint16", writeValueType="int32_swap", writeStart="168", writeMultipleEvenWithSingleRegisterOrCoil=true, writeType="holding" ]

it seems to “work” but my problem now is that I can switch back to Manual mode (no bypass) but I cannot switch to any other mode (bypass on / summer)…