I have a question: How to print a value in a string/number variable inside Base Python block? (MediumOne IOT board S3A7 SmartChef kit)

I try to print what is in any variable inside the python code.   I see log() functions being used in SmartChef code.    But, I don't see the string being shown in the log event window.

 

Here is an example where log() is used.

    if line > 8:

        line = 9

        log("this is a notification")      <---   This seems for debugging.

        display_size = 10 #lines

        state = json.loads(Store.get('state') or {})

        display = state.get('display',[])

 

So, I want to display what is in the status string for the following code with log().    Is this how I do it?  How to make it work?   It helps me debugging new code I write.

 

status = "FATAL" if buf[3] else "OK" if status_val == 0x00 else "RUNNING" if status_val == 0x10 else "BUSY" if status_val == 0x01 else "ERROR" if status_val == 0x80 else "FATAL"

log ("Air quality status is "+status)

 

I tried (renesas-docs.mediumone.com/.../.   It does only show what the value of tags go in and out of the workflow block, not any temporary variables inside the python block.

 

Thank,

Michael.

  • Michael,

    The 'Real Time Events Logs' on dashboard ONLY displays the events coming from the connected device/client. This widget is not for any kind of debugging logs.

    For the debug logs, of python statements in your workflows, you will need to enable the logs from that particular workflow. Inside the workflow, find the icon on the vertical toolbar at the right-hand-side of the window that looks like a lady-bug. Once you click it, it'll slide-open the debugger options widget and you can select if you want to enable the debugger. The logs will be written to a file, that you can see under 'Last 10 logs' label, and click on what you want to see. However, note that enabling the debug logs, will consume your credits at 10x rate, so be conservative of enabling the logs for no reason.

    For further documentation, refer to URL renesas-docs.mediumone.com

    You can also get a deeper insight about working with workflows by walking through these tutorials, from our blog site:
    renesas-blog.mediumone.com/.../
    renesas-blog.mediumone.com/.../
    renesas-blog.mediumone.com/.../

    I hope this answers your question.
  • In reply to Faheem:

    Hi Faheem,

    Thank you for explanation and solution. It works well. I am able to see my log text being recorded. It is very useful to debug the code. Thank you for warning on the credit point usage.

    Thank you for all the links to tutorials. I love to try all of them.

    Michael

    PS: I also want to learn about E2 developement tool. I have some problem to setup the basic project. I will create a new post for your help.