Hello !
I’ve been using OpenHistorian for a couple months now, and I’m really impressed with what is done. I’m starting to be interested in going slightly deeper in the architecture but don’t want to break everything.
I would like to add quickly new tags Modbus TCP input devices. I already have a bit of code to create the json files, but I wonder if I can bypass that and directly modify the OpenHistorian.db configuration to :
1 - Create a new device : I saw you have a ‘Device_InsertDefault’ trigger in sqlite which seems rather simple : are there any other specific bases I need to update for the device to work ?
2 - Create new tags : Same idea : if I simply add a measurement tag with the correct DeviceId, will the server automatically create all it needs ?
Thanks in advance !
Best regards
Hello again !
I worked on a way to add devices and measurements massively to the SQLite Configuration file. I then try to either use the configuration setup utility or simply restart the service, but it seems the modbus client doesn’t detect that I added a new device. Here are a few screenshots with a device I added manually (device111) and a few devices I added with my code :

Here are the connection strings :
Device111 (which works) :
hostName=127.0.0.1; port=502; frameFormat=TCP; transport=TCP; unitID=1; pollingRate=750; interSequenceGroupPollDelay=250; sequenceCount=1; sequence0={sequenceType=Read; groupCount=1; groupType0=HR; groupStartAddress0=12300; groupPointCount0=113; derivedCount=32}
Device1 (Doesn’t work)
hostName=127.0.0.1; port=502; frameFormat=TCP; transport=TCP; unitID=1; pollingRate=750; interSequenceGroupPollDelay=250; sequenceCount=1; sequence0={sequenceType=Read; groupCount=1; groupType0=HR; groupStartAddress0=12300; groupPointCount0=113; derivedCount=32}
When I’m in the device manager page and I ‘connect’ using the button, I can see the current values and the Read/Write Number incrementing, but not on the ‘current device status’ page.
Here’s what I tried :
Initializing the Device
changing Historian and reverting back
Adding Measurement ‘the normal way’ without passing by my code
Comparing both lines of the OpenHistorian configuration : they have exactly the same values
Looking in the wwwroot files to see what script you launch when there’s a click on the “save device” button
Plenty of other unfruitful stuff 
My thought is that the Modbus TCP client needs to be initialized with the connection string at some point and to link the input to the OH server. I don’t know if my method doesn’t properly add the device or if I need to create that link to the OH server : could you give me more info ?
If you wish, I can provide the SQLite configuration. My version is 2.7.265.0
Thanks in advance !
Best regards
Are you manually creating the measurements too? These will need to be associated with your new device, plus there is some special formatting to map a measurement to the Modbus values - look at some of the measurements that were created associated with working device.
On easy way to examine existing measurements is to simply go to the “Metadata > Measurements” menu item in the openHistorian Manager (UI app not on the web).
Thanks!
Ritchie
Hello !
Wow, impressive response time 
Yes, the code I use to ‘automatically’ generate the measurements also create json files : that’s how I added the measurements to Device111.
Basically, I tried :
- adding both Device and Measurements by editing the SQLite db → doesn’t work
- adding a device through SQLite and adding measurements through Json files → doesn’t work
- adding a device manually and adding measurements through Json files → works
I concluded that the issue is when I create my device.
Here are measurements info :
Device 111 :
Device 1 :
I first didn’t have the initial ‘DEVICE1’ prefix to the description : still no luck though.
A few questions :
I notice the Measurements you add are done so filtered : first the HR variables, then the DV : do they have to be that way ?
I also notice that you don’t automatically ‘Enable’ the HR that are just used for the Derived Variables : do they also have to be that way ?
I’ll try anyways to work in both those directions, but I’d love to have your input to save me some time 
Thanks again for your reactivity !
Best regards
Hello again,
First of all thank you, your response was very useful
Secondly, I’m sorry : I’ve figured it out (so to answer my previous questions : no and no, there is no need for neither : no need to filter or ‘Enable’ anything). I forgot a pesky “!” between the DV and the registers. A quick update, restart and I’m logging countless registers.
Thanks again,
Best regards
Very good. I was going to point out the measurement wasn’t set to “Enabled” in the second picture which it will need to be in order to get archived, etc. - but glad it’s all working for you.
Thanks,
Ritchie