Hey. I’m still new and just learning the system. Now I’m trying to properly configure the modbas on OH2 Windows 10. Next, I plan to transfer all settings to RPI3 and program arduino. Now I use the Epsolar solar controller for the modbass. Already managed to get data through paperui and display in basicui. The problem is that all data must be divided by 100. How to do it correctly? And how to configure OH2 correctly, is it possible to combine a setting through paperui and editing .things files and so on? And, through editing files, I can’t figure out how to configure the modbas
Scroll down to ‘Transformations’ in the docs for a divide-by-10 example
Yes. You’ll probably want to be consistent in some areas to avoid driving yourself mad.
Personally I prefer configuring Modbus with a xxx.things file, but you can use that with PaperUI Items etc.
You said you can already display data. What’s the problem?
Can I use the Transformations setting in Paper UI? Or is it possible only through editing the file? I did not understand how to do this. I also do not understand the correct structure of files and folders in the folder with OH2. For example, where should the modbus.cfg or transform / multiply10.js file be from the example?
But be consistent. Don’t define a Thing in a xxx.things file and then use PaperUI to change it. It will confuse openHAB as well as you, and likely lose any changes at next reboot when the (unaltered) xxx.things file is loaded again.
I think PaperUI does its best to stop you making that mistake.
There is no modbus.cfg with the modbus binding v2.
There are no things and channels with the obsolete modbus binding v1.
You can use either, but not both binding versions.
If you don’t know what you’ve got, it’s probably v2 by default.
Be careful when looking at old forum posts or tutorials about which version they refer to.
That’s not unique to modbus, it’s about transforms in general.
In the conf folder, where you find sub-folders for items, things, etc. you will also find a transform folder.
I found the transform folder. there are two files de.map and en.map almost empty. Do I need to create a new transform / divide10.js file here? If I configure via PaperUI, then the files will be empty. Probably I need to go completely to the setting through the files so that there are no errors and confusion. I am using modbus binding v2. Where can I find examples of settings for modbus RTU? Thanks for the help, in the head porridge
The transform folder is the place to put any kind of transform, because that is where openHAB looks for transforms.
A couple of MAP type transforms are provided as examples.
If you want to create a new JS type transform, thats obviously the place to put it.
If you were making what you asked for, you could call it divide100.js for example, but its up to you. banana.js will work just as well, but the .js part is important for the type.
This is really just a text file, it’s up to you what you would prefer to use to edit content into it. I’ve no idea if you can use PaperUI to edit text files, I doubt it. What do you use for a simple text editor usually?
For examples of modbus RTU setups, you could look at the actual documentation for this binding.
This forum has a good search feature too, use those keywords.
I’m confused why we’re worrying about divide by 100 if you don’t have basic modbus working?
Well, I guess that means “I do have modbus working”,
Let us know if you want more help.
Yes, modbus is work, but I setting it only in PaperUI, and now that I can use transform I need learn how configure OH2 in files…I use text editor “Visio Studio Code”. I don’t find examples for Modbus v.2, but offen I finded example only modbus v1
here is I finded examples only modbus TCP
You don’t have to. If you are happy using PaperUI, all you have to do is configure your data Thing readTransform parameter to point to your js filename.
PaperUI method and xxx.things file method set exactly the same parameters in your Things. See
A poller Thing is a poller Thing.
A data Thing is a data Thing.
Whether the bridge Thing that owns them is TCP or RTU makes no difference at all to them.
You set up a serial bridge Thing for RTU or a tcp bridge Thing for TCP.
Which part of setting up a serial bridge Thing are you having trouble with?
I searched this forum for an example of modbus serial Thing, here’s one
Thank you very much!Now it is working!
I setup it in text redactor and I understood it. When I has written files .things, .items, sitemap I saw all it in PaperUI. And I fully worked after I choose channel in PaperUI. Look
After I will learn other type data and also written data in modbus. Sorry for my English, I’m from Russia. By the way site Openhab don’t work in Russia, I need use VPN for it
Well. I communicated OH with Epsolar in modbus and this work good. How I want communicate arduino with OH. I create scetch as arduino slave and I ran OPC modbus programm in my PC and I recieve data from modbus. But I can’t recieve this data in OH. I use the same settings as OPC modbus programm
I guess this Arduino is serial, and that the PC that works is not the box running openHAB.
So there is different RS485 wiring - take care with those +/- or A/B wires, it’ll only work one way round and not all manufacturers agree which is which. Swap it and see, it does no harm.
Maybe your openHAB settings are different to the PC - we can’t tell from here. As you already have a serial setup, make sure your Arduino uses the same serial settings as the solar thingy. You cannot successfully have devices with different baud or parity on the same wired bus.
When you have several devices or a longer wiring run, you must take care to terminate the RS485 wired bus properly. A 120R resistor at each end usually.
Well. I use OH in PC. Arduino I connected with PC USB cable and I see Arduino as COM port in PC. I disconnected Epsolar and I connect only arduino in PC. In OPC modbus programm I set ID, boud rate, number COM port and etc…And this setting I used in OH…I know about RS-485…May be I need use this connection like arduino-RS-485/RS-485-USB-PC or I need will try serial thing for OH…
I’m not sure what you mean there.
If you want help with openHAB, you’re going to have to share your setup details and things like messages in openhab.log