Question about device handler code ownership

If I take someone’s free DTH and modify the code to create a specific DTH for my personal use, is that permitted?


I my opinion, it should be ok but as a courtesy to the developer who’s code you’re using I’d be sure to reference that in comments or somewhere else in the code. That’s what I’ve done, as well as emailing them if they’d made that available

If you read the paragraph of text that’s commented out in the beginning of the code, it usually specifies what terms of use the dev asks users to abide by.


Excellent question. What you are doing is creating a “derivative work.“ Even if it’s for your personal use.

Just because something is freely shared doesn’t mean it’s free for you to use however you want to.

Almost all the DTHs will include a license statement. Most commonly the following:

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at:



Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

So you need to read the license referenced to, in this example Apache 2.0, and follow what it says.

Again, referring to Apache 2.0, you are required to keep the original author’s information in your code.

  1. You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work,

If the original code that you start from doesn’t have a license agreement listed, that doesn’t mean that legally none apply. In that case you should contact the original author and ask them what license they are using when they distribute their code.

But again, most of the DTHs made available to members of this forum will have a license statement in them, so just follow that. :sunglasses:


Thanks to everyone for great replies and information…!!

I was just getting my feet wet with DTH coding, so I thought that I would use a pre-developed DTH for better understanding as I can modify various parts of code and actually see their effect on the module behavior and the app GUI. I will surely obtain permission from the original developer to mess around with his code…

If it’s under the Apache 2.0 license, you can fool around with it as much is you want for your own use, just always leave the original author copyright statements and license listing in the code. Don’t delete it.


Yes, it is under the Apache license. I am not deleting the original header. Just messing around with the code. Thanks for your excellent clarification of the licensing policy. This is the reason I posted in the forum, to get a better perspective from members more experienced than myself.