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.

modbus device bus_write option modified by scipt
#1
Hi,

I had a script I made to generate lots of modbus counter and map device.

I made a mistake in my scipt and all my variable/GA mapped was with bus_write enable.


So I made a script to modify in DB, table modbus_mapping the bus_write mapped object from 1 to 0

My script worked well. And now when I go editing a modbus device and see mapped object, the checkbox are unchecked. However there is still write object on the bus. I tried to restart without difference. Even on ETS side in monitoring I can see the object writed to the bus.


Is there another process I can do ?
Thanks
-----------
FRANCE SMARTHOME & SMARTBUILDING INTEGRATION
SE ECO EXPERT
Reply
#2
Provide the script that you've used to update the database.
Reply
#3
here

Code:
searchKey='bus_write'
valueSearch='1'
oldValue='1'
newValue='0'
key='bus_write'
mytable='modbus_mapping'


if oldValue =='' then
  querySql="UPDATE "..mytable.." SET "..key.." = "..newValue.." WHERE "..searchKey.." like '%"..valueSearch.."%'"
else
    querySql="UPDATE "..mytable.." SET "..key.." = REPLACE("..key..", '"..oldValue.."', '"..newValue.."') WHERE "..searchKey.." like '%"..valueSearch.."%'" 
end

db:query(querySql)

I precise that after my script, if I go to modbus the write option is disabled on all element
-----------
FRANCE SMARTHOME & SMARTBUILDING INTEGRATION
SE ECO EXPERT
Reply
#4
You have extra quotes around 0, that's why it doesn't work. The query can be simplified: 'update modbus_mapping set bus_write=0'
Reboot after running it.
Reply
#5
ok thank you for helping I will try.
-----------
FRANCE SMARTHOME & SMARTBUILDING INTEGRATION
SE ECO EXPERT
Reply


Forum Jump: