This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

w4k fails reading modbus rtu float32
#1
I've a eastron sdm72d modbus meter and I use the following lua code: 
Code:
require('luamodbus')
mb = luamodbus.rtu()

mb:open('/dev/RS485', 9600, 'N', 8, 1, 'H')   -- SDM72 nutzt 8N1
mb:setslave(20)
mb:connect()


local r1, r2 = mb:readinputregisters(70, 2)
local value = mb:readregistervalue(70, "float32")
log(r1, r2, value)


mb:close()

I get the following result:
Code:
* arg: 1
  * number: 16967
* arg: 2
  * number: 57672
* arg: 3
  * number: 0

So in general the code seems to work. Why do I get a 0 for value? 
The modbus register can be found here: https://data.xn--stromzhler-v5a.eu/manua...72dmv2.pdf
Reply
#2
Use mb:readinputregistervalue(). It's highly recommended to use profiles instead of scripts.
Reply


Forum Jump: