Forum

Browse topics, discover Works With Legrand community!

C2C notification error

Hi leslie

Sto provando il servizio C2C per lo smarther, ma sembra che il formato json ricevuto non sia corretto, testato da questo sito http://jsonpath.com/

Dove sbaglio?

json received:

{‘id’: ‘2020e1b6-e2db-4732-940f-014d6b8a6169’, ‘eventType’: ‘DeviceToCloud’, ‘subject’: ‘///bs_cloud_38306d7f-48c4-fd1c-e053-27182d0a3f63//’, ‘eventTime’: ‘2019-10-11T17:42:07.2162622+00:00’, ‘data’: {‘chronothermostats’: [{‘function’: ‘HEATING’, ‘mode’: ‘MANUAL’, ‘setPoint’: {‘value’: ‘7.50000’, ‘unit’: ‘C’}, ‘programs’: [{‘number’: ‘0’}, ‘temperatureFormat’: ‘C’, ‘loadState’: ‘INACTIVE’, ‘time’: ‘2019-10-11T17:36:00+00:00’, ‘thermometer’: {‘measures’: {‘timeStamp’: ‘2019-10-11T17:34:57+00:00’, ‘value’: ‘22.3’, ‘unit’: ‘C’}}, ‘hygrometer’: {‘measures’: {‘timeStamp’: ‘2019-10-11T17:34:57+00:00’, ‘value’: ‘95.0’, ‘unit’: ‘%’}}, ‘online’: False, ‘sender’: {‘addressType’: ‘AddressLocation’, ‘system’: ‘thermoregulation’, ‘plant’: {‘id’: ‘38306d7f-48c4-fd1c-e053-27182d0a3f63’, ‘module’: {‘id’: ‘d1097d8c-07af-fa6f-e053-20182d0a1b87’}}}, ‘receiver’: {‘oid’: ‘6781d753-c3ed-451e-8ca7-cd97893b8bf7’}}]}, ‘subjectElements’: {‘plantId’: ‘bscloud38306d7f-48c4-fd1c-e053-27182d0a3f63’}}]

json corrected by me as it should be:

{
“id”: “2020e1b6-e2db-4732-940f-014d6b8a6169”,
“eventType”: “DeviceToCloud”,
“subject”: “///bs_cloud_38306d7f-48c4-fd1c-e053-27182d0a3f63//”,
“eventTime”: “2019-10-11T17:42:07.2162622+00:00”,
“data”: {
“chronothermostats”: [{
“function”: “HEATING”,
“mode”: “MANUAL”,
“setPoint”: {
“value”: “7.50000”,
“unit”: “C”
},
“programs”: [{
“number”: “0”
}],
“temperatureFormat”: “C”,
“loadState”: “INACTIVE”,
“time”: “2019-10-11T17:36:00+00:00”,
“thermometer”: {
“measures”: {
“timeStamp”: “2019-10-11T17:34:57+00:00”,
“value”: “22.3”,
“unit”: “C”
}
},
“hygrometer”: {
“measures”: {
“timeStamp”: “2019-10-11T17:34:57+00:00”,
“value”: “95.0”,
“unit”: “%”
}
},
“online”: “False”,
“sender”: {
“addressType”: “AddressLocation”,
“system”: “thermoregulation”,
“plant”: {
“id”: “38306d7f-48c4-fd1c-e053-27182d0a3f63”,
“module”: {
“id”: “d1097d8c-07af-fa6f-e053-20182d0a1b87”
}
}
},
“receiver”: {
“oid”: “6781d753-c3ed-451e-8ca7-cd97893b8bf7”
}
}]
},
“subjectElements”: {
“plantId”: “bscloud38306d7f-48c4-fd1c-e053-27182d0a3f63”
}
}

 

  • This topic was modified 5 years, 2 months ago by Danye.

Sorry I’m writing in English…

Hi leslie

I’m trying the C2C service for the smarther, but it seems that the received json format is not correct, tested by this site http://jsonpath.com/

Where am I wrong?

json received:

{‘id’: ‘2020e1b6-e2db-4732-940f-014d6b8a6169’, ‘eventType’: ‘DeviceToCloud’, ‘subject’: ‘///bs_cloud_38306d7f-48c4-fd1c-e053-27182d0a3f63//’, ‘eventTime’: ‘2019-10-11T17:42:07.2162622+00:00’, ‘data’: {‘chronothermostats’: [{‘function’: ‘HEATING’, ‘mode’: ‘MANUAL’, ‘setPoint’: {‘value’: ‘7.50000’, ‘unit’: ‘C’}, ‘programs’: [{‘number’: ‘0’}, ‘temperatureFormat’: ‘C’, ‘loadState’: ‘INACTIVE’, ‘time’: ‘2019-10-11T17:36:00+00:00’, ‘thermometer’: {‘measures’: {‘timeStamp’: ‘2019-10-11T17:34:57+00:00’, ‘value’: ‘22.3’, ‘unit’: ‘C’}}, ‘hygrometer’: {‘measures’: {‘timeStamp’: ‘2019-10-11T17:34:57+00:00’, ‘value’: ‘95.0’, ‘unit’: ‘%’}}, ‘online’: False, ‘sender’: {‘addressType’: ‘AddressLocation’, ‘system’: ‘thermoregulation’, ‘plant’: {‘id’: ‘38306d7f-48c4-fd1c-e053-27182d0a3f63’, ‘module’: {‘id’: ‘d1097d8c-07af-fa6f-e053-20182d0a1b87’}}}, ‘receiver’: {‘oid’: ‘6781d753-c3ed-451e-8ca7-cd97893b8bf7’}}]}, ‘subjectElements’: {‘plantId’: ‘bscloud38306d7f-48c4-fd1c-e053-27182d0a3f63’}}]

json corrected by me as it should be:

{
“id”: “2020e1b6-e2db-4732-940f-014d6b8a6169”,
“eventType”: “DeviceToCloud”,
“subject”: “///bs_cloud_38306d7f-48c4-fd1c-e053-27182d0a3f63//”,
“eventTime”: “2019-10-11T17:42:07.2162622+00:00”,
“data”: {
“chronothermostats”: [{
“function”: “HEATING”,
“mode”: “MANUAL”,
“setPoint”: {
“value”: “7.50000”,
“unit”: “C”
},
“programs”: [{
“number”: “0”
}],
“temperatureFormat”: “C”,
“loadState”: “INACTIVE”,
“time”: “2019-10-11T17:36:00+00:00”,
“thermometer”: {
“measures”: {
“timeStamp”: “2019-10-11T17:34:57+00:00”,
“value”: “22.3”,
“unit”: “C”
}
},
“hygrometer”: {
“measures”: {
“timeStamp”: “2019-10-11T17:34:57+00:00”,
“value”: “95.0”,
“unit”: “%”
}
},
“online”: “False”,
“sender”: {
“addressType”: “AddressLocation”,
“system”: “thermoregulation”,
“plant”: {
“id”: “38306d7f-48c4-fd1c-e053-27182d0a3f63”,
“module”: {
“id”: “d1097d8c-07af-fa6f-e053-20182d0a1b87”
}
}
},
“receiver”: {
“oid”: “6781d753-c3ed-451e-8ca7-cd97893b8bf7”
}
}]
},
“subjectElements”: {
“plantId”: “bscloud38306d7f-48c4-fd1c-e053-27182d0a3f63”
}
}

Hi,

The received Json payload seems correct to me

It’s just received inline but not beautified

You can test to copy/paste it with some services to beautify it as : https://jsonformatter.curiousconcept.com/

Have a good day,

Leslie – Community Manager

I made a copy-paste on the site you reported to me and gave me errors. Could you check yourself by pasting the unformatted code that is the one I actually receive?

Try to copy/paste in the website and choose “Do not validate” in “Json specification”

You should not receive errors anymore

Have a good day,

Leslie – Community Manager

Yes, but there is an obvious error in the code, as the value of {‘online’: False} is expressed without quotes and generates an error on the JSON format

The “False” value has to be converted in boolean (it’s displayed as a string in the payload)

Have a good day,

Leslie – Community Manager

after many attempts I receive the following payload in response. unfortunately it does not seem to have a correct JSON format and for this reason I can’t get the data that interests me with my application.Can you please help me? Why do I get an incorrect payload?

{“data”: {“chronothermostats”: [{“function”: “HEATING”, “hygrometer”: {“measures”: [{“timeStamp”: “2019-10-17T18:28:47+00:00”, “unit”: “%”, “value”: “76.1”}}, “loadState”: “INACTIVE”, “mode”: “PROTECTION”, “online”: false, “programs”: {“number”: “1”}, “receiver”: {“oid”: “6781d753-c3ed-451e-8ca7-cd97893b8bf7”}, “sender”: {“addressType”: “AddressLocation”, “plant”: {“id”: “38306d7f-48c4-fd1c-e053-27182d0a3f63”, “module”: {“id”: “d43c6d7f-98e7-251f-e053-27182d0af645”}}, “system”: “thermoregulation”}, “setPoint”: {“unit”: “C”, “value”: “7.00000”}, “temperatureFormat”: “C”, “thermometer”: {“measures”: {“timeStamp”: “2019-10-17T18:28:47+00:00”, “unit”: “C”, “value”: “21.7”}}, “time”: “2019-10-17T18:28:46+00:00”}]}, “eventTime”: “2019-10-17T18:28:49.7031305+00:00”, “eventType”: “DeviceToCloud”, “id”: “5ff2cb2a-6e4a-4701-ab61-216d7e7981c8”, “subject”: “///bscloud38306d7f-48c4-fd1c-e053-27182d0a3f63//”, “subjectElements”: {“plantId”: “bscloud38306d7f-48c4-fd1c-e053-27182d0a3f63”}}]

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.