I am using sendEvent to load json data to a series of attributes. The SendEvent command grabs the correct json value and updates my current states, but the attributes remain empty (null) in the driver.
In the code below, the log shows the json value as 0 and the attribute as null. The device's current state also shows the attribute correctly at 0.
Do you have these custom attributes defined somewhere? Also, I'm not sure spaced are valid (convention is camelCase, though underscores like you have also work), but that is unlikely to be this particular problem.
It seems like it's my lack of understanding of what the sendEvent is doing or not doing in my situation. If I add another line of code to set the attribute directly, as shown below, I can use the attribute in my code.
No, variables are not the same as (not do they get automatically created as fields or similar from) attributes. Attributes must be accessed on the device in a way like currentValue("attributeName"). These are the same attributes you'd be updating with sendEvent(name: "attributeName",...). If that is not what you're doing, that could alao explain the problem.