fix mocks to properly deal with the new way of reconfiguring

pull/309/head
Michael Zanetti 2020-06-17 16:35:09 +02:00
parent 573a2c061a
commit d529a27df1
2 changed files with 6 additions and 0 deletions

View File

@ -54,6 +54,7 @@ StateHandler::StateHandler(QObject *parent) :
JsonHandler(parent)
{
registerEnum<Types::Unit>();
registerEnum<Types::IOType>();
registerObject<State>();
registerObject<StateType>();

View File

@ -133,6 +133,11 @@ void IntegrationPluginMock::discoverThings(ThingDiscoveryInfo *info)
void IntegrationPluginMock::setupThing(ThingSetupInfo *info)
{
if (info->thing()->thingClassId() == mockThingClassId || info->thing()->thingClassId() == autoMockThingClassId) {
if (m_daemons.contains(info->thing())) {
// We already have a daemon, seem's we're reconfiguring
delete m_daemons.take(info->thing());
}
bool async = false;
bool broken = false;
if (info->thing()->thingClassId() == mockThingClassId) {