Using to get nested level values Edge-side


In our Edge Actions, it’s straight-forward to use to access the value of say, the light value on a mangOH Red:

var light_val ="/light/value", 0);

However, for a resource such as /util/cellular/signal/value – this value has nested information such as “bars”, “rx_level”, and “lte” (lte in itself has another layer of info). If I wanted to get the rx_level value using the following:

var rx_level ="/util/cellular/signal/value/rx_level", 0);

We get an error Edge side to the effect of: Failed to read from /app/util/cellular/rx_level

Our workaround right now is to use on “/util/cellular/signal/value” which we inefficiently have to send a larger payload over to our Cloud Action. From the Cloud Action, we get the rx_level using:

var rx_level = event.elems.cellular.value.rx_level;

We’re pretty sure this is something simple in basic JavaScript that we’ve missed. Highly appreciated if anyone can point out how we can get the rx_level or similar nested resource values Edge side.


Think I answered my own question…

var signal_val ="/util/cellular/signal/value",0);
signal_val = signal_val ? signal_val : null;

var rx_level = 0;

if (signal_val) {
    rx_level = signal_val.value.rx_level;