Invalid device id sigfox

Hi there,

I have setup an application with 2 Sigfox devices from the same webhook.

problem is that when I make my workflow, I keep getting validation error: invalid device id

if i have many devices defined in an application, must the device tags be different for each device?

any help?

Hi Calvin,

You are not always getting a device back from the Device: Get Node, you can see it on your screenshot because the path at data.deviceResponse is null. You are then trying to access the path device.deviceResponse.id which is undefined and is an invalid ID, hence the error you are seeing. I think you may have a typo in the device tag you are sending to the webhook or you put the wrong value for the device tag that starts with sigfox.

Hope this helps,
Erin

It looks like you’re following the guide here, which is where I’d recommend starting:

The main issue is that you’re putting the ID in the device tag key. The key should be sigfox_id, not sigfox_40D769. The value of the tag is then the ID, which is correct in your example. You want all of your devices to have the same tag key of sigfox_id, which you can then query for the actual value itself. You’d then want to change your Device: Get node to sigfox_id key as well.

hi, i tried exactly as mentioned in the page you recommended.

however, i still got this error message.
This happens when the device type has few devices on Sigfox backend.

For the case where there is only 1 device under the device type, this error doesn’t show up.

application with 1 workflow.

with 1 device, i don’t get this problem.

with 2 devices, i get this problem.

this is the setting for the Device Get

for the above case, in Device, the tag is sigfox_id for both the devices…

is this correct?

should ‘sigfox_id’ used for 1st device, and ‘sigfox_id2’ be used for the 2nd device?

if i used the same tag ‘sigfox_id’ for all my devices in the same application, how do i differentiate the devices in Device Get?

when i installed webhook on Sigfox backend, there are 10 devices there…

so each device will report to my application (because of the webhook).

what if i don’t have devices defined in my application for some of the devices from sigfox backend? will I get this validation error?

I tried recreating the issue you described here, where the Device: Get node returns null for applications with multiple devices, but haven’t been able to do so.

Regarding the “Ammonia Sensor” application, the screenshot you provided is actually for the “Device State” output node, not the “Device: Get” data node. So I took a look in your account and in that application, your workflow is querying for the device tag “sigfox_id2”. Only one of the two devices in that application has such a tag (the other has a “sigfox_id” tag). So if you were trying to retrieve the device matching the Sigfox ID of the device with the “sigfox_id” tag, that would explain the null response as no devices match the query.

In the case of the “Room Occupancy” application, your “Device: Get” node is actually configured correctly but the “Device State” node that follows it isn’t actually using the result of that query, as it is setting state values for a specific device in your application and not the device that is the result of the query.

To guard against the case where there is no device matching the Sigfox ID you provide, you will want to use a Conditional Node after your Device: Get node to confirm that a device matching the query was found. Otherwise you will get the “Invalid Device ID” error and the workflow will stop at that point.

The Losant version of each of your Sigfox device’s are not automatically created. Like @Dylan_Schuster said, you’ll want to add a Conditional Node after the Device: Get Node to see if a Losant device was found for the matching sigfox_id.

If a matching device was not found, you’d then want to use a Device: Create to create it. You can then continue the workflow assuming the device will always exists. Here’s a screenshot of what this looks like:

Regarding the “Ammonia Sensor” application, the screenshot you provided is actually for the “Device State” output node, not the “Device: Get” data node. So I took a look in your account and in that application, your workflow is querying for the device tag “sigfox_id2”. Only one of the two devices in that application has such a tag (the other has a “sigfox_id” tag). So if you were trying to retrieve the device matching the Sigfox ID of the device with the “sigfox_id” tag, that would explain the null response as no devices match the query.

Dylan,

Since the tag query is set for sigfox_id2, it should give me the data for this other device right? why get validation error? Both devices exist.

Brandon,

I have created the 2 devices already, but still need to use Device: Create?

It won’t hurt to keep the Device: Create node. When data for those devices comes into the workflow, the create node will be skipped because a device with a matching sigfox_id already exists. As more of your Sigfox devices start reporting, the Create node can automatically create them on the fly, instead of you having to add each one manually.

For the conditional node, should i set this expression “{{data.body.device}}==={{sigfox_id}}”? if I want only the device with sigfox_id tag?

The conditional node is checking that the result of the previous Device: Get node is != null. It depends on where you put the result of the Device: Get node, but usually I use working.device, so that conditional is:

{{ working.device }} !== null

The Device: Get node will either put the device object on the result path or put null on the path if no device was found. This conditional is checking for that null.

ok thanks. will give it a try…