[SOLVED] Rollershutter via modbus to Wago 750-881

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?

Yes, U are right.. i changed so many in the last view hours, i have overseen that…

I have now following setup:

tings (this Value was written in the Wago SPS as REAL):

Bridge poller inputRegistersRoll [ start=12310, length=6, refresh=5000, type="input" ] {
    Thing data B_Pos [ readStart="12310", readValueType="float32_swap" ]

items:

Number B_Pos    "Büro Pos. [%.0f]" { channel="modbus:data:Wago:inputRegistersRoll:B_Pos:number" }
//String Buero
Rollershutter Rollershutter_buero { channel="modbus:data:Wago:inputRegistersRoll:B_Pos:number", autoupdate="false" }
Switch Buero_up   ["Switchable"] { channel="modbus:data:Wago:coils:Bit44:switch", autoupdate="false" }
Switch Buero_down   ["Switchable"] { channel="modbus:data:Wago:coils:Bit2:switch", autoupdate="false" }

rules:

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

I still get following errors in the Logfiles:

2019-01-10 10:16:02.359 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'modbus.rules' has errors, therefore ignoring it: [18,4]: no viable alternative at input 'updated'

any ideas?

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

OMG! Thats it! Its working now!

I have still so much to learn!

Thank you very very much!

I changed also the Topic to match the issue here better.

1 Like

Rule triggers: