Giter Club home page Giter Club logo

Comments (4)

jamesweb-ms avatar jamesweb-ms commented on August 16, 2024

Thanks for the report. Aguilaaj already has a fix. This will go into December integration.

from azure-iot-remote-monitoring.

dave1981 avatar dave1981 commented on August 16, 2024

Is this fix available somewhere? Just to... test it :)

from azure-iot-remote-monitoring.

aguilaaj avatar aguilaaj commented on August 16, 2024

Hi @dave1981 -
We plan to make a proper fix sometime early December, but go ahead and try this in ActionProcessor.cs:

private async Task ProcessAction(dynamic eventData)
       {
           if (eventData == null) 
           {
               Trace.TraceWarning("Action event is null");
               return;
           }

           try
           {
               // NOTE: all column names from ASA come out as lowercase; see 
               // https://social.msdn.microsoft.com/Forums/office/en-US/c79a662b-5db1-4775-ba1a-23df1310091d/azure-table-storage-account-output-property-names-are-lowercase?forum=AzureStreamAnalytics 

               string deviceId = eventData.deviceid;
               string ruleOutput = eventData.ruleoutput;

               if (ruleOutput.Equals("AlarmTemp", StringComparison.OrdinalIgnoreCase))
               {
                   Trace.TraceInformation("ProcessAction: temperature rule triggered!");
                   double tempReading = ExtractDouble(eventData.reading);

                   string tempActionId = await _actionMappingLogic.GetActionIdFromRuleOutputAsync(ruleOutput);

                   if (!string.IsNullOrWhiteSpace(tempActionId))
                   {
                       await _actionLogic.ExecuteLogicAppAsync(
                       tempActionId,
                       deviceId,
                       "Temperature",
                       tempReading);
                   }
                   else
                   {
                       Trace.TraceError("ActionProcessor: tempActionId value is empty for temperatureRuleOutput '{0}'", ruleOutput);
                   }
               }

               if (ruleOutput.Equals("AlarmHumidity", StringComparison.OrdinalIgnoreCase))
               {
                   Trace.TraceInformation("ProcessAction: humidity rule triggered!");
                   double humidityReading = ExtractDouble(eventData.reading);

                   string humidityActionId = await _actionMappingLogic.GetActionIdFromRuleOutputAsync(ruleOutput);

                   if (!string.IsNullOrWhiteSpace(humidityActionId))
                   {
                       await _actionLogic.ExecuteLogicAppAsync(
                           humidityActionId,
                           deviceId,
                           "Humidity",
                           humidityReading);
                   }
                   else
                   {
                       Trace.TraceError("ActionProcessor: humidityActionId value is empty for humidityRuleOutput '{0}'", ruleOutput);
                   }
               }
           }
           catch (Exception e)
           {
               Trace.TraceError("ActionProcessor: exception in ProcessAction:");
               Trace.TraceError(e.ToString());
           }
   }

from azure-iot-remote-monitoring.

dave1981 avatar dave1981 commented on August 16, 2024

It works! :)

from azure-iot-remote-monitoring.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.