Hi guys, just registered here because I’m close to a total breakdown
My situation:
I got a Raspberry 3 running with debian and the newest version of OpenHub2.1. Amazon Echo/Alexa is waiting for commands and already equipped with the OH-skill. In the bedroom, there is a Broadlink RMPro, which should control the whole bedroom TV/Hi-fi stuff. I got a running MyOpenHab-account already linked to my OH. And now there are some problems I have with this whole setup
What does work:
I am able to send and save IR-commands to the RMPro (Done with some help I found on the internet). These IR commands can be triggered by a pythonscript from the RPB and do fire from the RMPro. F.e.: I can switch on the bedroom TV by executing that special saved python script. RMPro fires instantly - TV turns on.
I am able to integrate this in OH2 (paperUI) by adding a new thing (Bedroom TV) via EXEC-binding, and creating a new connection in the “Running channel”, namely a switch. The python command to turn on the TV is added in the “command” field of the bedroom TV:
“python /smarthome/BlackBeanControl-master/BlackBeanControl.py -c SchlafzimmerFernseherAnAus [-d General]”. This does work. When I click on the switch (no matter if done on the web interface or on the OH-app on my smart phone) - the RMPro fires the IR-code and the TV turns on.
After broadcasting my items to myopenhab and adding tags via the REST API, Alexa is able to find the switch. Turning the TV on and off does work by saying: “Alexa, turn on the bedroom TV”.
What doesn’t work and what I want to do:
I do want to control every other feature of my TV and the other Hi-Fi items like this. But how do I implement more, different commands to my “Bedroom TV”? Like “Alexa, bedroom tv one channel up”, “Alexa, mute the bedroom tv” or “Alexa, change bedroom TV to HDMI 2” when there is only one command input for me to enter the call for a python script (On/off channel)? I can save every IR code I need from my remote and call it via python - but where do I enter those calls?
Do I have to create a thing for every command I want to use? One “BedroomTVMute”, one “BedroomTVProgramUp” aso. aso. and enter the python call in the On/Off command field every time? That doesnt seem very logical to me, but works somehow and has some big disadvantages: many, many, many “things” in my list and I would have to say something like “Alexa, turn on bedroomtv mute”, which is stupid.
Sometimes, when I create a new Item with a switch to turn it on and off, I cant activate the switch on the paperUI webinterface. It took me hours of frustration to recognize, that I can control the switch on my OH app on the phone, but for some reason it remains broken on the web UI.
If someone could help me I would be soooooo lucky. But please notice: I am an absolute noob regarding this stuff. It took me DAYS to get OH2 up and running, I didn’t understand anything, have no experiences in Linux/scripting/python and was close to kill myself more than once those days. I had no idea about “tags” wondered why alexa refused to find anything, have no idea what REST actually means or does (apart from adding those tags to my items - why can’t I do that with the paperUI?) and managed to get to this point only by sheer luck and many hours reading stuff on the internet - but now I’m out of ideas and need your help. I never used anything else than the paperUI (just recently learned that it is fairly limited compared to the manual stuff - why?), so please, if I have to do something without that: Try to explain it to an absolute idiot, step by step… I am really not capable of the absolute basic stuff here… But I did my best until now… I assure you
Thanks in advance guys - really love the OH-spirit
It would be a lot easier to help if you post the Things, Items, Rules and Sitemap for what you already have working.
I can make some general observations:
Items are not controllable from PaperUI. PaperUI is an administration UI. You control Items from BasicUI, HABpanal, ClassicUI, etc.
Becasue tags are relatively new and PaperUI hasn’t implemented support for tags yet.
Because it, like much of OH, is still under development. The stuff that existed before PaperUI (i.e. text configs) are obviously going to be more capable becuase they have been around a lot longer.
If you haven’t already I recommend taking a step back and reading:
Thanks for your answer. Well at the moment I deleted all my things and items again, because it didn’t work out - like I said. I have a complete blank OH2 now ^^ - and to be honest: I dont really understand what a sitemap is and what it is good for. I already read many tutorials including the stuff you linked, but to be honest again, many, many times I found the usefull documentation of OH not very beginner friendly - and the stuff ment for beginners not usefull enough. But I think my situation is a fairly easy to describe, as I mentioned:
I want to add a bedroomtv thing, with the possibilty to execute several different python scripts when Alexa is asked to:
“Alexa, turn on bedroom TV” - Alexa communicates with myopenhab - certain python script is executed - RMPro fires certain IR code - TV turns on. (This already worked)
“Alexa, mute bedroom TV” - Alexa communicates with myopenhab - certain python script is executed - RMPro fires certain IR code - TV is muted. (Where to add the python command?)
Controlling your things via Paper UI is nice, but currently you can sort them only by editing the “Location” in the thing configuration. If you want to create your own view you can use a so called “sitemap” which can be displayed in the Basic UI (you remember, it was automatically installed at the beginning).
In openHAB a collection of Things and Items represent physical or logical objects of the user’s home automation setup. Sitemaps are used to select and prepare these elements in order to compose a user-oriented presentation of this setup for various frontends, including BasicUI, the Android openHAB app and others.
If you are dealing with external python scripts and Alexa integration what you are trying to do is not simple and will require a high degree of knowledge and understanding about how OH works.
I personally have no experience with Alexa but honestly you should worry about the Alexa part last. You need to get it working with Items on a sitemap first.
This is impossible. You cannot create sitemaps nor can you create Exec binding Things in PaperUI. Apparently there is a way to add tags to Items through the REST API so you can probably get away with using PaperUI for your Items. But for the rest you will have to edit text config files to make this work.
Before anyone can help you with anything we need to know the nature of the python script itself. What does it return? What arguments does it take? Does it require sudo? Stuff like that.
Thx again - I will try to go though this step by step. Hopefully I can achieve the things I want. And I hope that editor stuff wont be necessary anymore in the future ^^ - When Im done with the stuff and still cant get it to work I’m going to come back here for more questions ^^
Okay, I read through the tutorials and created a sitemap. I successfully added an “item” representing my bedroom tv. This item does appear on the classic UI and can be switched on and off. Activating the switch triggers the broadlink to send an IR command which turns on the tv. So far so good. Alexa does recognize that item and I can turn it on and off by telling her so. This is how it looks:
This does work - BUT:
Now I have the same problem as before! I don’t want to treat every command to the TV as a single device! I dont want to say “Turn mute bedroom TV on”. I want to create the bedroom TV as a “thing” with different input channels for Alexa to recognize. Like:
thing: Bedroom TV
input: On / Off (execute onoff.py)
input: Mute (execute mute.py)
input channel up (execute channelup.py)
Then I say: “Alexa, turn Bedroom TV on” or “Alexa, Mute Bedroom TV” or “Alexa, Bedroom TV channel up”
I wrote a long reply on this at some point but can’t find it. The tl;dr is basically you cannot create your own Things. Things are “owned” by the individual bindings. This means a Thing can only associate with one binding. That one binding dictates what Channels a Think has and the format for defining the Thing.
That being said, you are not even using Things so the above discussion is kind of irrelevant.
I know nothing of Alexa integration. Is there a way to receive a String from Alexa and use a Rule to parse that String and issue the right command? If not I think you can’t get there from here.