Hop til indhold
  • 0

Voice control with IHC and OpenHAB - first steps


Infernoken
 Share

Spørgsmål

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 til kommentar
Del på andre sites

6 svar på dette spørgsmål

Recommended Posts

  • 0

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.

Link til kommentar
Del på andre sites

  • 0
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...

Link til kommentar
Del på andre sites

  • 0

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 ???

Link til kommentar
Del på andre sites

  • 0
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

Link til kommentar
Del på andre sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Gæst
Svar på dette spørgsmål

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loader...
 Share

×
×
  • Tilføj...

Important Information

Privatlivspolitik og We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.

1200x630bb.png

ok