added ambient-link ability pack

This commit is contained in:
Robin Lehrmann
2020-10-04 12:28:56 +02:00
parent 212b5c5b55
commit 5bbc07999b
3 changed files with 56 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
services:
AmbientLink\SDK\SmartMonkeyConnection:
arguments: ['@amnient.link_connection_settings', '%env(AMBIENT_LINK_USERNAME)%', '%env(AMBIENT_LINK_PASSWORD)%']
amnient.link_connection_settings:
class: PhpMqtt\Client\ConnectionSettings
PhpMqtt\Client\Contracts\MQTTClient: '@PhpMqtt\Client\MQTTClient'
PhpMqtt\Client\MQTTClient:
arguments:
- '%env(AMBIENT_LINK_HOST)%'
- '%env(AMBIENT_LINK_PORT)%'
- '%env(AMBIENT_LINK_MONKEY_ID)%'
AmbientLink\SDK\Mqtt\MqttAdapter:
arguments:
$username: '%env(AMBIENT_LINK_USERNAME)%'
$password: '%env(AMBIENT_LINK_PASSWORD)%'

View File

@@ -0,0 +1,12 @@
{
"env": {
"AMBIENT_LINK_HOST": "",
"AMBIENT_LINK_PORT": "1883",
"AMBIENT_LINK_USERNAME": "",
"AMBIENT_LINK_PASSWORD": "",
"AMBIENT_LINK_MONKEY_ID": ""
},
"copy-from-recipe": {
"config/": "%CONFIG_DIR%/"
}
}

View File

@@ -0,0 +1,26 @@
<bg=blue;fg=white> </>
<bg=blue;fg=white> To finish the install </>
<bg=blue;fg=white> </>
* Your ability is almost ready:
1. Edit <comment>src/AbilityEventSubscriber</comment> and <info>implement</info> your logic:
public static function getSubscribedEvents(): array
{
return [
// can be found in AmbientLink\SDK\Event\
EnterRoomEvent::NAME => 'onEnterRoom',
];
}
public function onEnterRoom(EnterRoomEvent $event): void
{
$roomName = $event->roomName();
$this->logger->debug(sprintf('Some person enters room %s', $roomName));
// @todo implement logic here
}
* You can found Events in AmbientLink\SDK\Event\
* Using Ability Command? Try <info>php bin/console ability:debug --dummy</info>