39_gassistant: create GoogleAssistant room and dummy device on define

git-svn-id: https://svn.fhem.de/fhem/trunk@19694 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
dominik
2019-06-23 20:04:02 +00:00
parent 81d138e1be
commit deebecb6c3

View File

@@ -77,6 +77,14 @@ gassistant_Define($$)
my $name = $a[0];
$hash->{NAME} = $name;
if( !defined( $attr{$hash->{NAME}}{room} ) ) {
$attr{$hash->{NAME}}{room} = "GoogleAssistant";
#create dummy on/off device
CommandDefine(undef, "GoogleAssistant_dummy dummy");
CommandAttr(undef, "GoogleAssistant_dummy alias Testlight");
CommandAttr(undef, "GoogleAssistant_dummy setList on off");
CommandAttr(undef, "GoogleAssistant_dummy room GoogleAssistant");
}
my $d = $modules{$hash->{TYPE}}{defptr};
return "$hash->{TYPE} device already defined as $d->{NAME}." if( defined($d) && $name ne $d->{NAME} );
@@ -116,7 +124,7 @@ gassistant_Define($$)
sub
gassistant_Notify($$)
{
{
my ($hash,$dev) = @_;
return if($dev->{NAME} ne "global");
@@ -365,6 +373,7 @@ gassistant_configDefault($;$)
Log3 $name, 2, "$name: created default configfile: $configfile";
CommandAttr(undef, "$name gassistantFHEM-config $configfile") if( !AttrVal($name, 'gassistantFHEM-config', undef ) );
CommandAttr(undef, "$name nrarchive 10") if( !AttrVal($name, 'nrarchive', undef ) );
CommandSave(undef,undef) if( AttrVal( "autocreate", "autosave", 1 ) );
@@ -745,17 +754,15 @@ gassistant_Attr($$$)
<b>Set</b>
<ul>
<li>reload<br>
Reloads the device <code>name</code> or all devices in gassistant-fhem.
Will try to send a proacive event to amazon. If this succedes no manual device discovery is needed.
If this fails you have to you have to manually start a device discovery
for the home automation skill in the amazon gassistant app.</li>
Reloads the devices and sends them to Google.
</li>
<li>createDefaultConfig<br>
adds the default config for the sshproxy to the existing config file or creates a new config file. sets the
creates a default gassistant-fhem.cfg file
gassistantFHEM-config attribut if not already set.</li>
<li>clearCredentials<br>
clears all stored sshproxy credentials</li>
clears all stored credentials</li>
<li>unregister<br>
unregister and delete all data in FHEM Connect</li>