Infernoken Posted December 14, 2020 Report Share Posted December 14, 2020 Hello, I'm trying my first steps with OpenHAB and have succesfully connected my IHC Visual2 controller (HW6.1 FW2.7.199) to OpenHAB. I'm now able to control my lights and such from OpenHAB. Now I'm trying if I can control some lights though voice and have read multiple forums, but cannot find a way to start... Example: I installed openHAB on my Android phone and this is connecting to my openHAB system. I can control the lights from my phone... There also is an option in this app to send a voice command. So I can send like: "bureau on"... I see the command is received in the log, but have no idea how to interprete the command and link it to the bureau light. Any help please? Don't know if the Android app of OpenHAB is the way to go or if this is a complete waste of time??? Some pointers / references would be appreciated Quote Link to comment Share on other sites More sharing options...
0 nXil Posted December 14, 2020 Report Share Posted December 14, 2020 First create a new String item called "VoiceCommands" or something like that. Then go to: openhab/paperui/index.html#/configuration/services?tab=voice and select the new String item called "VoiceCommands" Then you have to create a rule for each command in your rules folder, see https://www.openhab.org/docs/configuration/rules-dsl.html rule "Light kitchen" when Item VoiceCommands received command then val result = VoiceCommands.state.toString.toLowerCase if (result.contains("kitchen light on")) { GF_Kitchen_Light_Table.sendCommand(ON) } else if (result.contains("kitchen light off")) { GF_Kitchen_Light_Table.sendCommand(OFF) } end Here is a example off turning on and off my kitchen switch light. You can also use Rules in Paper UI, but it might be a little buggy because off lower and uppercase letters. Infernoken 1 Quote Link to comment Share on other sites More sharing options...
0 Infernoken Posted December 15, 2020 Author Report Share Posted December 15, 2020 12 hours ago, nxil said: First create a new String item called "VoiceCommands" or something like that. Then go to: openhab/paperui/index.html#/configuration/services?tab=voice and select the new String item called "VoiceCommands" Then you have to create a rule for each command in your rules folder, see https://www.openhab.org/docs/configuration/rules-dsl.html Thanks... Really my first steps in OpenHAB... Where do I create the String... So this is under items? Will try this evening... Quote Link to comment Share on other sites More sharing options...
0 nXil Posted December 15, 2020 Report Share Posted December 15, 2020 Yes, you create the item of type: String under Items in Paper UI, or you can to it in the Items folder. See https://www.openhab.org/docs/configuration/items.html Quote Link to comment Share on other sites More sharing options...
0 Infernoken Posted December 16, 2020 Author Report Share Posted December 16, 2020 Thanks, got a first implementation working...! Voice commands are received and then interpreted correctly to switch on the light and then switch off again. But there is some strange behavior: First voice command is directly and correctly executed. Second and further commands require me to say the commands two times before it actually switches the lights... If I look into the log, there is some strange behavior with 'predicted state' where it does receive the command, but it does not execute ??? Need to dig into this... Any idea ??? Quote Link to comment Share on other sites More sharing options...
0 nXil Posted December 17, 2020 Report Share Posted December 17, 2020 Maybe adding Event trigger update will help. when Item VoiceCommands received command or Item VoiceCommands received update then Quote Link to comment Share on other sites More sharing options...
0 Infernoken Posted December 17, 2020 Author Report Share Posted December 17, 2020 On 12/15/2020 at 1:57 PM, nxil said: Yes, you create the item of type: String under Items in Paper UI, or you can to it in the Items folder. See https://www.openhab.org/docs/configuration/items.html Thanks again for the input, but the dual behavior remains... UPDATE: got it working! 2nd UPDATE: Still buggy... Looks like the Item VoiceCommand received command or Item VoiceCommand received update Just trigger the two commands in one go... So still have problems with double commands required... Need to further debug... I created a home.items & home.rules file with the following commands: home.items: String VoiceCommand home.rules: import org.openhab.model.script.actions.* import org.openhab.core.library.types.* import java.util.* rule "VoiceControl_Test" when Item VoiceCommand received command or Item VoiceCommand received update then var String command = VoiceCommand.state.toString.toLowerCase if (command.contains("bureau aan")) { IHCELKOController_BureauN3BureauLamprelaisAanUit.sendCommand(ON) } if (command.contains("bureau uit")) { IHCELKOController_BureauN3BureauLamprelaisAanUit.sendCommand(OFF) } end Quote Link to comment Share on other sites More sharing options...
Question
Infernoken
Hello,
I'm trying my first steps with OpenHAB and have succesfully connected my IHC Visual2 controller (HW6.1 FW2.7.199) to OpenHAB.
I'm now able to control my lights and such from OpenHAB.
Now I'm trying if I can control some lights though voice and have read multiple forums, but cannot find a way to start...
Example:
I installed openHAB on my Android phone and this is connecting to my openHAB system.
I can control the lights from my phone...
There also is an option in this app to send a voice command. So I can send like: "bureau on"...
I see the command is received in the log, but have no idea how to interprete the command and link it to the bureau light.
Any help please?
Don't know if the Android app of OpenHAB is the way to go or if this is a complete waste of time???
Some pointers / references would be appreciated
Link to comment
Share on other sites
6 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.