Skip to content

Subscribe to value changes #26

@Nico96R

Description

@Nico96R

I've experienced a problem with the subscription to a specific node with a leaf. I've use the following code, slightly adapted from your example.

I do get the node and its child leaf, but when I change the value of the leaf I do not get an update. Am I doing something wrong or is there an error in the implementation. Most likely I'm wrong and forgot something.
I've had the same results on the user labels of Lawos PowerCore Sources and on Matrix Labels by Riedels Mediornet.
On the Riedel Matrizes the following code worked perfectly.
Looking forward to your solution.

import {EmberClient} from "emberplus-connection";
import {FieldFlags} from "emberplus-connection/dist/model/Command";

const client = new EmberClient(IP, 9000);

const initember = async (): Promise<any> => {
    client.on("error", e => {
        console.log(e);
    });
    await client.connect()
// Get Root info
    const req = await client.getDirectory(client.tree)

    return await req.response
}

const testMethod = async (path: string): Promise<any> => {

    const testNode = await client.getElementByPath(path).then(async (node) => {
        console.log("Get Node: \n")
        console.log(await node)
        return (
          await client.getDirectory(await node, FieldFlags.All, (update) => {
                console.log(update)
            }
          )
        ).response
    }).catch(() => console.log(path + ": Node does not exist."))
    return testNode
}

//Riedels Matrix label
initember().then((x) =>
    testMethod("1.2.0.1.1.0").then((x => console.log(x))))

Metadata

Metadata

Assignees

No one assigned

    Labels

    Free for anyone to pick upThe maintainers are not actively looking into this, but PRs are welcomebugSomething isn't workinghelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions