Skip to Content
author's profile photo Former Member
Former Member

[IoT starter kit] problem pushing message to device

Hi, I'm using the python examples in the starter kit found here: SAP/iot-starterkit · GitHub

This far I've been capable of sending messages from the sensor to hana, and of controlling the sensor device using the push message option from the IoT cockpit, using this to change the state of the led or to display a message.

My problem comes when trying to do the same using the python example for pushing messages:

First of all: I receive a 200 response, it should be ok, but it's not.

with that response comes an html page that if I access and click a button send the data to hana and give me the following message:

{"msg":"Parse error. Expected [messageType] of type [string]"}

I've been using firebug to see how it's done when pushing from the cockpit and I'm using the same code in the python example, getting always this response.

It should be easy enough: just use srt() and it's a string, but no, it doesn't work.

The original line:

body='{"method":"http", "sender":"Push test UI", "messageType":"' + str(config.message_type_id_To_device) + '", "messages":[{"oper":"' + str(opcode) +

'", "data":"' + str(operand) + '"}]}'

The custom line: (like the one used from the IoT cockpit)

body = '{"messageType":"m0t0y0p0e3","messages":[{"opcode":"switch on","operand":"led 1"}],"method":"http","sender":"IoT App"}'

What am I missing here?


Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Oct 05, 2015 at 07:31 AM

    Hi, the issue it's been solved.

    After talking with one of the kit's devs I tried going trough the first steps of the guide again.

    The problem seems to be one of authentication, because I deleted the role configuration and created again and that solved the problem, just like that.

    thank you.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 02, 2015 at 09:50 PM

    Hello Daniel,

    what is your Python setup? I just tried the "" script with Python 2.7 and Python 3.4 (urllib version is urllib3-1.12). str() method works as expected.

    Did you try to hardcode the message type ID, so that no str() method is used to construct the body?



    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.