public WirehomeDictionary PostProcessMessage(string uid, [FromBody] WirehomeDictionary message)
        {
            var result = _componentRegistryService.ProcessComponentMessage(uid, message);

            result["component"] = _componentRegistryService.GetComponent(uid);
            return(result);
        }
        public IDictionary PostProcessMessage(string uid, [FromBody] WirehomeDictionary message, bool returnUpdatedComponent = true)
        {
            var result = _componentRegistryService.ProcessComponentMessage(uid, message);

            if (returnUpdatedComponent)
            {
                result["component"] = CreateComponentModel(_componentRegistryService.GetComponent(uid));
            }

            return(result);
        }
        public WirehomeDictionary PostProcessMessage(string uid, [FromBody] WirehomeDictionary message)
        {
            var result = _componentRegistryService.ProcessComponentMessage(uid, message);

            if (!_componentRegistryService.TryGetComponent(uid, out var component))
            {
                HttpContext.Response.StatusCode = (int)HttpStatusCode.NotFound;
                return(null);
            }

            result["component"] = component;
            return(result);
        }
 public PythonDictionary process_message(string component_uid, PythonDictionary message)
 {
     try
     {
         return(PythonConvert.ToPythonDictionary(PythonConvert.ToPythonDictionary(_componentRegistryService.ProcessComponentMessage(component_uid, message))));
     }
     catch (ComponentNotFoundException)
     {
         return(new PythonDictionary
         {
             ["type"] = "exception.component_not_found",
             ["component_uid"] = component_uid
         });
     }
 }
Esempio n. 5
0
 private void TryExecuteAction(MacroActionConfiguration action)
 {
     try
     {
         if (action is SendComponentMessageMacroActionConfiguration sendComponentMessageMacroAction)
         {
             _componentRegistryService.ProcessComponentMessage(
                 sendComponentMessageMacroAction.ComponentUid,
                 sendComponentMessageMacroAction.Message);
         }
     }
     catch (Exception exception)
     {
         _logger.LogError(exception, $"Error while executing action of macro '{Uid}'.");
     }
 }
Esempio n. 6
0
        public WirehomeDictionary PostProcessMessage(string uid, [FromBody] WirehomeDictionary message)
        {
            try
            {
                var component = _componentRegistryService.GetComponent(uid);

                var result = _componentRegistryService.ProcessComponentMessage(uid, message);
                result["component"] = component;
                return(result);
            }
            catch (ComponentNotFoundException)
            {
                HttpContext.Response.StatusCode = (int)HttpStatusCode.NotFound;
                return(null);
            }
        }
 public PythonDictionary process_message(string componentUid, PythonDictionary message)
 {
     return(_componentRegistryService.ProcessComponentMessage(componentUid, message));
 }