{"action":"opened","issue":{"url":"https://api.github.com/repos/openhab/openhab/issues/4890","repository_url":"https://api.github.com/repos/openhab/openhab","labels_url":"https://api.github.com/repos/openhab/openhab/issues/4890/labels{/name}","comments_url":"https://api.github.com/repos/openhab/openhab/issues/4890/comments","events_url":"https://api.github.com/repos/openhab/openhab/issues/4890/events","html_url":"https://github.com/openhab/openhab/issues/4890","id":194966114,"number":4890,"title":"[MODBUS] Wago and Modbus mapping","user":{"login":"BrutalBirdie","id":20840012,"avatar_url":"https://avatars.githubusercontent.com/u/20840012?v=3","gravatar_id":"","url":"https://api.github.com/users/BrutalBirdie","html_url":"https://github.com/BrutalBirdie","followers_url":"https://api.github.com/users/BrutalBirdie/followers","following_url":"https://api.github.com/users/BrutalBirdie/following{/other_user}","gists_url":"https://api.github.com/users/BrutalBirdie/gists{/gist_id}","starred_url":"https://api.github.com/users/BrutalBirdie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BrutalBirdie/subscriptions","organizations_url":"https://api.github.com/users/BrutalBirdie/orgs","repos_url":"https://api.github.com/users/BrutalBirdie/repos","events_url":"https://api.github.com/users/BrutalBirdie/events{/privacy}","received_events_url":"https://api.github.com/users/BrutalBirdie/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-12-12T12:47:42Z","updated_at":"2016-12-12T12:47:42Z","closed_at":null,"body":"## My Problem\r\nWelcome and thanks ahead for your time.\r\nI am trying to access my Wago controller via Modbus only for reading values and status. (No the Wago Binding does not suit as a solution for my Problem)\r\nThe Modbus binding gives me sometimes wrong or crazy values.\r\nBut with some items perfect results.\r\nMy Technician gave me the Wago Absolute Addresses which I have to calculate into Modbus Addresses.\r\n\r\n### Some Examples\r\n\r\nIP | Modbus | Data Type | Item Type \r\nX | %MX10.0 | BOOL | DI \r\nX | %MX10.1 | BOOL | DI\r\nX | %MD200 | REAL | AI\r\nX | %MX20.0 | BOOL | DO\r\nX | %MW50 | WORD | AI\r\n\r\n## Wago Absolute Address to Modbus Address calculation \r\n%MX10.0\r\n% Start a Absolute Address\r\nM is a Flag\r\nX is Bit operator\r\n10 the Word number to read\r\n.0 the Bit to read\r\n\r\nAfter reading the Wago 750-880 Manual multiple times I understood the calculation as followed ( EN Page 265 and EN Page 101)\r\n| Modbus Address | IEC 61131 Address |\r\n12288 ...24575 | %MW0 ...%MW12287 \r\nThe bit number can be determined using the following equation:\r\nBit No. = (word * 16) + Bit No. in word\r\n#### Example for %MX10.0\r\n Bit No. = (10 * 16) + 0 = 160\r\nWith my understanding I need to add the 160 to the Offset 12288 giving the Modbus Address 12448\r\n\r\n#### Example for %MD200\r\nAfter talking to my Wago Technician he told me I need to multiply the 200 * 2 and add it to the Offset\r\n400 + 12288 = 12688\r\n\r\n#### Example for %MW50\r\nWago Technician said simple add the Word to the Offset which\r\n50 + 12288 = 12338\r\n\r\n\r\n\r\n### openhab.cfg\r\n#### %MX10 mapping\r\n`modbus:tcp.slaveMX10.connection=X`\r\n `modbus:tcp.slaveMX10.type=discrete`\r\n `modbus:tcp.slaveMX10.start=12488`\r\n `modbus:tcp.slaveMX10.length=2`\r\n `modbus:tcp.slaveMX10.valuetype=bit`\r\nWhy length=2? Because of the second item %MX10.1\r\n#### %MD200 mapping\r\n`modbus:tcp.slaveMD200.connection=X`\r\n `modbus:tcp.slaveMD200.type=input`\r\n `modbus:tcp.slaveMD200.start=12688`\r\n `modbus:tcp.slaveMD200.length=2`\r\n `modbus:tcp.slaveMD200.valuetype=float32`\r\n#### %MW50 Mapping  !THIS WORKS PERFECT!\r\n`modbus:tcp.slaveMW50.connection=X`\r\n`modbus:tcp.slaveMW50.type=input`\r\n`modbus:tcp.slaveMW50.start=12338`\r\n`modbus:tcp.slaveMW50.length=1`\r\n`modbus:tcp.slaveMW50.valuetype=int16`\r\n\r\n### openhab.items\r\n#### %MX10 and %MX10.1\r\n`Switch slaveMX10 \"Signal  [%s]\" (test) {modbus=\"slaveMX10:0\"}`\r\n`Switch slaveMX101 \"Signal 2  [%s]\" (test) {modbus=\"slaveMX10:1\"}`\r\n#### %MD200\r\n`Number slaveMD200 \"Valuue L1 [%f]\" (test) {modbus=\"slaveMD200:0\"}`\r\n#### %MW50\r\nNumber slaveMW50 \" Value 2 [%d]\" (test) {modbus=\"slaveMW50155:0\"}\r\n### openhab.sitemap (yes I only want text no real switches)\r\n`Text item=slaveMX10`\r\n`Text item=slaveMX101`\r\n`Text item=slaveMD200`\r\n`Text item=slaveMW50`\r\n\r\n## Now the troublemakers\r\nThe slaveMX10 gives me a correct response \r\nThe slaveMX101 give me a wrong response \r\nThe slaveMD200 gives me CRAZY values\r\nThe slaveMW50 gives me perfect values\r\n\r\nI got real problems reading the REAL values and map the Bit operators correctly.\r\nIf someone understands my clusterfuck of Informations, please give me some Ideas.\r\nI summon you @ssalonen thanks ahead.\r\n\r\n\r\n\r\n## My Environment and Documents\r\n<!--- Include as many relevant details about the environment you experienced the bug in -->\r\n* Version used: org.openhab.binding.modbus-1.8.3.jarm\r\n* [Wago 750-880 EN](http://www.wago.com/wagoweb/documentation/750/eng_manu/coupler_controller/m07500880_xxxxxxxx_0en.pdf)\r\n* [Wago 750-880 DE](http://www.wago.com/wagoweb/documentation/750/ger_manu/coupler_controller/m07500880_xxxxxxxx_0de.pdf)\r\n\r\n"}}
{"actor":{"display_login":"BrutalBirdie"}}