[SOLVED] Rollershutter via modbus to Wago 750-881

That’s odd, something to do with your binding config I guess. I don’t know sorry.
The rule works. You need a modbus expert.

I dont know if it would change anything, I´m no modbus expert. But first look I Noticed the length=43. Shouldn´t it be length=44 ? You have set up 44 adresses, but only read 43.

shame on me! i found a typo in my config… :wink:
it was a paste&copy error…

Yes you are right… but it worked with the normal switches… but i changed it to 44 now…

It is working now, but not completly.

Now i have the items Rollershutter_up and Rollershutter_down.

Via Rules i am matching UP to bit2 and DOWN to bit44. (like physical Switches in my house)
If i press Rauf (=UP) or Runter (=DOWN) this bits are set to True in the SPS.

How can i implement that UP or DOWN are going to “OFF” after 250ms?
The “STOP” Button is not nessesary, (I will delete this binding later on) because if the state is set to OFF after 250ms then a second press to UP or Down will stop the rullershutter. (logic in the Wago SPS)

Also it seems that the position of the rollershutter is going directly from 100 to 0 and back in one step… is it possible to write the actual status of the shutter to the rollershuter item? (buero_pos have the real position of the shutter)

250ms or 1s will do. Because there are different answers depending on the timing required

max. 250ms because a longer “press” on the physical or virtual button will be identified as a long press. 150ms is also ok. :wink:

Ok:

A rule

rule "reset rollershutter commands"
when
    Item Rollershutter_buero_up received command ON or
    Item Rollershutter_buero_down received command ON
then
    createTimer(now.plusMillis(250), [ |
        triggeringItem.postUpdate(OFF)
    ])
end

i implented your rule but i didn´t put it to OFF.

The OFF commando itself would be working because is see it when i press the “X” (STOP) of the Switch.

With “UP” i set Rollershutter_up to ON and with Stop is set Rollershutter_up to OFF and i see it in the SPS that the Flag is going from true to false when i press stop “X”.

Switch item=Rollershutter_buero label="Büro Rollo" icon="rollershutter-30" mappings=[UP="Hoch", STOP="X", DOWN="Runter"]
Rule "Buero Rollershutter"
when
    Item Rollershutter_buero received command
then
    switch (receivedCommand){
        case UP: {
            Rollershutter_buero_up.sendCommand(ON) // channel="modbus:data:Wago:coils:Bit44:switch"
        }
        case STOP: {
           Rollershutter_buero_up.sendCommand(OFF) // channel="modbus:data:Wago:coils:Bit44:switch"
        }
        case DOWN: {
           Rollershutter_buero_down.sendCommand(ON) // channel="modbus:data:Wago:coils:Bit2:switch"
        }      
    }
end```

Can I see the log, please?

2019-01-07 15:00:22.610 [ome.event.ItemCommandEvent] - Item 'Rollershutter_buero' received command DOWN
2019-01-07 15:00:22.625 [vent.ItemStateChangedEvent] - Rollershutter_buero changed from 0 to 100
2019-01-07 15:00:22.655 [ome.event.ItemCommandEvent] - Item 'Rollershutter_buero_down' received command ON
2019-01-07 15:00:23.273 [vent.ItemStateChangedEvent] - Rollershutter_buero_down changed from 0 to 100
2019-01-07 15:01:04.607 [vent.ItemStateChangedEvent] - Rollershutter_buero_down changed from 100 to 0

Ok, add some debug log:

rule "reset rollershutter commands"
when
    Item Rollershutter_buero_up received command ON or
    Item Rollershutter_buero_down received command ON
then
    logInfo("STARTING TIMER :", triggeringItem.name.toString)
    createTimer(now.plusMillis(250), [ |
        logInfo("TIMER EXECUTE", triggeringItem.name.toString)
        triggeringItem.postUpdate(OFF)
    ])
end

Try that and post the logs

ok… it seems that the timer is not triggered because there is no log for it.

2019-01-07 15:10:57.930 [ome.event.ItemCommandEvent] - Item 'Rollershutter_buero' received command DOWN
2019-01-07 15:10:57.938 [vent.ItemStateChangedEvent] - Rollershutter_buero changed from 0 to 100
2019-01-07 15:10:57.950 [ome.event.ItemCommandEvent] - Item 'Rollershutter_buero_down' received command ON
2019-01-07 15:11:02.811 [vent.ItemStateChangedEvent] - Rollershutter_buero_down changed from 0 to 100
2019-01-07 15:11:03.039 [vent.ItemStateChangedEvent] - Buero_Pos changed from 0.0 to 18.823530197143555
2019-01-07 15:11:08.192 [vent.ItemStateChangedEvent] - Buero_Pos changed from 18.823530197143555 to 40.0
2019-01-07 15:11:13.359 [vent.ItemStateChangedEvent] - Buero_Pos changed from 40.0 to 61.960784912109375
2019-01-07 15:11:18.567 [vent.ItemStateChangedEvent] - Buero_Pos changed from 61.960784912109375 to 83.52941131591797
2019-01-07 15:11:23.711 [vent.ItemStateChangedEvent] - Buero_Pos changed from 83.52941131591797 to 100.0
2019-01-07 15:11:38.866 [vent.ItemStateChangedEvent] - Rollershutter_buero_down changed from 100 to 0

Change the items:

Switch Rollershutter_buero_up   ["Switchable"] { channel="modbus:data:Wago:coils:Bit44:switch" }
Switch Rollershutter_buero_down   ["Switchable"] { channel="modbus:data:Wago:coils:Bit42:switch" }

You also need to look at the openhab.log not only the events.log

i am looking on the webinterface http://openhabianip:9001 - i thought there are both visible?

ok… i changed both items from “Rollershutter” to “Switch”

2019-01-07 15:23:45.829 [ome.event.ItemCommandEvent] - Item 'Rollershutter_buero' received command DOWN
2019-01-07 15:23:45.843 [vent.ItemStateChangedEvent] - Rollershutter_buero changed from 0 to 100
2019-01-07 15:23:45.872 [ome.event.ItemCommandEvent] - Item 'Rollershutter_buero_down' received command ON
2019-01-07 15:23:45.882 [nt.ItemStatePredictedEvent] - Rollershutter_buero_down predicted to become ON
2019-01-07 15:23:45.897 [vent.ItemStateChangedEvent] - Rollershutter_buero_down changed from OFF to ON
2019-01-07 15:23:45.899 [INFO ] [rthome.model.script.STARTING TIMER :] - Rollershutter_buero_down
2019-01-07 15:23:46.156 [INFO ] [smarthome.model.script.TIMER EXECUTE] - Rollershutter_buero_down
2019-01-07 15:23:46.168 [vent.ItemStateChangedEvent] - Rollershutter_buero_down changed from ON to OFF
2019-01-07 15:23:46.358 [vent.ItemStateChangedEvent] - Rollershutter_buero_down changed from OFF to ON
2019-01-07 15:23:51.666 [vent.ItemStateChangedEvent] - Buero_Pos changed from 0.0 to 21.568628311157227
2019-01-07 15:23:56.914 [vent.ItemStateChangedEvent] - Buero_Pos changed from 21.568628311157227 to 43.52941131591797
2019-01-07 15:24:02.041 [vent.ItemStateChangedEvent] - Buero_Pos changed from 43.52941131591797 to 65.09803771972656
2019-01-07 15:24:07.192 [vent.ItemStateChangedEvent] - Buero_Pos changed from 65.09803771972656 to 86.66667175292969
2019-01-07 15:24:12.367 [vent.ItemStateChangedEvent] - Buero_Pos changed from 86.66667175292969 to 100.0

now the timer is triggered… it turns it to off and after some milliseconds back to on?

???
Don’t know
It’s doing what it’s supposed to do

Yes. What value does it take, OH wants a 0-100% for rollershutters, so you might need to scale it.

Is this the B_Pos modbus data thing? You should be able to link that channel directly to your Rollershutter_buero Item. Also use autoupdate="false" to prevent commands messing it up.

Hi!

Thank you all for your help!

I´ve added now autoupdate=“false” but it don´t change anything…

item:

Rollershutter Rollershutter_buero
Switch Rollershutter_buero_up   ["Switchable"] { channel="modbus:data:Wago:coils:Bit44:switch", autoupdate="false" }
Switch Rollershutter_buero_down   ["Switchable"] { channel="modbus:data:Wago:coils:Bit2:switch", autoupdate="false" }

Here the Log when i press “Runter” (Down)

2019-01-09 08:34:40.948 [ome.event.ItemCommandEvent] - Item 'Rollershutter_buero' received command DOWN
2019-01-09 08:34:40.955 [vent.ItemStateChangedEvent] - Rollershutter_buero changed from 0.0 to 100
2019-01-09 08:34:40.981 [ome.event.ItemCommandEvent] - Item 'Rollershutter_buero_down' received command ON
2019-01-09 08:34:41.005 [INFO ] [rthome.model.script.STARTING TIMER :] - Rollershutter_buero_down
2019-01-09 08:34:41.416 [INFO ] [smarthome.model.script.TIMER EXECUTE] - Rollershutter_buero_down
2019-01-09 08:34:45.601 [vent.ItemStateChangedEvent] - Rollershutter_buero_down changed from OFF to ON
2019-01-09 08:34:45.833 [vent.ItemStateChangedEvent] - Buero_Pos changed from 0.0 to 17.647058486938477
2019-01-09 08:34:50.934 [vent.ItemStateChangedEvent] - Buero_Pos changed from 17.647058486938477 to 38.82352828979492
2019-01-09 08:34:56.076 [vent.ItemStateChangedEvent] - Buero_Pos changed from 38.82352828979492 to 60.39215850830078
2019-01-09 08:35:01.231 [vent.ItemStateChangedEvent] - Buero_Pos changed from 60.39215850830078 to 81.96078491210938
2019-01-09 08:35:06.301 [vent.ItemStateChangedEvent] - Buero_Pos changed from 81.96078491210938 to 100.0

ok… i found the failure…

In the rule vzorglub suggested he wrote:

rule "reset rollershutter commands"
when
    Item Rollershutter_buero_up received command ON or
    Item Rollershutter_buero_down received command ON
then
    logInfo("STARTING TIMER :", triggeringItem.name.toString)
    createTimer(now.plusMillis(250), [ |
        logInfo("TIMER EXECUTE", triggeringItem.name.toString)
        triggeringItem.postUpdate(OFF)
    ])
end

triggeringItem.postUpdate(OFF)

I changed this entry to triggeringItem.sendCommand(OFF)

rule "reset rollershutter commands"
when
    Item Rollershutter_buero_up received command ON or
    Item Rollershutter_buero_down received command ON
then
    logInfo("STARTING TIMER :", triggeringItem.name.toString)
    createTimer(now.plusMillis(250), [ |
        logInfo("TIMER EXECUTE", triggeringItem.name.toString)
        //triggeringItem.postUpdate(OFF)
        triggeringItem.sendCommand(OFF)
    ])
end

now it turns correctly to false in my Wago SPS!

but one thing is open now… i tried to integrate the Buero_pos (status of my rollershutter) to the item Rollershutter_buero like this:

Rollershutter Rollershutter_buero { channel="modbus:data:Wago:inputRegistersRoll:B_Pos:number" }

now i get following errors in the logfile:

2019-01-09 10:35:03.808 [ome.event.ItemCommandEvent] - Item 'Rollershutter_buero' received command DOWN
2019-01-09 10:35:03.821 [nt.ItemStatePredictedEvent] - Rollershutter_buero predicted to become DOWN
2019-01-09 10:35:03.832 [vent.ItemStateChangedEvent] - Rollershutter_buero changed from 0.0 to 100
2019-01-09 10:35:03.850 [ome.event.ItemCommandEvent] - Item 'Rollershutter_buero_down' received command ON
==> /var/log/openhab2/openhab.log <==
2019-01-09 10:35:03.897 [INFO ] [rthome.model.script.STARTING TIMER :] - Rollershutter_buero_down
2019-01-09 10:35:04.153 [INFO ] [smarthome.model.script.TIMER EXECUTE] - Rollershutter_buero_down
==> /var/log/openhab2/events.log <==
2019-01-09 10:35:04.163 [ome.event.ItemCommandEvent] - Item 'Rollershutter_buero_down' received command OFF
==> /var/log/openhab2/openhab.log <==
2019-01-09 10:35:08.005 [WARN ] [ernal.handler.ModbusDataThingHandler] - Error updating state '14.901961326599121' (type org.eclipse.smarthome.core.library.types.DecimalType) to channel modbus:data:Wago:inputRegistersRoll:B_Pos:number: java.lang.IllegalArgumentException Value must be between 0 and 100
==> /var/log/openhab2/events.log <==
2019-01-09 10:35:08.011 [vent.ItemStateChangedEvent] - Buero_Pos changed from 0.0 to 14.901961326599121

Is this the correct way to integrate the Buero_Pos to the Rollershutter?

Add autoupdate="false" to Rollershutter_buero to make that go away.

As I said, you may have to do some scaling of shutter position to fit into an openHAB Rollershutter Item type, That expects a value between 0-100.

Looking at your logs from earlier, Beuro_Pos is taking values 0-100 , and 100 appears to mean “down”. All good so far.

But it fails!

My guess is that the OH Rollershutter Item wants its 0-100 value as an Integer.
Maybe that’s a change you can make in the Wago ?
Or you can use a javascript transform to do that neatly.

Or just to try it out -
(remove the modbus binding from Rollershutter_buero for this test)

rule "copy shutter position"
when
   Item Buero_pos updated
then
   Rollershutter_buero.postUpdate( ((Buero_pos.state) as Number).intValue )
end

ok… i added autoupdate=“false” to Rollershutter_buero!

I´ve added the rule you mentioned and i get following error in the logfile.

2019-01-09 14:07:19.581 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'modbus.rules' has errors, therefore ignoring it: [17,4]: no viable alternative at input 'updated'

This is the line “Item Buero_pos updated” of the rule

Okay, so your Item is Buero_Pos instead?