Skip to content

Commit

Permalink
Fix plugins custom messages handling
Browse files Browse the repository at this point in the history
  • Loading branch information
sgallou committed Sep 5, 2024
1 parent 2b5e5e9 commit c031b02
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 3 additions & 2 deletions sources/server/pluginSystem/Manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ namespace pluginSystem
// Last, apply modifications
if (newData.Configuration.isDefined()
&& previousData->Configuration() != newData.Configuration())
// No need to notify configuration if instance was just enabled/disabled
// No need to notify configuration if instance was just enabled/disabled
{
// Configuration was updated, notify the instance if running
if (m_runningInstances.find(newData.Id()) != m_runningInstances.end())
Expand Down Expand Up @@ -633,7 +633,8 @@ namespace pluginSystem
const auto stateKw = m_dataProvider->getKeywordRequester()->getKeyword(device->Id, "state");
const shared::plugin::yPluginApi::historization::EPluginState state(
m_dataProvider->getKeywordRequester()->getKeywordLastData(stateKw->Id));
if (state == shared::plugin::yPluginApi::historization::EPluginState::kError)
if (state == shared::plugin::yPluginApi::historization::EPluginState::kCustom
|| state == shared::plugin::yPluginApi::historization::EPluginState::kError)
{
// In error state
const auto customMessageIdKw = m_dataProvider
Expand Down
6 changes: 6 additions & 0 deletions sources/server/web/rest/service/PluginV2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,12 @@ namespace web
if (locales->empty() || fullState->empty())
return {};

if (fullState->get<shared::plugin::yPluginApi::historization::EPluginState>("state") ==
shared::plugin::yPluginApi::historization::EPluginState::kStopped
|| fullState->get<shared::plugin::yPluginApi::historization::EPluginState>("state") ==
shared::plugin::yPluginApi::historization::EPluginState::kCustom)
return {};

auto messageId = fullState->get<std::string>("messageId");

if (messageId.empty())
Expand Down

0 comments on commit c031b02

Please sign in to comment.