I’ve been attempting to follow the getting started documentation and install all my things and items from scratch.
But after today I’m starting to think OH3 can use many of the textual config files I’ve spent years working on. Is there a list of config files from OH3 that can be moved straight over to OH3? I’ve seen the list of changes and things it could break but that lead me down a path that I now discovered isn’t true.
If there’s an equivalent folder in OH3 (e.g. items, rules, etc.), then you can move your OH2 config files into it. As you noted, beware of the breaking changes (particularly for rules).
The main breaking changes from a text file perspective have to do with time and date. The underlying libraries changed. The other change is that expire is now a core feature but the text file syntax should function.
I actually haven’t used the model. I might try it when I have more time, but I mostly interact with OH through voice, so I don’t have a lot of need for graphical UIs. As a result, my old sitemap is good enough.
I did my migration entirely with text files and it worked fine.
You’ll need to reconfigure anything that was using a v1 binding (assuming there’s an OH3 version).
If you’ve configured your bindings, transformations, UIs etc in /services/addons.conf then it’s even easier.
I’ve not tried reusing the old UID and secret. When I’ve reinstalled, I’ve copied the new UID and secret to OpenHAB cloud but in that case it does take a while to become active.
Many of my items were using http commands but they don’t work. I have the HTTP add on installed but I can’t figure out how to pass the command like this in OH3.
Here is my item from OH2
There was never an official release of a HTTP binding for OH2, just test candidates linked from a forum thread, which then turned into the OH3 binding.
@rmhoutz you were using the OH1 binding in OH2, as your syntax shows. You will need to convert all you HTTP Items to use the Thing-Channel-Item model that the OH3 binding supports, as the OH1 binding no longer works.
The HTTP Binding documentation page unfortunately does not provide any text configuration examples, but there are a few threads in the forum with examples. I would suggest using the UI first to get used to all the options, then transferring to text files afterwards.
Hi @hafniumzinc
Thanks for all the info. I never thought I’d say this because I’m a PC tech but I’m starting to miss text configuration files. If I’m not mistaken the OH1 HTTP Item as shown in my example now needs the following in OH3
1 Item
2 Things
3 Channels
I need 2 Things configured one for the http relay command and one to receive the MQTT relay state.
My device running ESPEasy sends it’s state via MQTT.
And my HTTP Thing needs 2 Channels because they the UI only allows for 1 URL Extension.
In this image I attempted to use 1 channel leaving the 1 off the command URL extension hoping the On and Off value would fill in but it didn’t work that way.
So this single Item also took care of the MQTT stuff?! I’m not sure it does, so no, you don’t need everything you’ve described to replace your old Item.
You can definitely do it with a single Channel. Check the very end of the HTTP Binding documentation on how to forward commands in the URL.
No I did have to create a MQTT thing in OH2 to receive the MQTT State message.
I think I’m getting closer to figuring out the HTTP thing in OH3 but I have another question.
When I put this URL in a Web Browser http://192.168.2.60/control?cmd=GPIO,12,1
the device will turn on and return this info.
Is that a json response?
When setting up a new thing in OH3 If advanced is selected I have the option to select Command Method and Content Type. Should I select application/json or text/html or text/plain? I’m assuming Post is the correct command method because it was in my old HTTP command.
Thanks again for all your help in info.
I do apologize I realize many of these questions are a no brainer to a programmer but I have no programming background.
Based on this it sounds like you can use a more simple GET rather than a POST? If so, I’ve tried to guess at what might work for you - see if the following traditional configurations work:
Switch sBasementLED "Basement LED switch" { channel="http:url:BasementLEDs:switch" }
This Thing, in theory, should be able to both command and capture the state (from the JSON response) after you have sent the command, though this might not be ideal depending on how quickly the device updates. Also, I have no idea how to prevent the binding from polling periodically, so if you have a URL that you can send to the device which only gets the device’s state (rather than sends a command), you could use that in the stateExtension parameter so that the polling is actually useful.
Question: if you have MQTT already setup for this ESP device, why not use MQTT to command it too?
I could probably write a book on how my system ended up being configured the way it is. But the short answer is everything responds much faster to commands when I use HTTP commands and MQTT for status updates.
I have configured the devices to use MQTT commands in the past and tested it more recently but the delay was such that I would hit the button again thinking something went wrong.
I’ll have to get back to you on trying the thing and item configured like that but I’ll keep you posted.
Well it works a little. The lights do turn on and off when I click the switch in the UI sometimes.
And I see the on off command in the log but I’m getting lots of warning in the log too and the items don’t always update.