Fiware Actuator/Sensor On Off pattern with status - sensors

My configuration includes orion, IoT Agent JSON, and mongoDB.
I want to build a Fiware Lamp actuator and I want to have is on/off status (as sensor) as well.
At the moment I use a PATCH request with body (form ORION) :
At First with on command:
{
"on": {
"type" : "command",
"value" : ""
}
}
And then with off command:
{
"off": {
"type" : "command",
"value" : ""
}
}
When I receive anything from the above, I respond from the dummy device with 200 OK.
The above in my configuration makes both the on and off tags as pending:
{
"id": "urn:ngsi-ld:Lamp:001",
"type": "Lamp",
"TimeInstant": "2020-11-04T22:42:37.00Z",
"category": [
"actuator",
"sensor"
],
"controlledProperty": "lamp",
"function": [
"onOff",
"sensing"
],
"off_info": " ",
"off_status": "PENDING",
"on_info": " ",
"on_status": "PENDING",
"refStore": "urn:ngsi-ld:Store:001",
"state": " ",
"supportedProtocol": [
"JSON"
],
"supportedUnits": "My Unit 2",
"on": "",
"off": ""
}
I guess that I miss something in the way, so is there any response that I have to sent back to IoT Agent json to to make one of the two tags to stop be pending? Must I Update State or Info along the way?
P.S I expected to have a reply like this:
{
"id": "urn:ngsi-ld:Lamp:001",
"type": "Lamp",
"TimeInstant": "2020-11-04T22:42:37.00Z",
"category": [
"actuator",
"sensor"
],
"controlledProperty": "lamp",
"function": [
"onOff",
"sensing"
],
"off_info": " ",
"off_status": "PENDING",
"on_info": " ",
"on_status": "OFF",
"refStore": "urn:ngsi-ld:Store:001",
"state": " ",
"supportedProtocol": [
"JSON"
],
"supportedUnits": "My Unit 2",
"on": "",
"off": ""
}

The flow of a command can be seen below:
Assuming your command has reached the lamp and it has turned on, the result needs to be passed back into the IoT Agent. For the JSON IoT Agent, the payload looks something like this:
{"on" : "OK"}
Where the key is the name of the command, and the value is the status. My guess is that your device is just responding 200 OK without a payload, so the IoT Agent doesn't know which command has fired.
Note that in the case of a distributed network (e.g. MQTT or AMPQ) the response will be posted asynchronously on another topic so the command may be left in a PENDING state for some time.

Related

Slack API triggering action event for element in input block

My Slack app sends a radio-button question to the users. The app is built using bolt-js. The radio buttons are inside an input block (ref: Slack Block Kit).
According to bolt-js reference for the method app.action:
... Note that action elements included in an input block do not trigger any events.
However, I still receive events on the app.action listener from elements that are inside the input block.
The code for sending the message is this:
await client.chat.postMessage({
"channel": channelId,
"blocks": [
{
"type": "input",
"label": {
"type": "plain_text",
"text": "Some question"
},
"element": {
"type": "radio_buttons",
"options": [
{
"text": {
"type": "plain_text",
"text": "Option A",
},
"value": "value-0"
},
{
"text": {
"type": "plain_text",
"text": "Option B",
},
"value": "value-1"
},
],
"action_id": "some_action",
}
}
],
"text": "Some Text"
});
I have tried:
Removing the app.action('some_action') listener for this particular action. With this, the app logs show the following error:
[ERROR] An incoming event was not acknowledged within 3 seconds. Ensure that the ack() argument is called in a listener.
Removing the "action_id": "some_action" line from the block json. I still get the above mentioned error in the logs.
Explicitly setting "dispatch_action": false in the block json (which is false by default according to the input block reference). The event is still triggered.
I do not want the event to be triggered. What am I doing wrong?

Walmart API- Existing Type error issue- Bulk Items Setup(multiple)

I am able to make API calls to Walmart API through a Postman the bulk items Setup(Multiple) A POST request Response in an Successfully comes in postman, but in Walmart FeedId seeing an error. I am try to another way through excel it's working fine and publish the product in Walmart Successfully. Through API it's not working not publish the product in Walmart can you fix the error. even though I seem to have everything correct.
**HTTP REQUEST**
[enter image description here][1]
[https://marketplace.walmartapis.com/v3/feeds?feedType=item][1]
**METHOD**
POST
**HTTP RESPONSE STATUS**
200 OK
**HTTP RESPONSE BODY**
{
"feedId": "18486EF565B046D88641274001003195#AU8BCgA",
"additionalAttributes": null,
"errors": null
}
**REQUEST HEADERS**
Authorization : "XXXXXXXXXXXXX"
WM_SEC.ACCESS_TOKEN: "XXXXXXXXXXXXXXXXXX"
WM_QOS.CORRELATION_ID: {my arbitrary text key}
WM_SVC.NAME: Walmart Marketplace
Accept: application/JSON
**POST PAYLOAD**
<pre><code>{
"MPItem": [
{
"Item": {
"sku": "xxxxxxxx",
"ShippingWeight": "1LB",
"price": " ",
"productIdentifiers": {
"productIdType": "UPC",
"productId": "xxxxxxx"
},
"productCategory": "xxxxxxxx",
"asin": "",
"additionalProductAttributes": [
{
"productAttributeValue": "",
"productAttributeName": ""
}
],
"additionalOfferAttributes": [
{
"additionalOfferAttributeName": "",
"additionalOfferAttributeValue": ""
}
]
}
}
],
"MPItemFeedHeader": {
"locale": "en",
"sellingChannel": "mpsetupbymatch",
"version": "1.0",
"processMode": "REPLACE",
"subset": "EXTERNAL",
"Mart": "WALMART_US"
}
}</pre></code>
[1]: https://i.stack.imgur.com/YwaMJ.png
Your issue seems to be that ShippingWeight is invalid.
Their spec sheet says
"ShippingWeight": {
"type": "number",
"title": "Shipping Weight (lbs)",
"minimum": 0,
"maximum": 10000000000000000,
"exclusiveMaximum": false,
"multipleOf": 0.001
},
You need to replace ShippingWeight": "1LB", with ShippingWeight": "1",
Also you don't need to send additionalOfferAttributes if its going to be empty, it is not required.

ADF until block skipped property to send mail Email notification

If until activity skipped after 5 mins. I need to send a mail.
How to send the message from until to email notification pipeline.
Email notification have message as a parameter. What is the correct Syntax if pipeline skipped
<p>Hi All,<\/p>\r\n<p>Below pipeline got failed please find the error details.<\/p><br \/>\r\n<p>Pipeline Name : #{pipeline().Pipeline}<\/p>\r\n<p>Error Detail : <br\/>#{activity('LKP_INF_JOB_STATUS').output.error.message}<\/p>\r\n<p> <\/p>\r\n<p>Thanks,<br\/>SPC Support Team<\/p>\r\n<p> <\/p>\r\n<p><br \/>Note:This is an auto-generated email from XYZ, please do not reply directly to this email.<\/p>
[![enter image description here][1]][1]
[1]: https://i.stack.imgur.com/yUtUQ.png
I implemented a simple solution for this:
1. Give your Until Activity a specific timeout
2. Create a Web Activity that uses the ADF API to query the Until Activity using a Completion dependency (blue arrow)
Refer to this Stack Overflow for details on how to use this API in ADF:
How to get output parameter from Executed Pipeline in ADF?
URL: https://management.azure.com/subscriptions/#{pipeline().parameters.SubscriptionId}/resourceGroups/#{pipeline().parameters.ResourceGroupName}/providers/Microsoft.DataFactory/factories/#{pipeline().DataFactory}/pipelineruns/#{pipeline().RunId}/queryActivityruns?api-version=2018-06-01
Body:
{
"lastUpdatedAfter": "2018-06-16T00:36:44.3345758Z",
"lastUpdatedBefore": "#{utcnow()}",
"filters": [
{
"operand": "ActivityName",
"operator": "Equals",
"values": [
"Until Timeout after 1 min"
]
}
]
}
3. Use output from activity in Switch to determine which Email Activity to use (Failure, or TimeOut)
Expression:
#activity('Check Until Activity Status').output.value[0].status
4. Email Activity
{
"personalizations": [
{
"to": [
{
"email": "YourEmail#blah.com",
"name": "blah"
}
],
"cc": [
{
"email": "jane_doe#example.com",
"name": "Jane Doe"
}
],
"bcc": [
{
"email": "james_doe#example.com",
"name": "Jim Doe"
}
]
}
],
"from": {
"email": "blah#example.com",
"name": "Blah"
},
"subject": "SkipEmail",
"content": [
{
"type": "text/html",
"value": "This is a Skip Example, put whatever here"
}
]
}

GPS location for IoT central map tile

I am trying to get my IoT Central app to show the GPS location using a map tile. My JSON file sends over the location and i have this tied to the map tile but the map tile keeps saying "Waiting for data" I have tried everything to get this to show and i can't seem to get it to work.
I have followed the JSON layout as shown here
You can see the raw data tab below which shows the data coming in and that it is associating the data with the gps capability but the map shows nothing.
enter image description here
I have just made a quick test and it looks like everything is working well:
New App with a custom device template
Creating a View
Exporting a device template for my tester (simulator):
{
"#id": "urn:custom6ec42lhnjx:gps38u:1",
"#type": "CapabilityModel",
"contents": [],
"displayName": {
"en": "gps"
},
"implements": [
{
"#type": "InterfaceInstance",
"displayName": {
"en": "Interface"
},
"name": "gpsea",
"schema": {
"#id": "urn:custom6ec42lhnjx:gpsea:1",
"#type": "Interface",
"contents": [
{
"#type": [
"Telemetry",
"SemanticType/Location"
],
"displayName": {
"en": "gps"
},
"name": "gps",
"schema": "geopoint"
},
{
"#type": [
"Telemetry",
"SemanticType/Temperature"
],
"displayName": {
"en": "temp"
},
"name": "temp",
"schema": "double"
}
],
"displayName": {
"en": "Interface"
}
}
}
],
"#context": [
"http://azureiot.com/v1/contexts/IoTModel.json"
]
}
Provisioning and Simulating device (with a random values):
Dashboard IoT Central App:
Example with simulating your telemetry data:
I finally got it working, unfortunately only by starting again and deleting everything i had done thus far, as soon as i recreated my IoTC app and reimplemented the function that deals with the webhook everything worked perfectly. Still strange as the data format and everything else remained unchanged. But thank you for your help.

Azure IoT Central - Enum value displaying blank value in Dashboard

We are using a telemetry property "Bulb status" with an enum as shown below
"#id": "urn:veeazigbeeappdemo:ZigbeeDeviceTemplate_12r3:on_off:1",
"#type": "Telemetry",
"displayName": {
"en": "Bulb Status"
},
"name": "on_off",
"schema": {
"#id": "urn:veeazigbeeappdemo:ZigbeeDeviceTemplate_12r3:on_off:hxdsbx1pp:1",
"#type": "Enum",
"displayName": {
"en": "Enum"
},
"valueSchema": "string",
"enumValues": [
{
"#id": "urn:veeazigbeeappdemo:ZigbeeDeviceTemplate_12r3:on_off:hxdsbx1pp:On:1",
"#type": "EnumValue",
"displayName": {
"en": "On"
},
"enumValue": "1",
"name": "On"
},
{
"#id": "urn:veeazigbeeappdemo:ZigbeeDeviceTemplate_12r3:on_off:hxdsbx1pp:Off:1",
"#type": "EnumValue",
"displayName": {
"en": "Off"
},
"enumValue": "0",
"name": "Off"
}
]
}
The tile is made to display "Last Known value" in Template
When we send a payload as follows
payload = '{"on_off": %s}' % (random.choice([0, 1]))
we are getting the Bulb status correctly displayed as follows
when we send a payload which doesn't have Bulb status(on_off) telemetry property in it as below
payload = '{"current_level": %f}' % random.randrange(10.0, 100.0)
we are getting the Bulb status being shown as blank as follows
Correct Behaviour:
The Bulb status should show last know value from on_off property and should not display as blank when we don't send that telemetry property.
This kind of behavior with enum is causing an issue for us. Please provide the solution to overcome this.
Please let me know Where can I post this as a bug of Enum in Azure IoT Central?
It looks like an enum type is handling a null value differently than the other types. It seems to me, the unmodeled data should be not modify a dashboard.
As a workaround, Can you change type to the SemanticType/State? The State History is working well:
The feedback to the IoT Central team is here.

Resources