Error when using a custom capability - [string st/dispatcher.lua"]:232 attempt to concatenate a userdata value (local 'value')

I have a custom capability called status that has been working just fine for months.
I tried to create another identical custom capability called status1 and received the error [string st/dispatcher.lua"]:232 attempt to concatenate a userdata value (local ‘value’) when trying to emit an event to it.

I have also successfully create a number of other custom capabilities and I get the same error when attempting to emit a event.

Code to initiailise the status capability

local caps_status1 = caps[centerforgotten08495.status1]
device:emit_event(caps_status1.status(“Connected”)

status1CapabilityDefinition.json

{
“id”: “status1”,
“version”: 1,
“status”: “proposed”,
“name”: “status1”,
“ephemeral”: false,
“attributes”: {
“status”: {
“schema”: {
“type”: “object”,
“properties”: {
“value”: {
“type”: “string”
}
},
“additionalProperties”: false,
“required”: [
“value”
]
},
“enumCommands”:
}
},
“commands”: {}
}

status1CapabilityPresentation.json

{
“dashboard”: {
“states”: ,
“actions”:
},
“detailView”: [
{
“label”: “{{i18n.label}}”,
“displayType”: “state”,
“state”: {
“label”: “{{status.value}}”
}
}
],
“automation”: {
“conditions”: ,
“actions”:
},
“id”: “centerforgotten08495.status1”,
“version”: 1
}

Hi, @Tim99
Did you omit the symbol " wrapping the capability ID in this call for this post or also in the driver’s code?
Also, did you forget to copy the closing “)” of the command?
Those calls should look similar to the following:

local capabilities = require "st.capabilities"
local caps_status1= capabilities["centerforgotten08495.status1"]

--initialize value
device:emit_event(caps_status1.status("Connected"))

Hi @nayelyz , sorry for the mis-typing.
My code looks exactly like you have written and I am getting the error above.
It is driving me crasy as I have had the pretty much identical status custom capability working for months.
You help is very appreciated.

Hi, @Tim99
Following up, I used both capabilities centerforgotten08495.status and centerforgotten08495.status1 in the same driver and I get no errors.
So, the issue isn’t the capability itself but maybe in the driver. So, if I understand correctly you had the “status” capability and made a copy (“status1”) and added it to the same driver.

So, two questions come to mind:

  1. did you add the capability to the profile as well?
  2. Can you share the complete snippet of how you’re emitting the event? I mean the complete function, there was a time when there were issues with too many events sent at once, in my case, I’m sending 7 events, one for a different capability.
    You can send it over DM if you like.

SOLUTION

@nayelyz I’m embarrassed to say I forgot to put the centerforgotten08495.status1 in the profile.yml :face_with_open_eyes_and_hand_over_mouth:
centerforgotten08495.status was already there. That is why that capability worked.

Its am obscure error message though.
Thanks for helping me solve the issue.