I don’t know anything about Modbus, but isn’t “Modbus Data_relay_1_806” the label of the thing in your screen shots? I.e. you should do something like “Relay_1.sendCommand(1)”.
Also, the item seems to be of type number, mabe toggle only works with switch?
why are you using a number for a coil ? your item wich you want to send the command is ModbusDatarelay1806_ValueasNumber so that means
this Data_relay_1_806.sendCommand(1) becomens ModbusDatarelay1806_ValueasNumber.sendCommand(1)
You need to review some openHAB basic principles. You interact with Items in rules or the UI. You may link Items to channels of Things.
Modbus binding provides switch type channels, which can be linked to Switch type Items, and this sounds like a more useful way to represent your relay.
It’s working. I can see if I will change a relay state in other software.
But now I want change a relay state in openhab. So I need a write on the register address 806 a value 0 or 1.
I tried via rule - sendCommand but it isn’t working.
sendCommand works with Items.
sendCommand does not work with channels or Things.
To make this work, you need -
A modbus TCP Thing, with details of your device.
A modbus poller Thing, with details of what registers to read.
A modbus data Thing, with details on particular register.
The modbus data Thing provides a number of channels to choose from, like number type. You’d probably want the switch type here.
You’d link your chosen channel to an Item of suitable type.
You’ve already got a Switch type Item called Relay_1, but it is linked to number type channel so it is not going to work very well.
Choose switch or number, and stay with it.
When you have your Item, you can use it in rules or UI widgets.
That’s up to you. You’ll have to use UI widgets that work with numbers, too.
Okay, so you have now changed the type of Item named Relay_1. This change can be problematic, I suggest a re-boot of openHAB to make sure everyone thinks it is the same type. But look into this first as well …
Your data Thing has no write settings, it is a read-only Thing. You should be able to send numeric commands to the Item, but the Modbus binding will not do anything about them.
You’ll want to add write address, type, etc.
Can’t see what you are doing, not able to comment.
Of course nor, everything we guess here is based on what you tell us or show us. If you don’t show trhe write settings when you have a write problem, then we will guess that you have not set any.
Okay we can see a little more.
Are you sure you want a holding register type?
Are you sure your device wants FC6, not FC16 Modbus write command?
What do you get in your log when you attempt to command from a rule?
I don’t see how a toggle widget can do anything useful to your Number type Item.
So I was directy by device because it was realy strange.
Let me say, error was in second sw which I used for evaluation. Don’t know why, status wasn’t updated.
So last setup with switch is working, so I can manualy switch on and off
Now my second question is how to change switch status via rule ?